MrCirca / zabbix-routeros-bgp

Monitoring Mikrotik BGP peer name state & uptime
MIT License
13 stars 12 forks source link
bgp bgp-monitoring-protocol mikrotik mikrotik-api monitoring zabbix zabbix-templates

Monitoring Mikrotik BGP peer state and uptime on Zabbix

Logo of ZABBIX Logo of Mikrotik
Using external script method on Zabbix, i made two scripts, getting values through Mikrotik API.
Mikrotik API(Python 3) is interactive. So I modified it to print the values I demand and then it disconnects automatically.

Files you need to copy to externalscripts path of zabbix server:

1) bgp_peer_field.sh Calls the API and prints state or uptime of peer name. 2) bgp_peer_names.sh Calls the API and prints peer names. 3) apriros.py Is the Mikrotik API that is not interactive and can get the output you want.

Make sure that the files above are executable by zabbix user.

You should also import zbx_routeros_bgp.xml zabbix template on zabbix server.

Simple script test:

 bgp_peer_filed.sh <RouterOS_USERNAME> <RouterOS_PASSWORD> <bgp_peer_name> <state/uptime>

Zabbix Discovery Key:

bgp_peer_names.sh["{HOST.CONN}","{$ROUTEROS_USERNAME}","{$ROUTEROS_PASSWORD}"]

*You should define these macros: "{$ROUTEROS_USERNAME}" and "{$ROUTEROS_PASSWORD}"

The reason I created the bgp_peer_names.sh is so that zabbix can discover the peer names and create items for each peer name. Zabbix BGP Monitoring on Mikrotik