Nagios Configuration switches and routing

Source: Internet
Author: User
Tags snmp mrtg

Monitoring switches are mostly monitoring switch port Up/down, as well as port traffic.
The SNMP protocol is required to monitor the on state, make sure that the switch and route are turned on SNMP, and set the community set (community) to monitor traffic needs MRTG

1, installation MRTG

Yum install MRTG Perl libpng zlib


2. Modify the configuration of the snmpd so that it allows MRTG to read its interface (network interface) traffic data.

Vi/etc/snmp/snmpd.conf

Will #view SystemView included MIB2

The content is modified to:

View MIB2 included. Iso.org.dod.internet.mgmt.mib-2 FC

Then the

Access Notconfiggroup "" Any noauth exact systemview none None

Modified to:

Access Notconfiggroup "" Any noauth exact mib2 none None

And then restart SNMPD:

/ETC/RC.D/INIT.D/SNMPD restart


3. Execute the following command to create the configuration document
Cfgmaker-output=/var/www/mrtg/name.cfg SNPM Community Collection @ip Address

For example:

Cfgmaker-output=/var/www/mrtg/myswitch [email protected]

In the following command to create the relevant log and Web page (first you have to modify the name.cfg in the Workdir item, minus #, and no space in front). (MRTG can be used alone.)

4, then execute the following command to create the corresponding port information
Env lang=c/usr/bin/mrtg/var/www/mrtg/name.cfg (usually requires execution on both sides, sometimes three times)
After running successfully LS/VAR/WWW/MRTG see what port information is available


5. Add to Crontab

*/5 * * * * env LANG=C/USR/BIN/MRTG/VAR/WWW/MRTG/MYSWITCH.CFG


7. Add MRTG to Nagios

Vim Command.cfg

# ' Check_local_mrtgtraf ' command definition
Define Command{
Command_name Check_local_mrtgtraf
Command_line $USER 1$/check_mrtgtraf-f $ARG 1$-a $ARG 2$-W $ARG 3$-C $ARG 4$-e $ARG 5$;-F log location and name,-a bandwidth,-w warning threshold, -C Critical Warning threshold,-e time, default unit minutes
}


8. Enable Cfg_dir=/usr/local/nagios/etc/switches in Nagios.cfg


9. Create and edit the switch configuration document in Nagios

Cp-p/usr/local/nagios/etc/objects/swithe.cfg/usr/local/nagios/etc/switches/myswitch.cfg

If you don't have switches, create a

Mkdir/usr/local/nagios/etc/switches

Chown nagio:nagios/usr/local/nagios/etc/switches

chmod 755/usr/local/nagios/etc/switches


Vim/usr/local/nagios/etc/switches/myrouter.cfg

# Define The switch that we'll be monitoring

Define Host{
Use Generic-switch; Call a template in Templatles.cfg, with multiple templates separated by commas

HOST_NAME myswitch; switch name
Parents 192.168.0.1; The switch's ancestor is set, and multiple commas are separated
Alias Switch; Alias
Statusmap_image switch40.jpg; Picture of the switch in the topology diagram
Address 192.168.1.1; switch IP
hostgroups switches; Affiliation Group
}


Define Service{
Use Generic-service; multiple templates separated by commas

HOST_NAME myswitch; Multiple names separated by commas
Service_description PING; The service description
Check_command check_ping!200.0,20%!600.0,60%; Ping200 times, lost 20% alarms, ping600 times, lost 60% critical alarms
Normal_check_interval 5
Retry_check_interval 1
}


# Monitor Uptime via SNMP

Define Service{
Use Generic-service
HOST_NAME myswitch

Service_description Uptime
Check_command check_snmp!-c public-o sysuptime.0; check boot length
}


# Monitor Port 1 status via SNMP

Define Service{
Use Generic-service
HOST_NAME myswitch

Service_description Port1
Check_command check_snmp!-c public-o ifoperstatus.1005-r 1-m Rfc1213-mib

Check the open status of Port 1, 1 is on, when not 1 o'clock alarm
}


# Monitor Bandwidth via MRTG logs

Define Service{
Use Generic-service
HOST_NAME myswitch
Service_description Port1
Check_command check_local_mrtgtraf!/var/www/mrtg/192.168.1.1_1001.log! avg!20000000,20000000!17500000,17500000!10; Check traffic on Port 1th, 2 20000000 and 17500000 because bandwidth is divided into upper and lower lines
}


This article is from the "Houyang Linux articles" blog, so be sure to keep this source http://yanglulinux.blog.51cto.com/2809000/1684621

Nagios Configuration switches and routing

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.