MRTG is working on the SNMP protocol, you have to install SNMP to start MRTG to observe your network, I just did not configure a good net-snmp, so MRTG display will have no graphics, I just made such a mistake.
MRTG uses SNMP to obtain network traffic information from devices using devices such as switches, and to display PNG format graphics in HTML, making it easy for network administrators to manage the devices they monitor (switches). At present, the network management type (intelligent) switches are supported by SNMP and can be monitored by MRTG.
Note: I am using the net SNMP 5.4.3 version, I do not know why different versions of the configuration are not the same, I feel this is very sick. But I still think the snmpconf tool is the most convenient, what I do here is let Snmo monitor all.
1. Installation
To install the MRTG package, you must first install the software packages gcc, Perl, GD, Libpng, Zlib, Freetype,fontconfig, and so on
Here I'm using Yum installation [Root@test3 mrtg-2.9.28]# yum install-y gcc perl gd libpng zlib freetype fontconfig-MRTG
If you are compiling the installation, this is the following procedure:
① Install the TAR package
# tar zvxf mrtg-2.9.28.tar.gz # CD mrtg-2.9.28
#./configure--PREFIX=/USR/LOCAL/MRTG \
--WITH-GD =/usr/include \ (The following are the installation paths)
--with-gd-lib=/usr/lib \
--with-gd-inc=/usr/include \
--with-png=/usr/include \
--with-zlib=/usr/include &&
# Make && make install
② Build configuration file
# mkdir/usr/local/mrtg/cfg #cd/usr/local/mrtg/bin
#./cfgmaker--global ' Workdir:/usr/local/httpd/htdocs/'
--global ' options[_]: Bits,growright ' \
--global ' language:gb2312 '
--OUTPUT/USR/LOCAL/MRTG/CFG/XXX.CFG \
public@xxx.xxx.xxx.xxx#
"XXX.XXX.XXX.XXX" is the IP of the SNMP server, and the above command generates the server's configuration file.
The HTML pages generated by MRTG can be completely customized by the user, and all customizations are made by modifying the generated configuration file. MRTG configuration file is rich in content, please refer to the MRTG configuration document
③ set MRTG to execute "crontab-e" periodically, adding the following line:
*/5 * * * */bin/env lang=en_us/usr/local//mrtg/bin/mrtg/usr/local/mrtg/cfg/xxx.cfg
The above command sets the server defined in the configuration file xxx.cfg every 5 minutes. 5 minutes is a reasonable value, can also be redefined according to their own needs.
④ Index page creation
You can also generate an index page by executing the following command:
#cd/usr/local/mrtg/bin/indexmaker--output= "/usr/local//httpd/htdocs/index.html"--title= "Taffic Monitor Center"/u sr/local//mrtg/cfg/xxx.cfg
So far, configuration completed, restart SNMP and httpd services, access to http://ip/mrtg/, you can see the network traffic map