# Exec stdout and SSH

**URL:** <https://discourse.nodered.org/t/exec-stdout-and-ssh/43532>\
**Category:** General\
**Created:** [2 April 2021 02:46 UTC](https://discourse.nodered.org/t/exec-stdout-and-ssh/43532 "2021-04-02T02:46:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![leftymuller](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/leftymuller/32/102326_2.png) [@leftymuller](https://discourse.nodered.org/u/leftymuller)\
**Post date:** [2 April 2021 02:46 UTC](https://discourse.nodered.org/t/exec-stdout-and-ssh/43532/1 "2021-04-02T02:46:00Z")

</div>

G'Day all!

I am SSH'ing to other pi's to get their CPU load and Temp

It runs and gives output in a shell however node-red isnt seeing it because its not stdout

it runs locally fine.

ssh -l pi 192.168.2.246 top -d 0.5 -b -n2 | grep "Cpu(s)"|tail -n 1 | awk '{print $8}'

when run over SSH in node-red it returns ""

Any hints or ideas?

```auto
[{"id":"7913f633.36c7f8","type":"ui_level","z":"9f18fd18.1b796","group":"6b0bdb50.b72734","order":12,"width":2,"height":1,"name":"Nanna Temp","label":"","colorHi":"#e60000","colorWarn":"#ff9900","colorNormal":"#00b33c","colorOff":"#595959","min":0,"max":100,"segWarn":"60","segHigh":"70","unit":" °c","layout":"sh","channelA":"","channelB":"","decimals":0,"animations":"soft","shape":2,"colorschema":"fixed","textoptions":"default","colorText":"#eeeeee","fontLabel":"","fontValue":"","fontSmall":"","colorFromTheme":true,"textAnimations":false,"hideValue":false,"tickmode":"auto","peakmode":false,"property":"payload","peaktime":3000,"x":930,"y":2500,"wires":[]},{"id":"d88463d5.3666c","type":"ui_level","z":"9f18fd18.1b796","group":"6b0bdb50.b72734","order":11,"width":3,"height":1,"name":"Nanna CPU","label":"","colorHi":"#e60000","colorWarn":"#ff9900","colorNormal":"#00b33c","colorOff":"#595959","min":0,"max":100,"segWarn":"25","segHigh":"50","unit":"%","layout":"sh","channelA":"","channelB":"","decimals":0,"animations":"soft","shape":2,"colorschema":"fixed","textoptions":"default","colorText":"#eeeeee","fontLabel":"","fontValue":"","fontSmall":"","colorFromTheme":true,"textAnimations":false,"hideValue":false,"tickmode":"auto","peakmode":false,"property":"payload","peaktime":3000,"x":950,"y":2580,"wires":[]},{"id":"341af67d.e41fea","type":"exec","z":"9f18fd18.1b796","command":"ssh -l pi 192.168.2.246 'vcgencmd measure_temp'","addpay":false,"append":"","useSpawn":"false","timer":"","name":"Temp","x":410,"y":2520,"wires":[["b4e2036e.5c914"],[],[]]},{"id":"b4e2036e.5c914","type":"function","z":"9f18fd18.1b796","name":"SubString","func":"str = msg.payload \nmsg.payload = str.substring(5, 9);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":580,"y":2500,"wires":[["db29db56.38e768"]]},{"id":"e81b48d6.2a7358","type":"exec","z":"9f18fd18.1b796","command":"ssh -l pi 192.168.2.246 top -d 0.5 -b -n2 | grep \"Cpu(s)\"|tail -n 1 | awk '{print $8}' ","addpay":false,"append":"","useSpawn":"","timer":"","name":"LOAD","x":410,"y":2580,"wires":[["5d8ae535.27bc0c"],[],[]]},{"id":"5d8ae535.27bc0c","type":"function","z":"9f18fd18.1b796","name":"","func":"msg.payload = Number(msg.payload);\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":660,"y":2580,"wires":[["d88463d5.3666c"]]},{"id":"db29db56.38e768","type":"function","z":"9f18fd18.1b796","name":"","func":"msg.payload = Number(msg.payload);\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":720,"y":2500,"wires":[["7913f633.36c7f8"]]},{"id":"387ca3a5.e3010c","type":"inject","z":"9f18fd18.1b796","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"20","crontab":"","once":false,"onceDelay":"","topic":"","payload":"","payloadType":"date","x":230,"y":2540,"wires":[["341af67d.e41fea","e81b48d6.2a7358"]]},{"id":"6b0bdb50.b72734","type":"ui_group","name":"PI status","tab":"4f89aa36.129a94","order":2,"disp":true,"width":7,"collapse":false},{"id":"4f89aa36.129a94","type":"ui_tab","name":"Devices","icon":"fa-tablet","order":4,"disabled":false,"hidden":false}]

```

edit: I thought id try node-red-contrib-interactive-ssh

Its suppose to return an string of the output but it returns a buffer with nothing I can see useful?

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/0/e007178fd9b225c23379683038829f07ecbeeb26.png)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [2 April 2021 06:50 UTC](https://discourse.nodered.org/t/exec-stdout-and-ssh/43532/2 "2021-04-02T06:50:20Z")

</div>

What do you see if you click the raw button on the debug message?

---

<div class="post-metadata">

**Author:** ![leftymuller](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/leftymuller/32/102326_2.png) [@leftymuller](https://discourse.nodered.org/u/leftymuller)\
**Post date:** [2 April 2021 06:58 UTC](https://discourse.nodered.org/t/exec-stdout-and-ssh/43532/3 "2021-04-02T06:58:37Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/9/a913b890ed4812a783ef39cbba6cf6a8dd5f7700.png)

its outputting the input?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [2 April 2021 07:59 UTC](https://discourse.nodered.org/t/exec-stdout-and-ssh/43532/4 "2021-04-02T07:59:09Z")

</div>

You flow using the ssh command works for me (with appropriate IP and user change).

Add debug nodes set to show Complete Message to each output of the exec node and see what they show.

---

<div class="post-metadata">

**Author:** ![leftymuller](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/leftymuller/32/102326_2.png) [@leftymuller](https://discourse.nodered.org/u/leftymuller)\
**Post date:** [2 April 2021 08:19 UTC](https://discourse.nodered.org/t/exec-stdout-and-ssh/43532/5 "2021-04-02T08:19:58Z")

</div>

see thats weird because I wasnt getting any output the payload was ""

now i reimport the flow and it works.... WEIRD!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [16 April 2021 08:20 UTC](https://discourse.nodered.org/t/exec-stdout-and-ssh/43532/6 "2021-04-16T08:20:43Z")

</div>

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