DCI over SSH Fails on Mikrotik device only

Started by gmonk63, September 28, 2021, 07:43:25 PM

Previous topic - Next topic

gmonk63

I have some mikrotik wireless devices that I need to monitor signal strength and SNR  and because of the odd way the Mikrotik MIBS are formatted and having to know the connected clients mac in order to retrieve that info from the registration table via snmp i decided to do it over ssh but it always fails on the Mikrotik device.  I have tested the commands from the server using the native ssh client and everything works.  I have also setup a laptop and simple dci with uname -a command and that is successful it just does not like the Miktotik response for some reason.  Below are the responses any suggestions are much appreciated.

Successful Laptop Response:

] Received message CMD_GET_PARAMETER (139)
2021.09.28 09:18:51.107 *D* [comm.cs.1          ] Requesting metric "SSH.Command(x.x.x.x:22,"user","pass","uname -a","",0)"
2021.09.28 09:18:51.107 *D* [ssh                ] AcquireSession: acquired existing session [email protected]:22/1
2021.09.28 09:18:51.114 *D* [comm.cs.1          ] GetParameterValue("SSH.Command(x.x.x.x:22,"user","pass","uname -a","",0)"): 0 (SUCCESS) value = "Linux Yakco 5.11.6-arch1-1 #1 SMP PREEMPT Thu, 11 Mar 2021 13:48:23 +0000 x86_64 GNU/Linux"
2021.09.28 09:18:51.114 *D* [comm.cs.1          ] Sending message CMD_REQUEST_COMPLETED (ID 139; size 128; compressed)
2021.09.28 09:18:51.114 *D* [comm.cs.1          ] Outgoing message dump:


Unsuccessful Mikrotik Response:
* I changed the command to only return the identity to simplify things

Received message CMD_GET_PARAMETER (1736)
2021.09.28 09:27:56.486 *D* [comm.cs.1          ] Requesting metric "SSH.Command(x.x.x.x:22,"user","pass",":put [/system identity get name]","",0)"
2021.09.28 09:27:56.486 *D* [ssh                ] AcquireSession: acquired existing session [email protected]:22/2
2021.09.28 09:27:56.494 *D* [ssh                ] SSHSession::execute: read error:
2021.09.28 09:27:56.494 *D* [ssh                ] SSH output is empty
2021.09.28 09:27:56.494 *D* [comm.cs.1          ] GetParameterValue("SSH.Command(x.x.x.x:22,"user","pass",":put [/system identity get name]","",0)"): 500 (INTERNAL_ERROR) value = ""
2021.09.28 09:27:56.494 *D* [comm.cs.1          ] Sending message CMD_REQUEST_COMPLETED (ID 1736; size 32; uncompressed)
2021.09.28 09:27:56.494 *D* [comm.cs.1          ] Outgoing message dump:

Kevo

I have no experience with this particular feature, but if it were me I'd try escaping the brackets and see if that helps. I think those are special chars in some cases. This is just a hot take as I didn't check the docs or anything, but thought it was worth a try in case you haven't already thought of it.

\[   \]

gmonk63

I did try a simpler command which did not have the brackets and it did not work either.. Good Idea though

gmonk63