简体   繁体   中英

How do I access printer SNMP data through JavaScript

How do I send and receive SNMP queries using JavaScript? 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. 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.

This is an impossible request. SNMP is a network protocol. Javascript (client-side) has no socket support and can't communicate in any other protocol other than HTTP/HTTPS. The Node stuff is a whole different ball-game, because it's server side.

You can think of two solutions.

  1. Use java snmp client libraries and java swing as front end.
  2. Use Node.js server and snmp.js library.

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.

Read What client-side web scripting languages are there other than JavaScript and VBScript?

You can find out other client side scripting options. For Perl/Python , you have snmp client library .

Other better option is , use VB Script and IE as client . There are VB Script snmp client libraries. This solution works only for IE.

Thanks

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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