Wednesday, May 14, 2008

Linux MRTG Configuration with SNMP


Step:1 To check snmp rpm package is installed or not which is required to MRTG.

# rpm –qa | grep snmp

Step:2 If not installed please install it by using rpm package or by yum

# yum install net-snmp-utils net-snmp

Step:3 Run snmpwalk utility to request for tree of information about network entity. In simple words query snmp server for your IP address

# snmpwalk -v 1 -c public localhost

or

# snmpwalk -v 1 -c public 192.168.10.95

If not installed please configure the following step

Step:A Rename the existing file snmpd.conf with snmpd.conf.old

# mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.old

Step:B Create new snmpd.conf file & Enter the following line in the new configuration file to set the Read Only community string to craz33guy.

# vi /etc/snmp/snmpd.conf

 
Add the Line in the snmpd.conf file: rocommunity craz33guy

Step:C Restart the snmp service and check the snmp configuration of the snmp service

# service snmpd restart

# snmpwalk -v 1 -c public 192.168.8.5

Step: 4 Mrtg software may install during initial installation; you can verify if MRTG installed or not with following RPM command:

# rpm -qa | grep mrtg

If not installed please install it by using rpm package or by yum

#yum install mrtg

Step: 5 Create document root to store mrtg graphs/html pages:

# mkdir -p /var/www/html/mymrtg/

Step: 6 Run the following cfgmaker command to create mrtg configuration file:

# cfgmaker --global 'WorkDir: /var/www/html/mymrtg' --output /etc/mrtg/8.5.cfg craz33guy@192.168.8.5

Step: 7 Create default index page for your MRTG configuration:

# indexmaker --output=/var/www/html/mymrtg/index.html /etc/mrtg/8.5.cfg

Step: 8 Copy all tiny png files to your mrtg path:

        # cp -av /var/www/html/mrtg/*.png /var/www/html/mymrtg/
 
Step: 9 Run mrtg command from command line with your configuration file:
               #  env LANG=C /usr/bin/mrtg /etc/mrtg/8.5.cfg

Step: 10 Add a new MRTG line in /etc/cron.d/mrtg for each new configuration file you create and restart the crond service.

 
0-59/5 * * * * root env LANG=C /usr/bin/mrtg /etc/mrtg/8.5.cfg
               
        # service crond restart 

0 comments: