jonnystorm / snmp-elixir

An SNMP client library for Elixir
Mozilla Public License 2.0
33 stars 12 forks source link

ArgumentError :binary.list_to_bin[138] #47

Closed fbettag closed 4 years ago

fbettag commented 4 years ago

Hi there,

i've finally come around implementing our SNMP support with your elixir library! Lots of stuff is working, but i am having troubles with integer values from APC Power Bars.

I can access the oid for the label of the APC port just fine, but as soon as i try to query for "state" (1 on, 2 off, 3 power cycle), it blows up with something like this:

iex(1)> creds = MyTest.SNMP.credentials; MyTest.SNMP.APC.get_peak_load_amps(creds, "10.4.20.11")
[debug] Will register agent snmp://10.4.20.11 with target [197, 16, 229, 7, 48, 247, 54, 229, 42, 198, 123, 7, 161, 31, 27, 197, 96, 184, 137, 9] and config [engine_id: [128, 0, 0, 0, 6], address: [10, 4, 20, 11], port: 161, tdomain: :transportDomainUdpIpv4, community: 'test', sec_model: :v1, version: :v1].
** (ArgumentError) argument error
    (stdlib) :binary.list_to_bin(138)
    (snmp_ex) lib/snmp.ex:416: anonymous fn/1 in SNMP.groom_snmp_result/1
    (elixir) lib/enum.ex:1336: Enum."-map/2-lists^map/1-0-"/2
    (anycast) lib/test/snmp.ex:125: MyTest.SNMP.APC.get_peak_load_amps/2

Any idea what this could be?

jonnystorm commented 4 years ago

This was just a failure to correctly parse integer results. Fixed by #49.

fbettag commented 4 years ago

i can confirm that this is now working like a charm! thank you very much!