Instead of the “brutal solution” by using a cronjob - in case of pnp4nagios perfdata cleanup I guess there’s a checkmk on-board configuration for that routine:
Global settings >> Site Management >> Automatic disc space cleanup >> Current settings >>
Delete files older than: xy days
Also see inline help for that parameter:
The historic events (state changes, downtimes etc.) of your hosts and services is stored in the monitoring history as plain text log files. One history log file contains the monitoring history of a given time period of all hosts and services. The files which are older than the configured time will be removed on the next execution of the disk space cleanup.
The historic metrics are stored in files for each host and service individually. When a host or service is removed from the monitoring, it’s metric files remain untouched on your disk until the files last update (modification time) is longer ago than the configure age.
In comparison to:
... >> Automatic disc space cleanup >> Current settings >>
Cleanup of abandoned host files older than (e.g. w.r.t. .rrd files)
And its inline help:
During monitoring there are several dedicated files created for each host. There are, for example, the discovered services, performance data and different temporary files created. During deletion of a host, these files are normally deleted. But there are cases, where the files are left on the disk until manual deletion, for example if you move a host from one site to another or deleting a host manually from the configuration.
The performance data (RRDs) and HW/SW inventory archive are never deleted during host deletion. They are only deleted automatically when you enable this option and after the configured period.