Search Exchange
Search All Sites
Login
Directory
aseques
byaseques, May 13, 2013
This is a small pathc to allow fuzzy names (with globbing), it helps when integrating with cacti, so we can make a match like servername_service_*.rrd that is more effective.
--- /tmp/check_rrd.pl 2013-05-13 14:05:11.000000000 +0200
+++ check_rrd.pl 2013-05-13 16:35:09.000000000 +0200
@@ -313,8 +313,16 @@
# main
# -----------------------------------------------------------------------
+#In case the file is a glob expression (*), expand it and check if matches
if ( ! -r $rrdfile ) {
- $np->nagios_die("rrdfile $rrdfile not readable or does not exist");
+ my @filelist = glob "$rrdfile";
+ if ( ! @filelist) {
+ $np->nagios_die("rrdfile $rrdfile not readable or does not exist");
+ } elsif ( scalar(@filelist)!=1 ) {
+ $np->nagios_die("Glob matches more than one file @filelist
");
+ } else {
+ $rrdfile=$filelist[0];
+ }
}
# ----------------------------------------
--- /tmp/check_rrd.pl 2013-05-13 14:05:11.000000000 +0200
+++ check_rrd.pl 2013-05-13 16:35:09.000000000 +0200
@@ -313,8 +313,16 @@
# main
# -----------------------------------------------------------------------
+#In case the file is a glob expression (*), expand it and check if matches
if ( ! -r $rrdfile ) {
- $np->nagios_die("rrdfile $rrdfile not readable or does not exist");
+ my @filelist = glob "$rrdfile";
+ if ( ! @filelist) {
+ $np->nagios_die("rrdfile $rrdfile not readable or does not exist");
+ } elsif ( scalar(@filelist)!=1 ) {
+ $np->nagios_die("Glob matches more than one file @filelist
");
+ } else {
+ $rrdfile=$filelist[0];
+ }
}
# ----------------------------------------
byaseques, May 13, 2013
This would be a sample query:
./check_rrd.pl -R rra_file.rrd --ds data_source -w100 -c150 --start -10min --end -5min
The important thing is the --end -5min, if you use now, the last value might be a NAN, then it would always give a CRITICAL (because there are NaN values)
./check_rrd.pl -R rra_file.rrd --ds data_source -w100 -c150 --start -10min --end -5min
The important thing is the --end -5min, if you use now, the last value might be a NAN, then it would always give a CRITICAL (because there are NaN values)
byaseques, November 20, 2009
The last release it's from 2007 and only checks that the xen http server is listening.
A simple telnet would replace that in a more efficient way.
A simple telnet would replace that in a more efficient way.


Directory
New Listings


