Globbing patch

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];
+ }
}

# —————————————-