Nagios monitors Cisco switch traffic

Source: Internet
Author: User
Tags snmp switches cisco switch

First, switch configuration

snmp-server Community public ro

Snmp-server Enable traps

Snmp-server Host *.*.*.* version 2c public

snmp-server trap-source VLAN 1


Two, Nagios server configuration


Download check_traffic.sh script, chech_traffic.sh not nagios-plugins comes with plug-in, need to download it yourself.

chmod 777 check_traffic.sh Giving script execution permissions



1. Get the index information for the switch

[Email protected] ~]#/usr/lib64/nagios/plugins/check_traffic.sh-v 2c-c public-h 10.10.3.252-l
List Interface for host 10.10.3.252.
Interface Index 1 orresponding to Vlan1
Interface index 5137 orresponding to StackPort1
Interface index 5138 orresponding to Stacksub-st1-1
Interface index 5139 orresponding to Stacksub-st1-2
Interface index 10101 orresponding to GIGABITETHERNET1/0/1
Interface index 10102 orresponding to GIGABITETHERNET1/0/2
Interface index 10103 orresponding to GIGABITETHERNET1/0/3
Interface index 10104 orresponding to GIGABITETHERNET1/0/4
Interface index 10105 orresponding to GIGABITETHERNET1/0/5
Interface index 10106 orresponding to GIGABITETHERNET1/0/6
Interface index 10107 orresponding to GIGABITETHERNET1/0/7
Interface index 10108 orresponding to GIGABITETHERNET1/0/8
Interface index 10109 orresponding to GIGABITETHERNET1/0/9
Interface index 10110 orresponding to GIGABITETHERNET1/0/10
Interface index 10111 orresponding to GIGABITETHERNET1/0/11
Interface index 10112 orresponding to GIGABITETHERNET1/0/12
Interface index 10113 orresponding to GIGABITETHERNET1/0/13
Interface index 10114 orresponding to GIGABITETHERNET1/0/14
Interface index 10115 orresponding to GIGABITETHERNET1/0/15
Interface index 10116 orresponding to GIGABITETHERNET1/0/16
Interface index 10117 orresponding to GIGABITETHERNET1/0/17
Interface index 10118 orresponding to GIGABITETHERNET1/0/18
Interface index 10119 orresponding to GIGABITETHERNET1/0/19
Interface index 10120 orresponding to GIGABITETHERNET1/0/20
Interface index 10121 orresponding to GIGABITETHERNET1/0/21
Interface index 10122 orresponding to GIGABITETHERNET1/0/22
Interface index 10123 orresponding to GIGABITETHERNET1/0/23
Interface index 10124 orresponding to GIGABITETHERNET1/0/24
Interface index 10125 orresponding to GIGABITETHERNET1/0/25
Interface index 10126 orresponding to GIGABITETHERNET1/0/26
Interface index 10127 orresponding to GIGABITETHERNET1/0/27
Interface index 10128 orresponding to GIGABITETHERNET1/0/28
Interface index 12001 orresponding to Null0
Interface index 12002 orresponding to FastEthernet0

The commands are annotated as follows: #/usr/lib64/nagios/plugins/check_traffic.sh [-v] [-6] [-I Suffix] [-F s| S] [-P N] [-r]-v 1|2c|3-c snmp-community-h host [-l]-I interface-w in,out-warning-value-c In,out-critical-valu E-k/m-b/b


2. Get the port traffic for the switch G1/0/28

[Email protected] ~]#/usr/lib64/nagios/plugins/check_traffic.sh-v 2c-c public-h 10.10.3.252-i 10128-w 200,300-c 40 0,500-k-B
Ok-it ' s The first time for this plugins run. We ll get the data from the next time.


[Email protected] ~]#/usr/lib64/nagios/plugins/check_traffic.sh-v 2c-c public-h 10.10.3.252-i 10128-w 200,300-c 40 0,500-k-B
Ok-the traffic in are 82.00KB, out are 0.0KB, Total is 82.00KB. The Check Interval is 290s | In=82.00kb;200;400;0;0 Out=0.0kb;300;500;0;0 Total=82.00kb;500;900;0;0 Interval=290s;1200;1800;0;0


3. Configuring the Nagios configuration file

[[Email protected] ~] #vim/etc/nagios/nagios.cfg

Cfg_file=/etc/nagios/objects/switch.cfg #去掉该行前面的 # character


4. Configure Commands.cfg

[Email protected] ~]# vim/etc/nagios/objects/commands.cfg

Define Command{

Command_name check_switch_traffic

Command_line $USER 1$/check_traffic.sh-v 2c-c public-h $HOSTADDRESS $-I $ARG 1$-w $ARG 2$, $ARG 3$-C $ARG 4$, $ARG 5$-M- B
}


5. Configure Switch.cfg

Define Host{
Use Generic-switch; Inherit default values from a template
HOST_NAME h17_2960sw1_3.251; The name we ' re giving to this switch
Alias Linksys srw224p Switch; A longer name associated with the switch
Address 10.10.3.251; IP Address of the switch
Hostgroups switches; Host groups This switch are associated with
}

Define Host{
Use Generic-switch; Inherit default values from a template
HOST_NAME h18_2960sw1_3.247; The name we ' re giving to this switch
Alias Linksys srw224p Switch; A longer name associated with the switch
Address 10.10.3.247; IP Address of the switch
Hostgroups switches; Host groups This switch are associated with
}

Define Service{
Use GENERIC-SERVICE,SRV-PNP; Inherit values from a template
HOST_NAME h17_2960sw1_3.251
Service_description CHECK_TRAFFICE_G1/0/28
Check_command check_switch_traffic!10128!200!400!500!800
}


Define Service{
Use GENERIC-SERVICE,SRV-PNP; Inherit values from a template
HOST_NAME h18_2960sw1_3.247
Service_description CHECK_TRAFFICE_G1/0/28
Check_command check_switch_traffic!10128!200!400!500!800
}


6. Configure permissions (pending validation)

[Email protected] ~]# chmod 777/var/tmp/check_traffic_10.10.3.249_10128.hist_dat_root__64


7. Restart the Nagios service

[Email protected] ~]#/etc/init.d/nagios restart






















This article from "Write something?" "Blog, be sure to keep this provenance http://lipenglong.blog.51cto.com/5309038/1922176

Nagios monitors Cisco switch traffic

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.