Page 1 of 1

How to use the SNMP with API Mikrotik

Posted: Wed Dec 06, 2017 6:42 pm
by GuttoSP
This code below works, but the other one does not.
$API->write('/ip/dhcp-server/lease/print', false);
$API->write('~active-address~"1.1."');
$ARRAY = $API->read();
$API->disconnect();

What is the basic syntax for SNMP commands via API? I use the command below, but something is certainly missing.
$API = new RouterosAPI();
$API->write( "/ip/snmp/print" ); // or $API->write( "/tool snmp" );	
$API->write('=address=177.xx.xxx.xx', false);
$ARRAY = $API->read();
var_dump( $ARRAY );
Using the API, which command to display the SSID, or the MAC of a device?