Difference between revisions of "API-SSH-Management"
Line 120: | Line 120: | ||
mbgetid | mbgetid | ||
+ | |||
+ | <br> | ||
+ | <div id="shbox" style=" border-width:1px; border-color:lightgrey; padding: 2px 5px 2px 10px; min-height:56px; border-style:solid; font-size: 0.9em;"> | ||
+ | [[File:Icon-warn.png|left|56px|56px]] | ||
+ | <p style="margin-top:10px; margin-left: 56px;"><b style="color:green;">Notice:</b> <b>mbcount</b> - proproetary function mupsbox, gets counts data replies (!re),mbcount= (=x, >x , <x, ==x, =>x, =<x). <b>mbgetid</b> - allows you to combine several commands: perform an action with a preliminary request to get id, execute a print query c .proplist = .id, storing the result in the array and then performing the desired action. <b>mb?</b>filed - allows you to build queries where there is no where attribute, mb?(field)(=/!=/<>)</p></div> | ||
+ | <br /> | ||
Revision as of 03:56, 23 June 2021
Management Device
Introduction
Device management via api and (or) ssh.
Management can be globally divided into two parts: group configuration your devices and request-response for reporting your settings.
To send the command:
you can select the devices to which you want to send the command:
or use your groups:
Command type:
There are several ways to interact with devices (this depends on the specific manufacturer and version of the operating system)
Terminal command - send command via SSH
Rsc file - send configuration file
API command - send command via API
if there is no choice, this means that work on SSH
Cisco - IOS
comming soon
MikroTik ROS v6
SEND CONFIGURATION COMMAND: via SSH
Enter the usual CLI command RouterOS, like as:
interface bridge add name=bridge1
as well as
in br ad na=bridge1
send multiple commands at once
int br ad na=bridge1#13int bri ad na=bridge2
use a separator #13 between commands
SEND CONFIGURATION COMMAND: via API
API closely follows syntax from command line interface (CLI). It can be used to create translated or custom configuration tools to aid ease of use running and managing routers with RouterOS.
sample a full syntax for API commandsCLI:
interface bridge add name=bridge1
API:
/interface/bridge/add
=name=bridge1
CLI:
ip firewall nat add chain=srcnat out-interface=ether1 action=masquerade
API:
/ip/firewall/nat/add
=chain=srcnat
=out-interface=ether1
=action=masquerade
API one line with separator:
/ip/firewall/nat/add;=chain=srcnat;=out-interface=ether1;=action=masquerade
the default separator is ; , but it can be changed in MUPSBOX - Settings ->
Example:
add new user
/user/add
=name=username
=group=full
=password=userpassword
=comment=this is new user
remove user
/user/remove
=.id=username
disable all rules in /ip/firewall/filter where chain=input and action=drop
/ip/firewall/filter/disable
?chain=input
?action=drop
?#&
mbgetid
Notice: mbcount - proproetary function mupsbox, gets counts data replies (!re),mbcount= (=x, >x , <x, ==x, =>x, =<x). mbgetid - allows you to combine several commands: perform an action with a preliminary request to get id, execute a print query c .proplist = .id, storing the result in the array and then performing the desired action. mb?filed - allows you to build queries where there is no where attribute, mb?(field)(=/!=/<>)
REQUEST-RESPONSE (reporting): via API
API closely follows syntax from command line interface (CLI). It can be used to create translated or custom configuration tools to aid ease of use running and managing routers with RouterOS.
Huawei
comming soon