One, MRGT configuration case Description, here to monitor the card as an example
#通过public监控localhost上的192.168.1.68 address Flow
target[eth1_lan]:/192.168.1.68:public@localhost
#图片右对齐方式
Options[eth1_lan]:growright
#生成图片存放目录
directory[eth1_lan]:eth1
#网卡最大流量
Maxbytes[eth1_lan] : 100000000
#图片Y轴单位数
kmg[eth1_lan]:k,m,g
#Y轴标题
ylegend[eth1_lan]:bytes per Second
#Y轴单位
shortlegend[eth1_lan]:b/s
#接下来是网页上的数据 because the MRTG needs to render the resulting picture to the Web page, which is the attribute tag on the page
#网页中颜色对应值
Legend1[eth1_lan]: Per second inflow (unit bytes)
Legend2[eth1_lan]: Outflow per second (unit bytes)
Legendi[eth1_lan]: Inflow
legendo[ Eth1_lan]: Outflow
#网页标题
title[eth1_lan]:eth1 network traffic [inflow + outflow]
pagetop[eth1_lan]:eth1 network traffic [inflow + outflow]
Monitoring different system-oid may require different configurations, no longer listed here
There is a noteworthy place to add the following in the configuration file when you need to monitor the disk
Write the maximum number of directories that need to be monitored to the configuration file snmp.conf
disk/123932636
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/OS/Linux/
Second, the implementation of MRTG generated pictures
The configuration file mrtg.cfg has been configured in the first step.
/usr/bin/mrtg/ect/mrtg/mrtg.cfg
There will be an error
Execute the following command 3 times, unless your mrtg.cfg has a grammatical error.
Env LANG=C/USR/BIN/MRTG/ETC/MRTG/MRTG.CFG
Of course, these are finally written to the crontab
CRONTAB-E */2 * * * env LANG=C/USR/BIN/MRTG/ETC/MRTG/MRTG.CFG
#注意这里的语句要与上面执行3次的语句一样, the effect is to generate a index.html and corresponding PNG picture of the monitoring device, and it is generated in 2 minutes.
The generated picture, by default, is stored under the path/VAR/WWW/MRTG
Third, the generation of monitoring first page
Generate MRTG Monitor first page with Indexmaker
Indexmaker--output/var/www/mrtg/index.html--title= "System State Monitor"/etc/mrtg/mrtg.cfg
This generated page can always reflect the system monitoring information, the page can be accessed through the Web server.
Author: 51cto shayang88