Mrtg is an early monitoring software for Internet applications. For example, it was very popular in and years. Its principle is relatively simple: through snmp communication with the managed device, the data is retrieved, and then an image is generated, which is displayed directly without writing the data into the database, which is very simple, mrtg is the preferred monitoring software if you simply want to monitor the interface traffic of hosts, routers, switches, and other devices.
650) this. width = 650; "style =" border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px "title =" clip_image002 "border =" 0 "alt =" clip_image002 "height =" 251 "src =" http://www.bkjia.com/uploads/allimg/131227/02542M238-0.jpg "/>
The following describes how to build and use mrtg.
I. Prerequisites:
The system must have installed the following software, which are included in the CD:
Gd; libpng; perl; gpeg; apache; snmp (you can also install the source code package ).
2. Install mrtg. You can use the source code package or rpm package. Here I chose to use the rpm package. In Versions later than rhel4, mrtg has been integrated, you can directly use the rpm package of the CD to install it.
3. Use mrtg to monitor the interface traffic of routers, switches, and servers.
1. producer maker -- global "WorkDir:/var/www/html" -- global "Options []: growright, bits" -- show-op-down -- ifref = name -- output mrtg. cfg password1 @ vro ip password2 @ vswitch ip password3 @ Server ip
Explanations:
The mongomaker command is used to generate the mrtg configuration file.
-- Global is two global configuration parameters to specify the mrtg working directory and the traffic growth unit.
-- Show-op-down: displays all interface traffic. By default, only interfaces with traffic are displayed.
-- Ifref = name indicates that the title above the generated traffic image is the interface name.
-- Output = mrtg. cfg indicates the name of the mrtg configuration file.
Password1 @ vro ip address. Note that @ is the group name of snmp used for identity authentication, which is equivalent to a password. The group name must be set on the managed device, please note this.
2. env LANG = C/usr/bin/mrtg. cfg
This command should clarify what it means: Set the environment variable LANG to C chinese), and use the mrtg command to process the generated mrtg configuration file. Note that this command must be executed three times.
3. indexmaker -- output =/var/ww/html/index.html -- title = webpage title/var/www/html/mrtg. cfg
Indexmaker is used to generate webpage files. You need to specify the mrtg configuration file later.
4. Start apache and set up the mrtg ip address through http: // to access the monitoring content.
5. Write a scheduled task and execute it every five minutes for real-time monitoring.
Crontab-e
*/5 * env LANG = C/usr/bin/mrtg/var/www/html/mrtg. cfg
Note: A. If you are monitoring A network device, you must enable snmp on the device in advance. Otherwise, it cannot be monitored.
For example, the command for enabling snmp on a Huawei or h3c device is: snmp-agent community read community name.
The command for Cisco devices to Enable snmp is: snmp community name ro/rw
B. If you are monitoring a windows client, install "Simple Network Management Protocol" in the Add/delete program for windows), and then find snmp in the service:
650) this. width = 650; "style =" border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px "title =" image "border =" 0 "alt =" image "height =" 357 "src =" http://www.bkjia.com/uploads/allimg/131227/02542I320-1.png "/>
Add a group name to it.
C. If you are monitoring a linux client, install the snmp software and edit its configuration file/etc/snmp/snmpd. conf.
Change the last public address in line 41 to a secure community name.
650) this. width = 650; "style =" border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px "title =" clip_image002 [5] "border =" 0 "alt =" clip_image002 [5] "height =" 21 "src =" http://www.bkjia.com/uploads/allimg/131227/02542HM3-2.jpg "/>
Change the symtemview of row 62 to all:
650) this. width = 650; "style =" border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px "title =" clip_image004 "border =" 0 "alt =" clip_image004 "height =" 32 "src =" http://www.bkjia.com/uploads/allimg/131227/02542H554-3.jpg "/>
Remove line 85.