diff options
author | Kristian Lyngstol <kly@kly.no> | 2016-11-10 20:46:22 +0100 |
---|---|---|
committer | Kristian Lyngstol <kly@kly.no> | 2016-11-10 20:46:22 +0100 |
commit | a4684336edfc510e8e5b7a7752cd5c531ab6c26f (patch) | |
tree | 02e7c06cfb30f357dd91c89c9670119f326dd113 /collectors/snmpfetchng.pl | |
parent | 200cf04d24927349c25c77363ffe4782df17fcbf (diff) |
Push all numerical snmp-data to graphite
Fixes #126
Diffstat (limited to 'collectors/snmpfetchng.pl')
-rwxr-xr-x | collectors/snmpfetchng.pl | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/collectors/snmpfetchng.pl b/collectors/snmpfetchng.pl index 70cdf4b..680c392 100755 --- a/collectors/snmpfetchng.pl +++ b/collectors/snmpfetchng.pl @@ -140,12 +140,10 @@ sub callback{ for my $nic (@nicids) { $tree2{'ports'}{$tree{$nic}{'ifName'}} = $tree{$nic}; for my $tmp_key (keys $tree{$nic}) { - my $path = "snmp.$switch{'sysname'}.$tree{$nic}{'ifName'}.$tmp_key"; + my $path = "snmp.$switch{'sysname'}.ports.$tree{$nic}{'ifName'}.$tmp_key"; my $value = $tree{$nic}{$tmp_key}; if ($value =~ m/^\d+$/) { print $sock "$path $value $now_graphite\n"; - } else { - mylog ("??? $path $value $now_graphite"); } } @@ -154,6 +152,15 @@ sub callback{ for my $iid (keys %tree) { for my $key (keys %{$tree{$iid}}) { $tree2{'misc'}{$key}{$iid} = $tree{$iid}{$key}; + my $localiid = $iid; + if ($iid ne "") { + $localiid = ".$iid"; + } + my $path = "snmp.$switch{'sysname'}.misc.$key$localiid"; + my $value = $tree{$iid}{$key}; + if ($value =~ m/^\d+$/) { + print $sock "$path $value $now_graphite\n"; + } } } if ($total > 0) { |