使用 snmp 控制三洋投影机

发布于 2024-12-27 10:18:28 字数 3214 浏览 2 评论 0原文

我正在尝试使用 snmp 控制三洋投影仪 (PLC-XU106)。 Windows 应用程序PJ Network Manager 使用 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

使用 -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

I'm trying to control Sanyo projectors (PLC-XU106) using snmp. Windows application PJ Network Manager uses snmp to get temperatures from projectors and to control its status (power on, outputs etc...).

Now I need to control it with a bash script using snmpget and other tools from net-snmp

Using snmpwalk -v 1 -c public 192.168.1.99 to get a subtree of management values, I get these values:

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

And with snmpwalk -v 1 -c public 192.168.1.99 SNMPv2-SMI::enterprises.17363.101.101.102.101.105 i get this:

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

After some tests I've understood that some of these values are:

temperatures

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

lamp time.

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

But.. how can I change projector state? Power on/Standby or output? I cannot find a MIB definition.

Edit:

I can power on/off projector with http request:

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

But I guess there's a way to do this with snmp, like

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一场信仰旅途 2025-01-03 10:18:28

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

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

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

It's likely that you need to do one of these:

1) find the MIB for the device that defines what each of the OIDs are. If you have that, you can configure Net-SNMP to display the results such that you get more than a string of numbers and a value and suddenly everything will make sense. But this looks difficult unless it comes with your network management software, as it doesn't seem to be easily findable online.

2) So option #2 is capture the traffic to the device as you toggle the power with PJ and open the capture in wireshark. It should show you exactly what OIDs are being SET over SNMP to toggle the power, etc. Then writing a script to mimic that using snmpset is easy.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文