MRTG官方配置教材

How do I use SNMP and MRTG to monitor the network traffic load on Red Hat EnterpriseLinux 4?

Release Found: Red Hat Enterprise Linux 4

SNMP (Simple Network Management Protocol) is a protocol used for network management.The NET-SNMP project includes various SNMP tools: an extensible agent, an SNMP library,tools for requesting or setting information from SNMP agents, tools for generating andhandling SNMP traps, a version of the netstat command which uses SNMP, and a Tk/PerlMIB browser. This package contains the snmpd and snmptrapd daemons, documentation,etc.

In addition to this, install the net-snmp-utils package, which contains NET-SNMP utilities.The Multi Router Traffic Grapher (MRTG) is a tool to monitor the traffic load on network-links. MRTG generates HTML pages containing PNG images which provide a live,visual representation of this traffic.

Usually SNMP gets the network traffic from network devices. MRTG can get the traffic from SNMP then translate it to an image and output a HTML web page for users.Below is the procedure to install and configure the snmp and mrtg. For this example,

assume the IP address is 192.168.0.20.

Be sure the packages listed below are installed. Use the rpm -qa packagename command to check and up2date to install any missing packages.

net-snmp-libs

net-snmp

net-snmp-devel

net-snmp-perl

net-snmp-utils

mrtg

Edit the /etc/snmpd/snmpd.conf file (in the position near line 62 and line 89), changing this line:

access notConfigGroup "" any noauth exact systemview none none

access notConfigGroup "" any noauth exact mib2 none none

In the same file, uncomment this line by removing the pound sign ( #):

view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc

Save the file and restart the snmpd service:

service snmpd restart

chkconfig snmpd on

Now that snmp is configured, the next step is to configure mrtg software. The mrtg packageinstalls to the directory /var/www/mrtg, so change to the directory and run the following command to generate the mrtg configuration file:

# cd /var/www/mrtg

# cfgmaker --global "WorkDir: /var/www/html/mrtg" --global

"Options[_]: growright,bits" --output=/var/www/mrtg/mrtg.cfg

public@192.168.0.20

Now in the /var/www/mrtg directory, there is a file mrtg.cfg generated which is the mrtg configuration file.

After snmp and mrtg are configured, configure the Apache web server to serve out the mrtg pages. Start by editing the /etc/httpd/conf/httpd.conf file. Edit the section DocumentRoot section as below:

DocumentRoot "/var/www/html/mrtg"

Now, create that directory:

# mkdir /var/www/html/mrtg/

Start the Apache service:

# service httpd start

# chkconfig httpd on

Next, generate the index of the webpage as follows:

# indexmaker --output=/var/www/html/mrtg/index.html

--Title=NetTraffic /var/www/mrtg/mrtg.cfg

Start the monitor program as follows:

# mrtg /var/www/mrtg/mrtg.cfg

If there is a warning message, run this command:

# env LANG=C /usr/bin/mrtg /var/www/mrtg/mrtg.cfg.

To test the set up, go to the machine's address--for example http://192.168.0.20 . There will be a web page with network statistics.

Adding a cron job will run the commands to get the network status regularly. Here is an

example:

* /5* * * * /usr/bin/mrtg /var/www/mrtg/mrtg.cfg

For more informantion about snmp and mrtg, see their man pages.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值