--- ganglia_ipmimonitoring.pl.orig 2010-12-21 15:20:21.202972142 -0700 +++ ganglia_ipmimonitoring.pl 2010-12-21 22:23:53.368659256 -0700 @@ -52,6 +52,7 @@ # -d - print debug info # -D - do not send sensor data to ganglia (useful during debugging) # -H - output help +# -e - use this expression to run against the name given to gmetric # # Environment Variables: # @@ -125,6 +126,7 @@ my $IPMIMONITORING_OUTPUT; my @IPMIMONITORING_OUTPUT_LINES; +my $GMETRIC_HOST_EXPR = ""; my $line; my $cmd; @@ -134,6 +136,7 @@ my $prog = $0; print "Usage: $prog -h -M -m -G -g -d -H\n"; print " -h specify hostname(s) to remotely access\n"; + print " -e use this expression to run against the hostname given to gmetric\n"; print " -M specify an alternate ipmimonitoring path\n"; print " -m specify additional ipmimonitoring arguments\n"; print " -G specify an alternate gmetric path\n"; @@ -144,7 +147,7 @@ exit 0; } -if (!getopts("h:M:m:G:g:dDH")) +if (!getopts("h:M:m:G:g:e:dDH")) { usage(); } @@ -159,6 +162,11 @@ $IPMI_HOSTS = $main::opt_h; } +if (defined($main::opt_e)) +{ + $GMETRIC_HOST_EXPR = $main::opt_e; +} + if (defined($main::opt_M)) { $IPMIMONITORING_PATH = $main::opt_M; @@ -308,6 +316,11 @@ $id_string =~ s/ /_/g; $id_string =~ s/\//_/g; + + if ($GMETRIC_HOST_EXPR) { + eval('$hostname =~ ' . "$GMETRIC_HOST_EXPR;"); + } + if ($hostname ne "localhost" && $hostname ne "127.0.0.1") { my $packet_ip = gethostbyname($hostname);