Asking for help with IP nodes (getting network IP information)

Although I don't really need it, a problem has happened and I am wanting to use NR to help me with things.

I know I can use the host_IP node to get the IP of that machine, but I am wanting to get more information than just that.

I'm wanting to get/know the gateway also.
(And probably subnet and so on. Small steps at the start.)

I am not sure if such nodes exist - and there is nothing stopping me searching, but for what do I search.
I may search for what I think is the right term and get no results.
If I use a different term - of which I don't know - I would get results.

Someone? :wink:

You can always use an exec node to send commands and look at the output. Try this one"
ip r | grep default

Try this flow:

[{"id":"be67361ec73c22c4","type":"inject","z":"98ab90c151b96159","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"ip route | grep default","payloadType":"str","x":220,"y":560,"wires":[["305cc996126ee9a5"]]},{"id":"c9a114a973dbb2da","type":"debug","z":"98ab90c151b96159","name":"debug 35","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":720,"y":500,"wires":[]},{"id":"305cc996126ee9a5","type":"exec","z":"98ab90c151b96159","command":"","addpay":"payload","append":"","useSpawn":"false","timer":"","winHide":false,"oldrc":false,"name":"","x":430,"y":560,"wires":[["c9a114a973dbb2da"],["7e377194af54b2aa"],["a8d551509a9038a0"]]},{"id":"7e377194af54b2aa","type":"debug","z":"98ab90c151b96159","name":"debug 36","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":720,"y":560,"wires":[]},{"id":"a8d551509a9038a0","type":"debug","z":"98ab90c151b96159","name":"debug 37","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":720,"y":620,"wires":[]},{"id":"a384c836e1be463a","type":"catch","z":"98ab90c151b96159","name":"","scope":null,"uncaught":false,"x":240,"y":640,"wires":[["772bea42be29c0ba"]]},{"id":"772bea42be29c0ba","type":"debug","z":"98ab90c151b96159","name":"debug 38","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":460,"y":660,"wires":[]}]

Thanks Paul, but I seem to suffering with lack of intelligence these days.

When I import your flow and run it, I see this error:

{"_msgid":"f5b34ce0.cce3f","payload":"ip route | grep default","topic":"","error":{"message":"TypeError: \"file\" argument must be a non-empty string","source":{"id":"305cc996126ee9a5","type":"exec","count":1},"stack":"TypeError: \"file\" argument must be a non-empty string\n    at normalizeSpawnArguments (child_process.js:389:11)\n    at exports.spawn (child_process.js:502:38)\n    at Object.exports.execFile (child_process.js:218:15)\n    at exports.exec (child_process.js:148:18)\n    at ExecNode._inputCallback (/usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/function/90-exec.js:134:29)\n    at hooks.trigger (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:203:26)\n    at Object.trigger (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/hooks.js:113:9)\n    at ExecNode.Node._emitInput (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:195:11)\n    at ExecNode.Node.emit (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:179:25)\n    at ExecNode.Node.receive (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:476:10)"}}

But if I run the command it works.

I changed it and put the command in the exec node and unticked the include msg.payload and it works.

Thanks.
(I am using an old version of NR on this machine. 1.2.6)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.