In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to monitor BGP sessions with the help of Nagios, which has a certain reference value. Interested friends can refer to it. I hope you will gain a lot after reading this article. Let's take a look at it.
How to use the Nagios plug-in tool to monitor BGP neighbors.
Testing platform
After testing, it proved to be very compatible with the Cisco ASR 1000 Series Router.
After testing, it proved to be very compatible with the Cisco 3700 Series layer 3 switch.
It should also be compatible with other Cisco devices.
After testing, it is not compatible with the Quagga router.
Not tested on JunOS.
Topology of the test
Nagios can monitor all BGP sessions on router 1. BGP neighbors AS 50 and AS 70 are critical to normal operation, so a separate script will be used to monitor these specific neighbors and alert them in case they become unreachable.
Create a host for router 1 in Nagios
Before we get started, we will define a host for router 1, as shown below.
# vim / etc/nagios3/conf.d/bgp-host.cfg define host {use generic-host host_name router-1 alias router-1 address 100.100.100.100}
Monitor all BGP sessions on router 1
Nagios comes with a built-in tool called check_bgpstate that allows you to use SNMP to check the BGP status of the router. This tool can be run manually to check router 1 by providing the necessary parameters.
# / usr/lib/nagios/plugins/check_bgpstate-c myCommunity 100.100.100.100 OK: host '100.100.100.100 OK, sessions up: 4, down: 0, shutdown: 0
Now we will define a command in Nagios so that we can use this tool to start monitoring all BGP sessions on router 1.
# vim / etc/nagios-plugins/config/bgp.cfg define command {command_name check_all_bgp command_line / usr/lib/nagios/plugins/check_bgpstate'$HOSTADDRESS$'-C'$ARG1 $'}
Given that the command is ready, we will define a new service that will apply the command to router 1.
# vim / etc/nagios3/conf.d/bgp-service.cfg define service {host_name router-1 service_description All BGP session summary check_command checklists all round bgpacks myCommunity check_interval 1 use generic-service notification_interval 0; set > 0 if you want to be re-notified}
If we need to add additional routers, we only need to define the appropriate hosts for other routers, such as router 2, router 3, and apply the command check_all_bgp to each router, just as we applied to router 1.
Before restarting the Nagios service, verify that all the parameters are configured correctly by performing a trial run (dry run), as shown below.
# nagios3-v / etc/nagios3/nagios.cfg
If everything looks all right, we restart the Nagios service.
# service nagios3 restart
If all goes well, Nagios should check the summary of all BGP sessions, which can be confirmed at the Nagios portal (that is, http://serverIP/nagios3 > Services).
Monitor one or some BGP neighbors of router 1
The previous check_bgpstate tool only provides alerts for BGP session profiles (that is, three above and one below). If any problematic BGP session is detected, the user needs to manually log in to the router to check which BGP session has failed.
As for key BGP neighbors (such as AS 50 and AS 70 mentioned in the topology diagram), you may want to monitor individual BGP neighbors. If you want Nagios to be able to monitor and alert certain BGP neighbors, such as AS 50 and AS 70, use a separate script called check_bgp.
Prepare the check_bgp script
The check_bgp script (version 0.4) can be downloaded from the official website (http://exchange.nagios.org/directory/Plugins/Network-Protocols/BGP-2D4/check_bgp/details). After downloading the script, it is copied to the Nagios plug-in directory and renamed. In addition, set the necessary permissions for the script.
# cp check_bgp.0.4.pl / usr/lib/nagios/plugins/check_bgp.pl # chmod + x / usr/lib/nagios/plugins/check_bgp.pl
Given that the script is ready, let's do a trial run to check the output of the script.
# cd / usr/lib/nagios/plugins/ #. / check_bgp.pl-H 100.100.100.100-C myCommunity-p 50.50.50.50 OK-50.50.50.50 (AS50) state is established (6). Established for Duration.
Given that the script is ready for use, let's next configure Nagios.
Prepare Nagios
First we define a command in Nagios that checks a BGP peer.
# vim / etc/nagios-plugins/config/ define command {command_name check_bgp command_line / usr/lib/nagios/plugins/check_bgp.pl-H'$HOSTADDRESS$'-C'$ARG1 $'- p'$ARG2 $'}
Now that the command has been defined, we will define two new services that will apply the command to AS 50 and AS 70, respectively.
# vim / etc/nagios3/conf.d/bgp-service.cfg define service {host_name router-1 service_description BGP check with AS 50 check_command check_bgp!myCommunity!50.50.50.50 check_interval 1 use generic-service notification_interval 0 Set > 0 if you want to be re-notified} define service {host_name router-1 service_description BGP check with AS 70 check_command checkout bgpins myCommunities 70.70.70 check_interval 1 use generic-service notification_interval 0; set > 0 if you want to be re-notified}
Before we restart the Nagios service, perform a trial run to verify that all the parameters are configured correctly, as shown below.
# nagios3-v / etc/nagios3/nagios.cfg
If everything looks all right, we restart the Nagios service.
# service nagios3 restart
Nagios should start monitoring the two BGP neighbors in router 1: AS 50 and AS 70. The status of the two BGP peers can be checked in the Nagios portal (http://serverIP/nagios3 > Services). If something suspicious occurs in any of the BGP sessions, Nagios issues an alert.
If all goes well, the following screenshot should appear on the Nagios portal.
Thank you for reading this article carefully. I hope the article "how to monitor BGP sessions with Nagios" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.