0

I'm using snmp_walk function from easysnmp python library to get the current value from Jacarta powerZook meter but it returns an empty list (no values) but when I use Qtmib (SNMP MIB browser) I can get the value. I'm using Ubuntu 18.04 and tried all python interpreters (2.7, 3.5, 3.6, 3.7) but still nothing. also I ran the python script with "sudo" privileges but still no results. FYI the power meter connected directly to the ethernet port of my PC. my code:

from easysnmp import snmp_walk

snmp_walk(oids='.1.3.6.1.4.1.19011.1.3.5.1.3.1.0 - Current/AMPS', hostname='192.168.1.200', 
          community='public', version=1, timeout=3, retries=5, remote_port=161, use_long_names=True, 
          retry_no_such=True, abort_on_nonexistent=True)

output:

[]

Note: I followed all instructions and settings of the powerZook's installation guide and searched internet to find a solution but unfortunately I didn't find anything can help me

screenshot for Qtmib and return values from powerZook enter image description here

Qudor Eng
  • 368
  • 3
  • 10
  • I am not sure OIDs support strings like `- Current/AMPS` :/ Could you try without those ? – han solo Oct 07 '19 at 12:56
  • @hansolo thank you for your replay, please check easysnmp library webpage they put the OIDs as strings (https://easysnmp.readthedocs.io/en/latest/index.html) – Qudor Eng Oct 07 '19 at 12:59
  • Yes, i have seen like `IFTABLE::ifIndex`, and `.1.3...`. But not together :/ – han solo Oct 07 '19 at 13:00
  • Could you point me where you have seen OID used like `.1.3.6.1.4.1.19011.1.3.5.1.3.1.0 - Current/AMPS` ? – han solo Oct 07 '19 at 13:02
  • @hansolo, if I used the OIDs without ' ' it will return syntax error :( – Qudor Eng Oct 07 '19 at 13:06
  • @hansolo, This OID from the installation guide of the device and I use it in qtmib and it working fine see the screenshot from my PC (https://i.stack.imgur.com/Dmiyj.png) – Qudor Eng Oct 07 '19 at 13:08
  • I didn't say, without quotes. I said use like, `snmp_walk(oids='.1.3.6.1.4.1.19011.1.3.5.1.3.1.0', hostname='192.168.1.200', community='public', version=1, timeout=3, retries=5, remote_port=161, use_long_names=True, retry_no_such=True, abort_on_nonexistent=True)` – han solo Oct 07 '19 at 13:08
  • @hansolo, Sorry, I tried the OIDs without "Current/AMP" and I got the same results :( – Qudor Eng Oct 07 '19 at 13:13
  • Could you paste the latest update ? Also, do a manual `snmpwalk -v2c -c public 192.168.1.200 .1.3.6.1.4.1.19011.1.3.5.1.3.1.0` , and let me know what you get – han solo Oct 07 '19 at 13:14
  • @hansolo, I used this code: snmp_walk(oids='.1.3.6.1.4.1.19011.1.3.5.1.3.1.0', hostname='192.168.1.200', community='public', version=1, timeout=3, retries=5, remote_port=161, use_long_names=True, retry_no_such=True, abort_on_nonexistent=True) output: [] – Qudor Eng Oct 07 '19 at 13:14
  • And what about the command i gave ? What is the output of that ? – han solo Oct 07 '19 at 13:17
  • @hansolo, I did manual (snmpwalk -v2c -c public 192.168.1.200 .1.3.6.1.4.1.19011.1.3.5.1.3.1.0 ) and got (Timeout: No Response from 192.168.1.200) – Qudor Eng Oct 07 '19 at 13:18
  • So, it means that is not enabled in the server/device, hence the empty list – han solo Oct 07 '19 at 13:23
  • You can try walking upper levels like `snmpwalk -v2c -c public 192.168.1.200 .1.3.6.1.4.1.19011.1.3.5` and see if you hit something – han solo Oct 07 '19 at 13:30
  • @hansolo, I used this command (snmpwalk -v2c -c public 192.168.1.200 .1.3.6.1.4.1.19011.1.3.5) and the response was (Timeout: No Response from 192.168.1.200) – Qudor Eng Oct 07 '19 at 18:53
  • Are you sure you can ping `192.168.1.200` ? It looks like either you are not connected to the network or that OID is not enabled in that host – han solo Oct 08 '19 at 02:35
  • @hansolo when I ping the IP using (ping -c 5 192.168.1.200) the output is (PING 192.168.1.200 (192.168.1.200) 56(84) bytes of data. 64 bytes from 192.168.1.200: icmp_seq=1 ttl=255 time=0.344 ms 64 bytes from 192.168.1.200: icmp_seq=2 ttl=255 time=0.318 ms 64 bytes from 192.168.1.200: icmp_seq=3 ttl=255 time=0.239 ms 64 bytes from 192.168.1.200: icmp_seq=4 ttl=255 time=0.246 ms 64 bytes from 192.168.1.200: icmp_seq=5 ttl=255 time=1.22 ms --- 192.168.1.200 ping statistics 5 packets transmitted, 5 received, 0% packet loss, time 4075ms rtt min/avg/max/mdev = 0.239/0.475/1.228/0.378 ms ) – Qudor Eng Oct 08 '19 at 05:46
  • @hansolo, I think the problem in the snmp development tool or snmp net tool – Qudor Eng Oct 08 '19 at 05:46
  • @hansolo, I can retreive the value from the device using qtmib application that mean there is connection between my PC and the device but the problem I think in snmp tool – Qudor Eng Oct 08 '19 at 05:48
  • @hansolo, After installing wireshark and npcap and change the version from 2 to 1 (snmpwalk -t 3 -v 1 -c public 192.168.1.200 .1.3.6.1.4.1.19011.1.3.5) I can get the values but still the easysnmp library return empty list – Qudor Eng Oct 08 '19 at 06:49
  • Oh, Okay. This is good progress. I am out, will update shortly – han solo Oct 08 '19 at 07:30

1 Answers1

0

The solution was as follow:

  1. installing npcap (I'm not sure if this is part of the solution)

  2. remove the last zero from OIDs and the two words "Current/AMPS"

the original OIDs from device installation guide was like:

'.1.3.6.1.4.1.19011.1.3.5.1.3.1.0 - Current/AMPS'

after modification become like:

'.1.3.6.1.4.1.19011.1.3.5.1.3.1'

I would like to thank and give my gratitude to @hansolo for his time and effort to help me.

Qudor Eng
  • 368
  • 3
  • 10