Prometheus client for Mikrotik devices. Can be configured to collect metrics from a single device or multiple devices.
To access the api, use RouterOS-api.
To create metrics, use Prometheus Python Client.
pip install routeros-prometheus-client
Create a user on the device that has API and read-only access.
/user group add name=prometheus policy=api,read,winbox
Create the user to access the API via.
/user add name=prometheus group=prometheus password=changeme
[my_router]
host = 192.168.1.1
username = login
password = password
plaintext_login = True
interface = True
wireless = False
caps_man = True
l2tp = True
gre = True
[my_second_router]
host = 192.168.1.2
username = login
password = password
plaintext_login = True
interface = True
wireless = True
caps_man = False
l2tp = False
gre = False
[section]
- String - Used for identification devicehost
- String - Hostname or IP of deviceusername
- String - Login username - Default 'admin'password
- String - Login password - Default empty stringport
- Integer - TCP Port for API - Default 8728 or 8729 when using SSLplaintext_login
- Boolean - Try plaintext login (for RouterOS 6.43 onwards) - Default Falseuse_ssl
- Boolean - Use SSL or not? - Default Falsessl_verify
- Boolean - Verify the SSL certificate? - Default Truessl_verify_hostname
- Boolean - Verify the SSL certificate hostname matches? - Default Truessl_context
- Object - Pass in a custom SSL context object. Overrides other options. - Default Noneinterface
wireless
caps_man
l2tp
gre
- What metrics to collect
routeros-prometheus-client -c routeros-prometheus-client\config.ini -p 8000
-c
--config
path toconfig.ini
-p
--port
HTTPServer port