Mrtg monitors vro traffic and Nagios alarms

Source: Internet
Author: User

Mrtg monitors vro traffic and Nagios alarms

1. Enable the snmp protocol for the vswitch
2. Install mrtg
Yum-y install mrtg
3. Configure mrtg
(1) create a configuration file. If multiple switches exist, you can create a configuration file for each switch.
Mkdir-p/usr/local/mrtg
Export maker-output =/usr/local/mrtg/switch. cfg public @ switch IP

The switchw. cfg configuration file is generated to record the model of the monitored switch, all the ports, VLANs, and the current rate.
You need to like this. We don't need to configure it one by one.
(2) create a web directory of the traffic graph during access
Mkdir-p/usr/local/mrtg/share
(3) modify the configuration file generated in step 1 and direct the working directory to the configured web directory.
Vim/usr/local/mrtg/switch. cfg
# For UNIX
WorkDir:/usr/local/mrtg/share
(4) generate a traffic chart in the working directory
Env LANG = C/usr/bin/mrtg/usr/local/mrtg/switch. cfg
After the command is executed, an alarm is triggered. We need to execute the command multiple times until there is no alarm information. Generally, the command is executed three times.
[Root @ srv10100173 share] # ls
10.10.15.20.1794-day.png 10.10.15.1 _ 1795.log 10.10.15.1 _ 1796.old 10.15.20.257-year.png 10.10.15.20.513.html 10.15.20.514-month.png 10.10.15.20.515-week.png index.html
10.10.15.20.1794.html 10.10.15.20.1795-month.png 10.10.15.20.1796-week.png 10.10.15.255.258-day.png 10.10.15.1 _ 513.log 10.15.1 _ 514.old 10.15.20.515-year.png mrtg-l.png
10.10.15.1 _ 1794.log 10.10.15.1 _ 1795.old 10.15.20.1796-year.png 10.10.15.255.258.html 10.10.15.20.513-month.png 10.10.15.20.514-week.png 10.10.1-15.day.png mrtg-m.png
10.10.15.20.1794-month.png 10.10.15.20.1795-week.png 10.10.15.255.257-day.png 10.10.15.1 _ 258.log 10.10.15.1 _ 513.old 10.15.20.514-year.png 10.10.15.1.html mrtg-r.png
10.10.15.1 _ 1794.old 10.10.15.20.1795-year.png 10.10.15.255.257.html 10.15.255.258-month.png 10.10.15.20.513-week.png 10.10.15.20.515-day.png 10.10.10.1.15.log
10.10.15.20.1794-week.png 10.10.15.20.1796-day.png 10.10.15.1 _ 257.log 10.15.1 _ 258.old 10.10.15.20.513-year.png 10.10.15.20.515.html 10.15.1-month.png
10.10.15.20.1794-year.png 10.10.15.20.1796.html 10.15.255.257-month.png 10.10.15.255.258-week.png 10.10.15.20.514-day.png 10.10.15.1 _ 515.log 10.10.1.15.old
10.10.15.20.1795-day.png 10.10.15.1 _ 1796.log 10.10.15.1 _ 257.old 10.15.20.258-year.png 10.10.15.20.514.html 10.15.20.515-month.png 10.10.15.1-week.png
10.10.15.20.1795.html 10.10.15.20.1796-month.png 10.10.15.255.257-week.png 10.10.15.20.513-day.png 10.10.15.1 _ 514.log 10.15.1 _ 515.old 10.15.1-year.png
(5) because we need real-time monitoring, we need to set up scheduled tasks to meet our needs. Here we set updates every 5 minutes.
Vim/etc/crontab
*/5 */usr/bin/env LANG = C/usr/bin/mrtg/usr/local/mrtg/switch. cfg>/dev/null 2> & 1
(6) indexindex.html
Indexmaker-output =/usr/local/mrtg/share/index.html-title = "MainSwitch Traffic Monitoring"/usr/local/mrtg/switch. cfg


4. Configure apache to enable web Access
After yum is installed, the configuration file/etc/httpd/conf. d/mrtg. conf is generated on apache. The configuration is as follows:
[Root @ srv10100173 mrtg] # cat/etc/httpd/conf. d/mrtg. conf
#
# This configuration file maps the mrtg output (generated daily)
# Into the URL space. By default these results are only accessible
# From the local host.
#
Alias/mrtg/usr/local/mrtg/share


<Location/mrtg>
Order deny, allow
# Deny from all
Allow from all
Allow from 127.0.0.1
Allow from: 1
# Allow from .example.com
</Location>
We can access the service through http: // ip/mrtg. The effect is as follows:


Through the above, we can view the traffic information of the switch in real time. However, to achieve traffic monitoring and alarm, we need nagios to read the traffic information monitored by mrtg.
In the new nagios version, there are two plug-ins: check_mrtg and check_mrtgtraf, and the relevant parameters have been configured. We can call them directly.
1. First, we need to define vswitches and monitoring services.
You can directly modify the/usr/local/nagios/etc/switch. cfg file.
Vim/usr/local/nagios/etc/switch. cfg
Define host {
Use generic-switch; Inherit default values from a template
Host_name huawei-ER-3100; The name we're re giving to this switch
Alias huawei-ER-3100; A longer name associated with the switch
Address 10.10.15.1; IP address of the switch
Hostgroups switches; Host groups this switch is associated
}
Define service {
Use generic-service; Inherit values from a template
Host_name huawei-ER-3100
Service_description Interface 1794 Bandwidth Usage
Check_command check_local_mrtgtraf! /Usr/local/mrtg/share/10.10.15.1 _ 1794.log! AVG! 000000,000000! RMB, RMB! 10
}
10.10.15.1 _ 1794. log 1794 indicates the port 1794 of the vswitch. We can configure it based on the valid information of mrtg monitoring.
The "AVG" parameter indicates the average bandwidth statistics. The "000000,000000" parameter indicates the inbound alarm threshold (in bytes ), "bytes," is the output traffic emergency threshold (in bytes ), "10" indicates that if the MRTG log does not return data for more than 10 minutes, an emergency is returned (it should be updated every 5 minutes)


2. Check the nagios configuration file and restart it.
/Usr/local/nagios/bin/nagios-v/usr/local/nagios/etc/nagios. cfg
Service nagios restart

Linux Mrtg System Monitoring

Configure Mrtg in Ubuntu to monitor Nginx and server system resources

Use snmp + Mrtg to monitor Linux systems

Mrtg server construction (Network Traffic Monitoring)

Network Monitor Nagios Overview

Nagios construction and Configuration

Build a Nagios monitoring platform in the Nginx Environment

Configure the basic Nagios System on RHEL5.3 (using Nagios-3.1.2)

CentOS 5.5 + Nginx + Nagios monitoring and control terminal installation and Configuration Guide

Install Nagios Core for Ubuntu 13.10 Server

Nagios details: click here
Nagios: click here

This article permanently updates the link address:

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.