From a8b70210cadb5891ae4adc04ee2284531ebb86c4 Mon Sep 17 00:00:00 2001 From: Steve Schnepp Date: Tue, 23 Apr 2013 22:20:55 +0200 Subject: [PATCH] plugins: fix the params handling --- plugins/node.d/snmp__if_multi.in | 9 +++++---- plugins/node.d/snmp__uptime.in | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/plugins/node.d/snmp__if_multi.in b/plugins/node.d/snmp__if_multi.in index 73df4b27b7..a446e71372 100644 --- a/plugins/node.d/snmp__if_multi.in +++ b/plugins/node.d/snmp__if_multi.in @@ -1,15 +1,15 @@ #!@@GOODSH@@ +export host=${host:-$(basename $0 | cut -f2 -d '_' | tr '_' '.')} # Handle caps if [ "$1" = "config" -a "$2" = "cap" ]; then - HOSTNAME=$(basename $0 | cut -f2 -d '_' | tr '_' '.') - [ "$HOSTNAME" = "localhost" ] || echo "host_name $HOSTNAME" + [ "$host" = "localhost" ] || echo "host_name $host" echo "multigraph dummy" exit 0 fi -@@PERL@@ -w <<__END__ +@@PERL@@ -w "$@" <<'__END__' # -*- cperl -*- =head1 NAME @@ -130,7 +130,6 @@ be able to use 64 bit counters - if the device supports them. This problem is a feature of the device SNMP implementation or your usage of it, it is nothing the plugin can fix. In the future Munin -__END__ may be able to run the plugin more often than the counter wraps around. @@ -850,3 +849,5 @@ if ($ARGV[0] and $ARGV[0] eq "config") { } do_fetch(); + +__END__ diff --git a/plugins/node.d/snmp__uptime.in b/plugins/node.d/snmp__uptime.in index 9479b24e35..966667c32e 100644 --- a/plugins/node.d/snmp__uptime.in +++ b/plugins/node.d/snmp__uptime.in @@ -1,15 +1,15 @@ #!@@GOODSH@@ +export host=${host:-$(basename $0 | cut -f2 -d '_' | tr '_' '.')} # Handle caps if [ "$1" = "config" -a "$2" = "cap" ]; then - HOSTNAME=$(basename $0 | cut -f2 -d '_' | tr '_' '.') - [ "$HOSTNAME" = "localhost" ] || echo "host_name $HOSTNAME" + [ "$host" = "localhost" ] || echo "host_name $host" echo "multigraph dummy" exit 0 fi -@@PERL@@ -w <<__END__ +@@PERL@@ -w "$@" - <<'__END__' # -*- cperl -*- # vim: ft=perl