Community discussions

 
fernaandogarcia
just joined
Topic Author
Posts: 6
Joined: Tue May 26, 2015 3:09 pm

API - Change SNMP Community

Mon Apr 29, 2019 3:07 pm

I'm trying to change Community SNMP settings via API (PHP). I do not receive any error, as if the command was executed successfully however in RouterOS nothing happens.

Code:

//get current SNMP data
$API->write('/snmp/getall');
$snmp = $API->read();

//get current Community data used
$API->write('/snmp/community/getall',false);
$API->write('?name='.$snmp[0]['trap-community']);
$community = $API->read();

//String example of addresses to update
$addresses = '192.168.0.1/24,10.10.10.10/32';

$API->write('/snmp/community/set',false);
$API->write('addresses='.$addresses ,false);
$API->write('.id='.$community['.id']);
$UPDATE = $API->read();


at end $UPDATE = array(0) { }

not just addresses, but any Community configuration happens the same.

Who is online

Users browsing this forum: No registered users and 22 guests