Learn more about Fleet Commander here!
Fleet Commander works by sending a single command at a time to a device. This means that special precautions must be taken for running multiple commands at once. Fleet Commander is a powerful tool, and Admiral is not responsible for any damages caused by executing set, disable or remove commands. Always test your jobs on a single test router before running them on multiple routers.
Separating Commands #
- All commands must be separated with a semicolon (;)
- A final trailing semicolon is optional
- Line breaks are optional, but do NOT separate commands. Only Semicolons separate commands, line breaks are only visual.
- Depending on rOS version, you may need to lead every command with a forward slash (/)
- Correct:
- /ip address print;/ip arp print;/ip route print;
- /ip address print;
/ip arp print;
/ip route print
- /ip address print;/ip arp print;/ip route print;
- Incorrect:
- /ip address print /ip arp print /ip route print
- /ip address print
/ip arp print
/ip route print- These will not run because they are missing semicolons. Due to how commands are sent to the MikroTik, these commands cannot be correctly parsed and will be incorrectly read as 1 long command.
- /ip address print /ip arp print /ip route print
- Correct:
Script Path/Change Directory #
- Since each command is sent individually, directory changes are not persistent between commands.
- This means the full command path MUST be included with every line for it to work correctly.
- Correct:
- /system logging add action=EX123 prefix=Critical topics=critical;/system logging add action=EX123 prefix=Info topics=info,!firewall;/system logging add action=EX123 prefix=Warning topics=warning;/system logging add action=EX123 prefix=Error topics=error;
- /system logging add action=EX123 prefix=Critical topics=critical;
/system logging add action=EX123 prefix=Info topics=info,!firewall;
/system logging add action=EX123 prefix=Warning topics=warning;
/system logging add action=EX123 prefix=Error topics=error;
- /system logging add action=EX123 prefix=Critical topics=critical;/system logging add action=EX123 prefix=Info topics=info,!firewall;/system logging add action=EX123 prefix=Warning topics=warning;/system logging add action=EX123 prefix=Error topics=error;
- Incorrect:
- /system logging
add action=EX123 prefix=Critical topics=critical
add action=EX123 prefix=Info topics=info,!firewall
add action=EX123 prefix=Warning topics=warning
add action=EX123 prefix=Error topics=error- This command will fail for multiple reasons. First, there are no semicolons so the command will be parsed as one long command. Line breaks do NOT separate commands. Second, each command is sent individually, so “/system logging” will only be present with the first command. The MikroTik will not know what to do with the remaining commands
- /system logging
- Correct:
Additional Considerations #
- Logs will only be written to your Admiral if the script returns data.
- This means a set command likely will not return data, while an export or print command will.
- Access Logs in Router List > Fleet Commander > View Logs
- Fleet Commander jobs are executed from top to bottom.
- If a command fails, the fleet commander job will be interrupted. Any completed portions will be written to logs but the rest of the job will not be attempted.
- If you are running into issues with a larger job, print commands can be used to troubleshoot and see how far the command made it before failing.
Escaping Characters #
- Our system looks for semi colons “;” to separate commands, since they must be run once at a time. If you need to use them in your command, you need to escape them with curly brackets { }
- This command will work as expected, notice the semi colon within the curly brackets:
- /system script add name=”Email_Log” source={/log print file=elog.txt; /ip ipsec policy print detail file=ipsec.txt; /tool e-mail send to=”support@admiralplatform.com” subject=([/system identity get name] . ” Log ” . [/system clock get date]) file=elog.txt,ipsec.txt; /system logging action set memory memory-lines=1; /system logging action set memory memory-lines=65000;}
- This command will work as expected, notice the semi colon within the curly brackets:
- Back slashed are also used to escape characters. If you need an actual backslash, you may need to enter a double backslash “\\”
- Curly brackets and back slashes can be used in combination to get a script to work as expected.
If you are having trouble, please contact Admiral support!
New to admiral? Learn how to get started here!