Reading SNMP Object index of type IPAddress

与世无争的帅哥 提交于 2019-12-06 11:29:53

Note that you have a table with multiple indices in this particular case.

The fact is that you cannot directly read the table entries with snmp-get service, since the index is dynamic (and, as a consequence, the OID address). But you can discover the values with snmp-get-next (v1) and snmp-get-bulk (v2) services.

For example, you can read the indices (and store them for querying table items later) or directly read the items of the table :

  • you ask snmp-get-next for IP-MIB::ipAdEntNetMask
  • the reply will be IP-MIB::ipAdEntNetMask.172.16.38.42 IPV4 255.255.0.0
  • (So: first index is 172.16.38.42 in that case!)
  • you iterate and ask next value after IP-MIB::ipAdEntNetMask.172.16.38.42
  • the reply will be IP-MIB::ipAdEntNetMask.172.16.11.43 IPV4 255.255.0.0
  • etc.. until there is no other value, or the value is not on the same tree

The service snmp-get-bulk will enable you to query N values directly in this way.

Have a look at Net-Snmp's snmptable that does good job with tables : http://net-snmp.sourceforge.net/wiki/index.php/TUT:snmptable

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!