MRTG Installation

Installation Target : Centos 5 / RHEL 5


Step 1

yum install mrtg perl zlib gd libpng net-snmp net-snmp-devel net-snmp-utils

Install mrtg,perl,zlib,gd,libpng,net-snmp packages.

vi /etc/snmp/snmpd.conf

## Add this line under "view systemview..."
view systemview included .1.3.6.1.2.1.2

Edit in config file of snmpd

vi /etc/syslog.conf

## Add "snmp.none" in this line
*.info;mail.none;authpriv.none;cron.none;snmp.none /var/log/messages

Edit in config file of syslog

/etc/init.d/syslog restart
/etc/init.d/snmpd start

To start snmpd and restart syslogd




Step 2

cfgmaker domain.com > /etc/mrtg/mrtg.cfg
OR
cfgmaker 123.123.123.123 > /etc/mrtg/mrtg.cfg
OR
cfgmaker --zero-speed=12500000 --show-op-down 123.123.123.123 > /etc/mrtg/mrtg.cfg

Make the first mrtg config
P.S. If use 2nd command, it will generate config with "#" if those port is down by default. Use the last one "--zero-speed=12500000 --show-op-down" to enable all port in mrtg config.

vi /etc/mrtg/mrtg.cfg

## Add this at the last line"
### global options
LoadMIBs: /usr/local/snmp/share/snmp/mibs/UCD-SNMP-MIB.txt
Workdir: /var/www/html/mrtg
Refresh: 300
Interval: 5
Language: en
Options[_]: growright

Modify the mrtg.cfg to add global setting

mkdir /var/www/html
rm /etc/httpd/conf.d/mrtg.conf

Make the mrtg data folder and remove the httpd deny restriction




Step 3

crontab -e

## MRTG
*/5 * * * * env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg &> /dev/null
*/5 * * * * env LANG=C indexmaker /etc/mrtg/mrtg.cfg > /var/www/html/mrtg/index.htm

Add the cronjob to generate the graph and index file per 5 minutes

env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg
env LANG=C indexmaker /etc/mrtg/mrtg.cfg > /var/www/html/mrtg/index.htm

Generate the first graph and index file manually.

It is completed basiclly , and test in website http://serverip/mrtg/



Server is hosted by Alanstudio
Linux Operating System

Recommend screen resolution 1024 x 768 / IE / FireFox
Alan Studio © 2007 by Alan Cheung Hin Lun. All rights reserved.