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.
-
A question that is off topic will be downvoted. Please read [How to Ask](http://stackoverflow.com/help/how-to-ask). – zhon Aug 18 '16 at 19:27
-
My apologies, I thought that this would have fallen under programming problems, or is this not a specific enough question? – Jeremiah McGowan Aug 18 '16 at 19:40
-
When you say "without Node.js" do you mean the browser? Have you tried to code anything? Have you done any research? Are you wanting a webserver/client solution? Did you read [How to Ask](http://stackoverflow.com/help/how-to-ask) including the link "How to ask questions the smart way." This could be an interesting programming question, but the lack of details, examples and research only lead to downvotes not answers. – zhon Aug 18 '16 at 19:50
-
OK - I added as much detail as I could. – Jeremiah McGowan Aug 19 '16 at 12:05
-
You answered your own question in your updated question (as did @codenoir): How can I do X in Y when Y doesn't support X? – zhon Aug 19 '16 at 15:26
-
You could explore the fact that many printers have an status webpage. – zhon Aug 19 '16 at 15:29
-
zhon - Y doesn't *natively* support X - that doesn't mean it couldn't be made to work somehow. Not in this case though I'm afraid. Our printers do have status pages, but I was hoping to compile all of the printers on to 1 page to get a quick overview. We have a lot of printers. – Jeremiah McGowan Aug 19 '16 at 17:01
2 Answers
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.

- 4,326
- 1
- 14
- 25
-
I don't want this to be the answer, but I'm pretty sure it is. :( – Jeremiah McGowan Aug 19 '16 at 16:59
You can think of two solutions.
- Use java snmp client libraries and java swing as front end.
- 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
-
Unfortunately I'm not in a position to install anything on the clients or the servers and IT security is a bit paranoid, so I have to find a solution that can run off a webpage in Internet Explorer using standard client-side technologies (HTML, JavaScript, CSS) – Jeremiah McGowan Aug 19 '16 at 13:18
-