Skip to content

Instantly share code, notes, and snippets.

@mikakaraila
Created August 1, 2016 06:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikakaraila/9fc584b38830cfa80bbc9f468762d1de to your computer and use it in GitHub Desktop.
Save mikakaraila/9fc584b38830cfa80bbc9f468762d1de to your computer and use it in GitHub Desktop.
SNMP node usage example (MOXA EDS-518A)

Simple example how snmp nodes can be used. Look from the MIB file OID address that corresponding switch uses. You have to add parser (function node) to read actual content from the payload.

[{"id":"75c5f1c6.56241","type":"snmp","host":"192.168.77.13","community":"public","version":"1","oids":"1.3.6.1.2.1.2.2.1.8.1","name":"Port01 (get OK)","x":344.89581298828125,"y":113.88888549804688,"z":"274f3737.bf0f18","wires":[["d085f9e6.016858"]]},{"id":"e5a4f80b.8bfa38","type":"inject","name":"Test","topic":"","payload":"","payloadType":"none","repeat":"","crontab":"","once":false,"x":175.8958282470703,"y":113.88888549804688,"z":"274f3737.bf0f18","wires":[["75c5f1c6.56241"]]},{"id":"d085f9e6.016858","type":"debug","name":"","active":true,"console":"false","complete":"payload","x":573.8957977294922,"y":115.88888549804688,"z":"274f3737.bf0f18","wires":[]},{"id":"9ff12da9.82a26","type":"inject","name":"Test","topic":"","payload":"","payloadType":"none","repeat":"","crontab":"","once":false,"x":160.89581298828125,"y":174.88888549804688,"z":"274f3737.bf0f18","wires":[["ff62d996.816d78"]]},{"id":"867ded10.3458c","type":"debug","name":"","active":true,"console":"false","complete":"false","x":595.8957366943359,"y":174.88888549804688,"z":"274f3737.bf0f18","wires":[]},{"id":"ff62d996.816d78","type":"snmp","host":"192.168.77.13","community":"public","version":"1","oids":"1.3.6.1.2.1.2.2.1.8.1,\n1.3.6.1.2.1.2.2.1.8.2,\n1.3.6.1.2.1.2.2.1.8.3,\n1.3.6.1.2.1.2.2.1.8.4,\n1.3.6.1.2.1.2.2.1.8.5,\n1.3.6.1.2.1.2.2.1.8.6,\n1.3.6.1.2.1.2.2.1.8.7,\n1.3.6.1.2.1.2.2.1.8.8","name":"Ports 1-8 (table OK)","x":353.8957824707031,"y":174.88888549804688,"z":"274f3737.bf0f18","wires":[["867ded10.3458c"]]},{"id":"21b3235e.e5379c","type":"comment","name":"net-snmp","info":"","x":316.89576721191406,"y":28.888885498046875,"z":"274f3737.bf0f18","wires":[]},{"id":"947eb302.1f486","type":"comment","name":"node-red-contrib-snmp","info":"","x":358.89576721191406,"y":67.88888549804688,"z":"274f3737.bf0f18","wires":[]},{"id":"68d042a.123f7bc","type":"snmp subtree","host":"192.168.77.13","community":"public","version":"1","oids":"1.3.6.1.2.1.2.2.1.8","name":"Subtree","x":326.89581298828125,"y":233.88888549804688,"z":"274f3737.bf0f18","wires":[["209eddb8.540ba2"]]},{"id":"397962ad.644eee","type":"inject","name":"Test","topic":"","payload":"","payloadType":"none","repeat":"","crontab":"","once":false,"x":158.89581298828125,"y":232.88888549804688,"z":"274f3737.bf0f18","wires":[["68d042a.123f7bc"]]},{"id":"209eddb8.540ba2","type":"debug","name":"","active":true,"console":"false","complete":"payload","x":595.8957977294922,"y":230.88888549804688,"z":"274f3737.bf0f18","wires":[]},{"id":"beaddfdd.d8557","type":"inject","name":"Test","topic":"","payload":"","payloadType":"none","repeat":"","crontab":"","once":false,"x":153.89581298828125,"y":287.8888854980469,"z":"274f3737.bf0f18","wires":[["9251c612.173468"]]},{"id":"bc259f1e.7e5ea","type":"debug","name":"","active":true,"console":"false","complete":"payload","x":590.8957977294922,"y":285.8888854980469,"z":"274f3737.bf0f18","wires":[]},{"id":"9251c612.173468","type":"snmp walker","host":"192.168.77.13","community":"public","version":"1","oids":"1.3.6.1.2.1.2.2.1","name":"Walker","x":339.8958282470703,"y":287.8888854980469,"z":"274f3737.bf0f18","wires":[["bc259f1e.7e5ea"]]},{"id":"93ab7e15.044be","type":"comment","name":"Port status","info":"Value == 1 # Port is connected\nValue == 2 # Port is not connected\n","x":765.5148315429688,"y":115.54073333740234,"z":"274f3737.bf0f18","wires":[]},{"id":"b8b080f4.8398c","type":"comment","name":"Walker","info":"This wil take time to iterate and\ndump the whole OID table.","x":329.51483154296875,"y":341.54073333740234,"z":"274f3737.bf0f18","wires":[]},{"id":"6fc78485.5f542c","type":"comment","name":"Subtree","info":"Faster to use than multiple single requests.","x":791.5148315429688,"y":230.54073333740234,"z":"274f3737.bf0f18","wires":[]}]
@janvda
Copy link

janvda commented Feb 16, 2017

Hi,
Thanks for the flow. The snmp node is working but the snmp subtree node is returning nothing and the snmp walker node is logging error:

msg : string[41]
"TypeError: response.add is not a function"

Do you have any idea what might be the issue ?
I am using version 16.1 of node red and version 0.10 of snmp on raspberry pi (jessie OS).

kr
jan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment