Monitoring RouterOS v6 (Mikrotik) BGP sessions in Zabbix via SNMP

listen tutorial

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

As mikrotik does not make this information available via SNMP from BGP sessions, we will use tricks. So together with my friend saul coast which identified that there is an OID of the scripts that are on RouterOS ( and other (***) that it is possible to execute it as well as to have returns, and oh my friend the minds flew away!

Follow the reasoning:

1st Create a script in your RouterOS

I will name the script from bgp_snmp

The idea is to take the information in the scrip and just print it out. Try running the script now!

You will have a JSON output with the information that we will collect there in Zabbix.

2º Configure o SNMP

It will be necessary to enable write-accessso make sure you have a nonstandard community (ex public {I command you to kill!}) as well as restricting access only to your servers’ IP or Prefixes.
Here’s an example:

3rd Test of your Zabbix server

In the example my router has the IP and my community is sUpErS3cret0. If you don’t have MIBS and the snmpwalk command doesn’t “work” read here.

You will get a result with all your scripts:

What is important for us is this little number here: 14988. properly the end of it, in this example the nº 7, this is the script identifier. Write it down, we will need it there in our template.
Now let’s run the script and do a get to see if we have the return with the OID Where X is the script identifier number (in this ex 7).

You will get an output with all your router’s peers:

4º Importing the template to Zabbix

Download the template RR Mikrotik – BGP – SNMP Script.xml and import the same.

5º Create/Edit a host using the template

Enter the Name, group as well as IP with SNMP agent.

select the template RR Mikrotik – BGP – SNMP Script

Remember the identifier, we need to inform it here.

Access the recent data to check if the items were created (remembering that it runs every 5min) then have the patience to wait 10min or run it manually.

Much simpler than the method of the other tutorial with python script.

I hope that you enjoyed! And once again I leave my thanks to my partner Saulo. If you do something cool, be sure to share! With this you can even create other templates, to collect other information. That’s the cool thing about sharing!

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,routeros,routeros v6,snmp,

#Monitoring #RouterOS #Mikrotik #BGP #sessions #Zabbix #SNMP

Leave a Comment

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