Monitorando no Zabbix as sesses BGP do RouterOS/Mikrotik (Python Script)

listen tutorial

In this tutorial we will learn how to monitor the status of the BGP session on RouterOS/Mikrotik, as well as receive notifications if the session drops or reconnects.

STOP STOP STOP…. When I wrote this tutorial there was no such tutorial here, I recommend you read it, because we discovered another simpler way.

As mikrotik does not provide this information via SNMP (so far, the hope of the poor is the last one that dies) we will have to use tricks, so our friend Gabriel Vargas Padilha made a script in python mikrotikBgpZabbixScript to fetch the information, I assembled the part of the Zabbix.

If you still don’t have Zabbix installed, follow: Installing Zabbix 5 LTS + Grafana + NGINX + PostgreSQL + Telegram

Requirements:
– RouterOS 6.48 or higher
– Zabbix Server 5.x
– Distribution: Debian 10/11

Configuration in RouterOS/Mikrotik

It will be necessary to create a user with read-only permissions as well as restricting access to only the Zabbix IP, to make the connection for data collection.

If you want to disable login information. This will make you no longer see any logins made to the router.

OBS: Do not use spaces and special characters in the names of Peer’s and have different names for each Peer.

Zabbix Serve/Linux

Required packages:

Go to the externalscripts directory and download.

Download the scripts

Give permission for files to run and change owner to zabbix user.

Script usage information:

METHOD’s
getPeer – Returns all peerings in json format.
getPeerInfo – Returns the specified value of a peer.

Usage examples:



Now access your Zabbix, and import the Template:
Download the template RR Mikrotik – BGP – Script Python.xml and matter.

Create a new host, or add agent.

Select Template RR Mikrotik – BGP – Script. You find other templates here also.

Finally, inherit the macros from the template, and click on modify to enter your data, then click on save

NOTE: The discovery is set to 6h, if you want it to be faster, run it manually, to perform this procedure do:

Grafana Model

Just an idea for you to assemble a cool dash:

I will leave it here dash Modelo

If you’d like to make a donation to the cafe, I’d be very happy for your recognition!

If you can’t donate, you can leave your thanks in the comments, I’ll also be happy to know that I helped. If you have any questions, please leave them too. If you prefer to get in touch click here.



Linux,Mikrotik,Tutoriais,bgp,grafana,monitoramenteo,peer,routeros,zabbix,

#Monitorando #Zabbix #sesses #BGP #RouterOSMikrotik #Python #Script

Leave a Comment

Your email address will not be published. Required fields are marked *