How to recreate the PNP4NAGIOS RRD files from XML file

AFAIK - the perfdata remains under ~/var/pnp4nagios/perfdata for CRE editions.

@JDamian
Sometimes the .rrd creation is interrupted and the pnp4nagios logic doesn’t try again if the .xml is already there.
The easy solution: delete the .xml file, it doesn’t hold any information that won’t be recreated automatically.

If that affects more then a few services, we use this little automation

cd ~/var/pnp4nagios/perfdata
omd stop nagios && omd stop rrdached
 
# walk through all xml files and check if the .rrd files they are configured to use exist
 
for file in */*.xml; do grep -Po "(/.*omd/.*.rrd)" $file | while read rrd ; do test -f $rrd || echo $file >> /tmp/xmls_to_delete; done; done 
 
# make sure each xml is only listed once, if you don't have "sponge" from the moreutils, redirect to a temp file instead
sort -u /tmp/xmls_to_delete | sponge /tmp/xmls_to_delete
 
# if you want to be extra careful, make a backup of all the xml files, but to be honest, I've never needed them. 
tar cjf ~/custom/perfdata_xml_backup.tar.bz2 -T /tmp/xmls_to_delete
 
# now delete the xml files
 
for file in $(cat /tmp/xmls_to_delete); do rm "$file"; done
 
omd start nagios
omd start rrdached
2 Likes