Skip to content

Instantly share code, notes, and snippets.

@7171u
Created November 17, 2015 14:38
Show Gist options
  • Save 7171u/5a2c310b81e225ee21c9 to your computer and use it in GitHub Desktop.
Save 7171u/5a2c310b81e225ee21c9 to your computer and use it in GitHub Desktop.
pnp4nagios last update error (No recent data in graph).
#!/bin/bash
#Author:Anon
#Run against all .rrd files inside /usr/local/pnp4nagios/var/perfdata/
for file in $(find /usr/local/pnp4nagios/var/perfdata/ -name "*.rrd"); do
rrdtool dump "$file" | perl -ne 'BEGIN {$t=`date +%s`; chomp($t);} $a=$_; if ($a =~ /lastupdate.\d+..lastupdate/) { $a =~ s/(lastupdate.)\d+(..lastupdate)/$1$t$2/; } print $a' | rrdtool restore -f - "$file"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment