X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=contrib%2Fsnmp-probe-host.px;h=1d8f975b6a6066f41b94e4b18bb96dbf38ceb089;hb=d3a52ccd1bef9ed76d6374f9312668153fbbcb01;hp=bb9f3299cc9c9ca0513e452039ffa69fa63a3756;hpb=5c173359debb2664fad38f9b494d303bfc93496e;p=collectd.git diff --git a/contrib/snmp-probe-host.px b/contrib/snmp-probe-host.px index bb9f3299..1d8f975b 100755 --- a/contrib/snmp-probe-host.px +++ b/contrib/snmp-probe-host.px @@ -61,10 +61,13 @@ sub probe_one } @oids = split (/"\s*"/, $conf->{'values'}); - if (($conf->{'table'} =~ m/^(true|yes|on)$/i) && ($conf->{'instance'})) + if ($conf->{'table'} =~ m/^(true|yes|on)$/i) { $cmd = 'GETNEXT'; - push (@oids, $conf->{'instance'}); + if (defined ($conf->{'instance'})) + { + push (@oids, $conf->{'instance'}); + } } require Data::Dumper; @@ -96,6 +99,14 @@ sub probe_one { return; } + if (!defined ($status)) + { + return; + } + if ("$status" eq 'NOSUCHOBJECT') + { + return; + } } else { @@ -213,11 +224,6 @@ sub probe_all $version--; } # while ($version > 0) - if (!@valid_data) - { - return; - } - print < Address "$address" @@ -228,6 +234,14 @@ EOF { print " Collect \"$_\"\n"; } + if (!@valid_data) + { + print <