[英]How do I access printer SNMP data through JavaScript
How do I send and receive SNMP queries using JavaScript? 如何使用JavaScript发送和接收SNMP查询? I am trying to create a webpage for my employer that can query the company's printers and display toner and paper levels on the webpage.
我正在尝试为雇主创建一个网页,该网页可以查询公司的打印机并在网页上显示碳粉和纸张量。 I don't have access to the webserver itself, so I have to implement something client-side using HTML/JavaScript/etc.
我无权访问Web服务器本身,因此必须使用HTML / JavaScript / etc来实现客户端功能。 I did some searching and it looks like JavaScript doesn't have any native SNMP methods or functions, and the JavaScript libraries that I've found (net-snmp, node-snmp-native, node-snmpjs, and several others) all require Node.js , which my company doesn't use.
我做了一些搜索,看起来JavaScript没有任何本地SNMP方法或函数,并且我找到的JavaScript库(net-snmp,node-snmp-native,node-snmpjs和其他几个)都需要Node.js ,我公司不使用。
This is an impossible request. 这是不可能的要求。 SNMP is a network protocol.
SNMP是一种网络协议。 Javascript (client-side) has no socket support and can't communicate in any other protocol other than HTTP/HTTPS.
Javascript(客户端)不支持套接字,并且不能使用HTTP / HTTPS以外的任何其他协议进行通信。 The Node stuff is a whole different ball-game, because it's server side.
Node是完全不同的游戏,因为它是服务器端。
You can think of two solutions. 您可以想到两种解决方案。
Solution #2 is a long term solution and you will have more options here.This will give you web UI and it will be nice and useful for future. 解决方案2是一个长期解决方案,您将在此处有更多选择,这将为您提供Web UI,并且将来会非常有用。
Read What client-side web scripting languages are there other than JavaScript and VBScript? 阅读除了JavaScript和VBScript之外,还有哪些客户端Web脚本语言?
You can find out other client side scripting options. 您可以找到其他客户端脚本选项。 For Perl/Python , you have snmp client library .
对于Perl / Python,您具有snmp客户端库。
Other better option is , use VB Script and IE as client . 其他更好的选择是,使用VB Script和IE作为客户端。 There are VB Script snmp client libraries.
有VB脚本snmp客户端库。 This solution works only for IE.
此解决方案仅适用于IE。
Thanks 谢谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.