Persistent SSH Node

Is there something like a persistent SSH node available? I'm hoping it can behave like this: when Node-RED starts up or Deploy is pushed I'm hoping it can connect and then wait for input. Likewise, anything that is received would then be sent to the output.

I found node-red-contrib-bigssh but it's not a persistent connection. It connects, sends the command, returns the output and then disconnects.

Not really a good idea to tie Node-RED into a persistent SSH connection. It is better to manage the connection externally.

One thing you can do with SSH is to create a "tunnel". This lets you define a local IP port that connects you to a remote IP port. So you could set up a service on the remote device that talks over that tunnel.

For example, you could have Node-RED running on both ends and use the TCP in/out nodes to communicate directly. Or you could have an MQTT broker on each end. Or indeed many other variations.

Not hard to set up the SSH client to run as a background process.

Whats the reason behind it not being a good idea?

I'm trying to communicate with a Cisco switch over SSH on the same layer 2 network.

Flow:
Input (data sent) <---> Persistent SSH node to switch <---> Output (data received)

Two large, disparate clients linked together? What's to like about that? Also SSH is meant to be secure, tying it to a NodeJS service - what could possibly go wrong?

Of course, that's just my opinion. Nothing stopping you.

Does it support SNMP? That is designed for ongoing monitoring and is likely to be a better solution.

It does support SNMP, however, I'm also trying to connect to Cisco TelePresence device. While both do support SNMP, the TelePresence is very limited from an SNMP standpoint. Just wanted to keep everything consistent.

You wouldn't want an always on SSH connection but a SSH connection that would stay open while you send multiple requests with some logic sounds awesome. You could log into a switch, run a command, verify result, run another command or two then drop connection. This would be very handy.

1 Like

Curious how you solved this in the end.

Im looking to build an integration with an a/v device that has it's own text based protocol via ssh for control / communication - it's session and subscription based per ssh connection so disconnecting and re-connecting is not advised / possibly not possible for the type of monitoring i want to do.

It would also be providing a constant stream of metrics which i'd want to send onto my home automation system (homeseer)

Any advice on how you achieved your goal would be appreciated!