简体   繁体   English

来自easysnmp python库的snmp_walk function返回空列表

[英]snmp_walk function from easysnmp python library return empty list

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.我正在使用来自easysnmp python 库的 snmp_walk function 从Jacarta powerZook仪表中获取当前值,但它返回一个空列表(无值),但是当我使用Qtmib (SNMP MIB 浏览器)时,我可以获得该值。 I'm using Ubuntu 18.04 and tried all python interpreters (2.7, 3.5, 3.6, 3.7) but still nothing.我正在使用 Ubuntu 18.04 并尝试了所有 python 解释器(2.7、3.5、3.6、3.7),但仍然没有。 also I ran the python script with "sudo" privileges but still no results.我还使用“sudo”权限运行了 python 脚本,但仍然没有结果。 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: 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注意:我遵循了 powerZook 安装指南的所有说明和设置并搜索了互联网以找到解决方案,但不幸的是我没有找到任何可以帮助我的东西

screenshot for Qtmib and return values from powerZook enter image description here Qtmib 的屏幕截图和 powerZook 的返回值 在此处输入图像描述

The solution was as follow:解决方案如下:

  1. installing npcap (I'm not sure if this is part of the solution)安装npcap (我不确定这是否是解决方案的一部分)

  2. remove the last zero from OIDs and the two words "Current/AMPS"从 OID 中删除最后一个零和两个单词“Current/AMPS”

the original OIDs from device installation guide was like:设备安装指南中的原始 OID 如下:

'.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.我要感谢并感谢@hansolo花费时间和精力帮助我。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM