Python Collectd plugin for RouterOS/MikroTik using the Python librouteros and collectd-python, superseding the abandoned Plugin:RouterOS
This plugin collects the following parameters from a MikroTik router:
- cpu: percent active (from
/system resource monitor
) - memory: free (from
/system resource monitor
) - interface: if_octets, if_packets, if_errors, if_dropped (from
/interface
) - sensors: cpu temperature (from
/system health
)
- Store
routeros.py
in a known location accessible by thecollectd
daemon, e.g./opt/collectd_plugins/
- Create a user on your MikroTik router with read only access via web interface under System -> Users
- Update
collectd.conf
to configure:- Host, user, password: credentials to connect to
- Hostname: collectd host label to use for metrics
- Interface: interface to monitor (probably your WAN interface)
LoadPlugin python
<Plugin python>
ModulePath "/opt/collectd_plugins"
Import "routeros"
<Module routeros>
Host "127.0.0.1"
Hostname "mikrotik"
User "username"
Password "password"
Interface "ether10"
</Module>
</Plugin>
- Restart collectd, check log file for issues:
sudo systemctl restart collectd && sudo systemctl restart collectd
- Allow for multiple routers to be monitored
- Allow for multiple interfaces to be monitored