I’ve released a script to update (or send other commands) to a Mikrotik list via SSH.
The script builds on work already done by Phillip Hutchison and Kevin Byrd.
Released v2.0
Now use Parallel::ForkManager to speed up operations
Version 3.0.1 - Python rewrite
- Output grouped by host: Results are grouped by host, both on-screen and in the log file.
- Colored output (optional): The on-screen output can be colored for better readability, highlighting hosts, commands, output, and errors. Colors can be turned on or off with the --no-colors command-line option.
- Log file: The commands and their corresponding output are saved in a log file.
- Threading: Uses threads for faster execution.
- Improved error handling: The script now handles and reports errors in more detail.
Version 4
Migrated from SSH to API
first i like the mass updater . but i don’t get the glue about custom commands
a simple command works, but i don’t get a command like
/user add name=xxxxxx password=yyyyyyy group=read
working
what is the form i have to enter that in the array ?
i miss an example in the documentation
Thanks for the feedback.
v4.4 is out with improved custom commands
The custom_commands array in the script supports two types of commands:
- Simple commands - Just the command string:
'/interface/print'
- Commands with parameters - A tuple containing the command and a dictionary of parameters:
('/user/add', {
'name': 'newuser',
'password': 'userpass',
'group': 'read'
})
Example of custom_commands array:
custom_commands = [
# Simple command
'/system/clock/print',
# Command with parameters
('/user/add', {
'name': 'monitor',
'password': 'secret123',
'group': 'read'
}),
# Another simple command
'/user/print'
]
Note: Parameters must match the exact names expected by the MikroTik API for that command.
Thanks for this great script!
If I had known it existed, I wouldn’t have had to do it myself.
However, in case someone needs it without Python dependency and API using only bash an SSH: