用snmp控制三洋投影机

时间:2012-01-18 12:04:20

标签: snmp net-snmp mib

我正在尝试使用snmp控制三洋投影机(PLC-XU106)。 Windows应用程序 PJ网络管理器使用snmp从投影仪获取温度并控制其状态(开机,输出等......)。

现在我需要使用snmpget和来自net-snmp

的其他工具使用bash脚本来控制它

使用snmpwalk -v 1 -c public 192.168.1.99获取管理值的子树,我得到以下值:

SNMPv2-MIB::sysDescr.0 = STRING: 1.001 00000 01012
SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.17363.101.101.102.101.105
DISMAN-EVENT-MIB::sysUpTimeInstance = INTEGER: 0
SNMPv2-MIB::sysContact.0 = STRING: 
SNMPv2-MIB::sysName.0 = STRING: 
SNMPv2-MIB::sysLocation.0 = STRING: 
SNMPv2-MIB::sysServices.0 = INTEGER: 64
IF-MIB::ifNumber.0 = INTEGER: 1

使用snmpwalk -v 1 -c public 192.168.1.99 SNMPv2-SMI::enterprises.17363.101.101.102.101.105我得到了这个:

SNMPv2-SMI::enterprises.17363.101.101.102.101.105.101.0 = INTEGER: 1968
SNMPv2-SMI::enterprises.17363.101.101.102.101.105.102.0 = INTEGER: 0
SNMPv2-SMI::enterprises.17363.101.101.102.101.105.103.101.0 = STRING: "Computer1"
SNMPv2-SMI::enterprises.17363.101.101.102.101.105.103.102.0 = STRING: "ANALOG"
SNMPv2-SMI::enterprises.17363.101.101.102.101.105.103.103.0 = INTEGER: 2
SNMPv2-SMI::enterprises.17363.101.101.102.101.105.104.101.0 = INTEGER: 32
SNMPv2-SMI::enterprises.17363.101.101.102.101.105.104.102.0 = INTEGER: 0
SNMPv2-SMI::enterprises.17363.101.101.102.101.105.105.101.0 = INTEGER: 0
SNMPv2-SMI::enterprises.17363.101.101.102.101.105.105.102.0 = INTEGER: 4
SNMPv2-SMI::enterprises.17363.101.101.102.101.105.106.101.101.0 = INTEGER: 0
SNMPv2-SMI::enterprises.17363.101.101.102.101.105.106.101.102.0 = INTEGER: 0
SNMPv2-SMI::enterprises.17363.101.101.102.101.105.106.101.103.0 = INTEGER: 0
SNMPv2-SMI::enterprises.17363.101.101.102.101.105.106.102.101.0 = INTEGER: 347
SNMPv2-SMI::enterprises.17363.101.101.102.101.105.106.102.102.0 = INTEGER: 432
SNMPv2-SMI::enterprises.17363.101.101.102.101.105.106.102.103.0 = INTEGER: 308
SNMPv2-SMI::enterprises.17363.101.101.102.101.105.107.101.0 = INTEGER: 3
SNMPv2-SMI::enterprises.17363.101.101.102.101.105.107.102.0 = INTEGER: 1
SNMPv2-SMI::enterprises.17363.101.101.102.101.105.107.103.0 = INTEGER: 1
SNMPv2-SMI::enterprises.17363.101.101.102.101.105.108.0 = STRING: "XU106"
SNMPv2-SMI::enterprises.17363.101.101.102.101.105.109.101.0 = INTEGER: -1
SNMPv2-SMI::enterprises.17363.101.101.102.101.105.109.102.0 = INTEGER: 1
End of MIB

经过一些测试后我才明白其中一些值是:

温度

SNMPv2-SMI::enterprises.17363.101.101.102.101.105.106.102.101.0 = INTEGER: 347
SNMPv2-SMI::enterprises.17363.101.101.102.101.105.106.102.102.0 = INTEGER: 432
SNMPv2-SMI::enterprises.17363.101.101.102.101.105.106.102.103.0 = INTEGER: 308

灯泡时间。

SNMPv2-SMI::enterprises.17363.101.101.102.101.105.101.0 = INTEGER: 1968

但是......如何更改投影机状态?开机/待机或输出?我找不到MIB定义。

编辑:

我可以通过http请求打开/关闭投影机电源:

curl -d "POWER+ON=ON" 192.168.1.99/index.htm
curl -d "POWER+OFF=Standby" 192.168.1.99/index.htm

但我想有一种方法可以用snmp做这个,比如

snmpset -v 1 -c public 192.168.1.99 SNMPv2-SMI::enterprises.17363.101.101.102.101.105.102.0 i 128

1 个答案:

答案 0 :(得分:2)

您可能需要执行以下操作之一:

1)找到定义每个OID的设备的MIB。如果你有这个,你可以配置Net-SNMP来显示结果,这样你就可以得到一串以上的数字和一个值,突然间一切都会有意义。但这看起来很难,除非它附带你的网络管理软件,因为它似乎不容易在网上找到。

2)因此,当您使用PJ切换电源并在wireshark中打开捕获时,选项#2捕获到设备的流量。它应该准确地向您显示通过SNMP设置的OID以切换功率等。然后编写脚本来模仿使用snmpset很容易。