Hi,
back in the days we used to use the cleanup_perfdata.py from @MarsellusWallace to cleanup performance data. I assume this is not needed anymore due to the option in Global settings: Automatic disk space cleanup: Clean up abandoned host files older than, but this deletes files of abandoned hosts only including their services.
What about vanished services from existing hosts?
can we use Delete files older than option as well to cleanup performance data for services in the community and pro editions, or is the script still needed?
Best regards
If it is only single performance data files, like from removed services, you need to use the script for the community edition. Inside pro edition it is not so easy as it was with PNP4Nagios data files. Inside pro there are files that are not written/changed every time the system writes data for the service (info files). You can only search for RRD files that are not changed longer than X days ago. Then you need to find the corresponding info file for this RRD and need to delete booth.
Thanks Andreas,
I just found this filesystem housekeeping from Checkmk Knowledge Base, doesn’t that mean that using the other options like Delete files older than in the Automatic disk space cleanup setting would also remove single performance data files as well?
Normally not. But i don’t know if someone has build a plugin for the disk space cleanup.
Beware that “Cleanup abandoned host files older than” only handles completely missing hosts, not specific missing services, whereas the other two settings would also remove left service files.
this sounds pretty much as if the other options will delete single files, I’ll remove the cleanup_perfdata.py file and cron and test the option with a shorter time. As it is Updated Dec 01, 2025 , that sounds like it would work.
And this is from the inline help for Delete files older than
The historic events (state changes, downtimes etc.) of your hosts and services are 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 has been removed from the monitoring, its metric files remain untouched on your disk until the files last update (modification time) is longer ago than the configured age.
The historic events (state changes, downtimes etc.) of your hosts and services are 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.
I am afraid this means that log files that contain historic events will also be deleted, so I’ll loose old performance data as well, not only vanished services.
For pro/Enterprise, we usually use this one-liner to find old rrd files (older than 90 days in this example) and delete the .rrd files along with their .info files. Works with bash, don’t use in other shells!
cd ~/var/check_mk/rrd && find ./ -type f -name "*.rrd" -mtime +90 | while read f; do rm -f ${f%.*}.*; done
Change -mtime according to your needs to lower or higher values, but don’t change the rm command, unless you know what you’re doing! ${f%.*} is a bash parameter expansion and strips off the file extension .rrd, so that then all files .rrd and .info for this filename are deleted, regardless of their file extension and age. (Age is only determined by the .rrd files in the find command.)
It’s also a good idea to first execute it whithout the | while... pipe to have a look at what metrics you will be deleting, first (will show only the .rrd files)
Kind regards, Dirk.