Monitoring Huawei Switch S5700 With Nagios Core Web Application

1. Overview

 

Nagios performance monitoring application can be used as an network monitoring tools to monitor various network device types such as switches, routers, firewalls as well as application performance monitoring on Linux and Windows servers for host up/down status, CPU usage, memory usage, switch or router interface up/down status , and more. It will send an alert when things go bad and when they get better.

In this instruction will show you how to monitor Huawei S5700 switch with Nagios application performance monitoring using some Nagios plugins that work base on SNMP protocol.

2. Prerequisites

 

In this article of monitoring Huawei switch S5700 with Nagios performance monitoring application, it is supposed that:

a. You have already done the initial server setup. Please refer to this link Minimal RHEL/CentOS 7 Initial Server Setup.
b. You have already installed Nagios performance monitoring application server. Please refer to this link. Installing Nagios Core For IT Infrastructure Monitoring on RHEL/CentOS 7

3. Configure SNMP on Device

 

First of all, we need to login to Huawei S5700 switch that we want to monitor it with Nagios performance monitoring application and configure SNMP server as the following. We will configure a read-only SNMP community string as “T@s9aMon” along with an ACL name “ACL-SNMP” to allow only a Nagios monitoring server with IP address of 10.0.0.10 to be accessible to this device.

] acl number 2017
     rule 10 permit source 10.0.0.10 0

] snmp-agent sys-info version v2c 
] snmp-agent community read T@s9aMon acl 2017
] snmp-agent trap enable
] snmp-agent sys-info location DC
] snmp-agent sys-info contact netadmin@techspacekh.com

To test if the SNMP server on Huawei S5700 switch is configured properly and working, we need to login to Nagios server and execute the following snmpwalk command. In the following command it is assumed that the IP address of Huawei S5700 switch is 10.0.0.12.

 

# snmpwalk -v2c -c T@s9aMon 10.0.0.12

4. Download And Test Nagios Plugin

 

To monitor a Huawei S5700 switch with Nagios performance monitoring application, we need two Nagios performance monitoring application plugins. The first one is “check_hw_s5700-xx.sh” and the second one is “check_snmp_int.pl”. You can download it from GitHub repository  and SNMP Interface Check web site or you can download it directly here,check_hw_s5700-xx and check_snmp_int. After download, you have to copy these two plugin into plugin directory on Nagios performance monitoring application server which is on “/usr/local/nagios/libexec”.

We will use a plugin name “check_hw_s5700-xx.sh” to monitor fan status, CPU usage, memory usage of a Huawei S5700 switch. To monitor interface up/down status of Huawei S5700 switch, we will use a plugin name “check_snmp_int.pl”.

Now let go to directory to “/usr/local/nagios/libexec” to test these two plugin, but first we need to install the prerequisite packet to be able to execute this plugin and make it executable.

# cd /usr/local/nagios/libexec
# yum -y install perl-Net-SNMP
# chmod +x check_snmp_int.pl
# chmod +x check_hw_s5700-xx.sh

Now let use plugin name “check_hw_s5700-xx.sh” to monitoring fan status of a Huawei S5700 switch.

 

# ./check_hw_s5700-xx.sh 10.100.1.15 A@B9aMon fan1
FAN1: Normal

Now let use plugin name “check_hw_s5700-xx.sh” to monitoring CPU usage of a Huawei S5700 switch.

# ./check_hw_s5700-xx.sh 10.100.1.15 A@B9aMon cpuusage
CPU Usage: 14%

Now let use plugin name “check_cisco_switch.pl” to monitoring memory usage of a Huawei S5700 switch.

]# ./check_hw_s5700-xx.sh 10.100.1.15 A@B9aMon memusage
MEM Usage: 51%

We  use the following Nagios performance monitoring application plugin to check interface status of a Huawei S5700 switch.

]# ./check_snmp_int.pl -H 10.100.1.15 -C A@B9aMon -2 -n GigabitEthernet0/0/1 -r
GigabitEthernet0/0/1:UP:1 UP: OK

5. Define Host And Service Groups

 

It is better to create directories to store our own configuration files as the following.

# cd /usr/local/nagios
# mkdir techspacekh
# cd techspacekh/
# mkdir commands
# mkdir remotehosts
# mkdir servicegroups
# mkdir hostgroups

Then, we need to tell Nagios performance monitoring application configuration file to also read the configuration files from the new directories we created and the restart service of Nagios performance monitoring application.

# vim /usr/local/nagios/nagios.cfg
cfg_dir=/usr/local/nagios/etc/techspacekh
# systemctl restart nagios

Right now let create a host group name “cisco-switches” for all Cisco switch by going into directory “/usr/local/nagios/techspacekh/hostgroups” and create a file with cfg extension as the following.

# cd /usr/local/nagios/techspacekh/hostgroups
 # vim huawei-switches.cfg

define hostgroup{
 hostgroup_name huawei-switches
 alias Huawei Switches
 }

Then, let create some service groups for Cisco switch such as,memory-usage, cpu-usage, device-fan, and cisco-interfacestatus by going into directory “/usr/local/nagios/techspacekh/hostgroups” and create a file with cfg extension as the following.

# cd /usr/local/nagios/techspacekh/servicegroups
# vim cisco-services.cfg

define servicegroup{
 servicegroup_name memory-usage
 alias Memory Usage
 }

define servicegroup{
 servicegroup_name cpu-usage
 alias CPU Usage
 }

define servicegroup{
 servicegroup_name device-fan
 alias Device Fan
 }

define servicegroup{
 servicegroup_name device-powersupply
 alias Device Power Suply
 }

define servicegroup{
 servicegroup_name cisco-interfacestatus
 alias Cisco Interface Status
 }

6. Define Nagios Commands

 

To use two Nagios performance monitoring application plugins above, we need to define commands and call the plugin to use. Let define the following command to monitor power supply status, fan status, CPU usage, memory usage of a Huawei S5700 switch

# cd /usr/local/nagios/techspacekh/commands
# vim check_huawei_switch.cfg

define command{
 command_name check_snmp_int
 command_line $USER1$/check_snmp_int.pl -H $HOSTADDRESS$ -C $ARG1$ -2 -n $ARG2$ -r
 }

define command{
 command_name check_huawei
 command_line $USER1$/check_hw_s5700-xx.sh $HOSTADDRESS$ $ARG1$ $ARG2$
}
#

7. Define Hosts And Services

 

After defining host group, service groups, and Nagios performance monitoring application commands, right now we can define one host of Cisco switch to test. In this test switch we will monitor host down/up status, and some services such ping, CPU usage, memory usage, and the interface up/down status of two interfaces, F0/1 and F0/2.

# cd /usr/local/nagios/techspacekh/remotehosts
# vim huawei-switch.cfg

define host{
 use generic-switch
 host_name Huawei-Switch
 alias Huawei-Switch
 notes Access Switch
 address 10.0.0.12
 hostgroups huawei-switches
 }
#
define service{
 use generic-service
 host_name Huawei-Switch
 service_description PING
 check_command check_ping!200.0,20%!600.0,60%
 check_interval 5
 retry_interval 1
 }

define service{
 use generic-service
 host_name Huawei-Switch
 service_description Memory Usage
 check_command check_huawei!A@B9aMon!memusage
 servicegroups memory-usage
 }
##
define service{
 use generic-service
 host_name Huawei-Switch
 service_description CPU Usage
 check_command check_huawei!A@B9aMon!cpuusage
 servicegroups cpu-usage
 }

define service{
 use generic-service
 host_name Huawei-Switch
 service_description Device Fan1
 check_command check_huawei!A@B9aMon!fan1
 servicegroups device-fan
 }

define service{
 use generic-service
 host_name Huawei-Switch
 service_description Port GE0/0/1
 check_command check_snmp_int!A@B9aMon!GigabitEthernet0/0/1
 servicegroups cisco-interfacestatus
 }
#
define service{
 use generic-service
 host_name Huawei-Switch
 service_description Port GE0/0/2
 check_command check_snmp_int!A@B9aMon!GigabitEthernet0/0/2
 servicegroups cisco-interfacestatus
 }

After that, we need to restart the service of Nagios performance monitoring application with the following command.

# systemctl restart nagios

Go to the web interface of Nagios performance monitoring application and we should see one host name “Huawei-Switch” and some services as the following.

To see the host groups, from Nagios performance monitoring application web interface navigate to “Host Groups” tap and the following is the list of host groups.

 

 

To see the service groups, from Nagios performance monitoring application web interface navigate to “Service Groups” tap and the following is the list of service groups.

8. Conclusion

 

That’s all about how to monitoring Huawei S5700 switch with Nagios performance monitoring application from Tech Space KH. Nagios performance monitoring application is one of the best network monitoring tools and server monitoring tools. Hopefully, you can find this guide informative. If you have any questions or suggestions you can always leave your comments below. I will try all of my best to review and reply them.

Comments

comments