This post introduces a check strategy to monitor the freshness of Nagios performance graphs.
When the feature is enabled Nagios is generating performance graphs, that are updated automatically with the execution of a single check. Such a check result delivers also the so called “performance data”, content interpreted by dedicated listeners behind the Nagios process. The results are stored and maintained within RRD databases.
After updates of Nagios checks the number or the names of data sources of a check restult may change. But within RRD Databases Datasources are fixed positions and the RRD Database itsfelf can not be extended with the RRDTool version 1.2. This leads to the problem, that the performance graph is not growing anymore and a NaN error occures. In the same moment the database is not updated anymore.
Example: The diskspace check retrieves an additional volume and therefore an additional data source.
The check runs on the file structure of the archive containing the RRD files. Old files are identified and highlighted.
The arguments -a allows to define the maximum time in seconds to be passed since the last modification to determine a file to be “outdated”.
The arguments -w and -c define on the other hand the number of such old files to be found in order to get a warning or critical result.
An additional argument ‘-R’ enables the check to automatically remove eventual files reaching the freshness limit. In this case there will be removed the RRD (file.rrd) and the (file.xml).
A check result where old files had been found:
[root@pbzsilx001 plugins]# ./check_perfdata.sh -h
Usage: check_perfdata.sh [-a max_file_age] [-w max_warning] [-c max_critical] [-R]
-h, –help : this help
-a max_file_age: Integer of seconds since last file modification to determine that a RRD is old. 
-w max_warning: Integer of maximum number of old RRD files to get a warning 
-c max_critical: Integer of maximum number of old RRD files to get a critical 
-R Set this argument to automatically remove a old RRD file
./check_perfdata.sh -a 86400 -w 1 -c 10