Reading Gauge32 type OID returns nil
Closed this issue · 6 comments
NetForces commented
Trying to read a Gauge32 type of OID:
snmpwalk -c public -v1 10.81.35.130 .1.3.6.1.2.1.17.7.1.4.5.1.1.1
SNMPv2-SMI::mib-2.17.7.1.4.5.1.1.1 = Gauge32: 805
When using the following code:
require 'netsnmp'
manager = NETSNMP::Client.new(host: "10.81.35.130", port: 161, community: "public",
timeout: 30, version: "1")
value = manager.get(oid: ".1.3.6.1.2.1.17.7.1.4.5.1.1.1")
puts "Value: [#{value}]"
puts value.inspect
manager.close
I get:
$ ruby test2.rb
Value: []
nil
HoneyryderChuck commented
https://github.com/swisscom/ruby-netsnmp/blob/master/lib/netsnmp/varbind.rb#L104
Long story short, this lib didn't ship with support for all aplication types, and those will return nil. Can you add a PR for gauge support?
NetForces commented
@HoneyryderChuck Thanks for the feedback I'll look at that over the ween-end.
HoneyryderChuck commented
No worries. For the record, I didn't interact with all kinds of application values, and I left them empty so people could contribute with their findings. You just have to figure out how to unpack it.
NetForces commented
To what I can see in the net-snmp2 library the Gauge32 data type is the same as a TimerTick:
So I'll give that a try.
NetForces commented
@HoneyryderChuck All yours.