The value is technically correct… It’s just that It’s shown as an ASCII string. “58” is the hex value of “X”, and “0D” is the hex value for carriage return.
If you’re trying to automate, you should use the API instead of SSH.
f.e. using the PHP client from my signature:
<?php
use PEAR2\Net\RouterOS;
require_once 'PEAR2_Net_RouterOS-1.0.0b6.phar';
$client = new RouterOS\Client('192.168.88.1', 'admin', 'password');
$snmpRequest = new RouterOS\Request('/tool snmp-get address=10.9.8.7 community=public version=1 oid=1.3.6.1.2.1.2.2.1.6.1');
$snmpResponses = $client->sendSync($snmpRequest);
echo RouterOS\Script::escapeString($snmpResponses->getProperty('value'), true);
The API responses contains a !re response with “oid”, “type” and “value” properties that reflect the same things you see from terminal. The “value” property is the raw bytes, without any formatting. The RouterOS\Script::escapeString() method above converts it to a script/terminal format, with the second argument “true” encoding all bytes, to produce the formatting you’re after, i.e. “\58\10\8C\0D\8B\00”.
The port can be specified at the 4th argument (defaults to API’s default port 8728).
As for the error… oops, my bad… missed an “n” in the variable name when doing the call (it’s “snmp”, not “smp”). I’ll also fix it above for any copy&paste bypassing reader of this topic.
But what a lack of attention mine, had not realized it. I love you boy, thanks for helping. I spent about 3 days trying to solve this problem. Now I’m going to continue my project.