[mrtg] Linux Configuration

Farhan gabereal_ at hotmail.com
Mon Apr 25 23:53:30 MEST 2005

hi guys iam sending you ppls a simple way to create linux base mrtg if any buddy facing prob dont shy to mail me any way iam not expert but ill try my level best

Farhan Ali Khan
Network Support Engr.

These installation instructions assume you have
1) Linux distribution
2) You would like to perform MRTG and snmp binary installation using rpm.
3) Required Software.s/RPMs (download from ftp/http sites):
a) mrtg
b) snmp
c) snmp-utils

Linux Configuration

Make sure snmp server is working. Without proper working snmp server, mrtg will not work. Therefore, first step is make sure snmp up and running. Following steps will take you gradually to configure it.


Step 1: Make sure snmp server installed
Run rpm commands query option to find out snmp server installed or not: 

farhan at localhost farhan # rpm -qa | grep snmp

If you got positive answer from rpm i.e. snmp installed then please refer Step 2
otherwise snmp server and utils were not present and your choices to binary-installation would be visit www.rpmfind.net to get snmp server and utils rpms.

Step 2: Determine if snmp server is running or not
Run 'ps' command to see if snmp server is running or not:
farhan at localhost farhan # ps -aux | grep snmp
If you got output as service running or listing to port 199 then please see Step 3 otherwise start service using command
# Service snmpd start

Step 3: Make sure snmp server configured properly
Run snmpwalk utility to request for tree of information about network entity. In simple words query snmp server for your IP address (assigned to eth0, eth1, lo etc) 
# snmpwalk -v 1 -c ourcommunity
If you can see your IP address then please proceed to Step 4 else it is time to configure snmp server as follows (by default RH & RHEL 8/9 are not configured for snmp server )

Step 4: Install mrtg if not installed
We can verify it either mrtg is installed or not by this command

rpm -qa | grep mrtg

if mrtg already installed please see Step 5 else use rpmfind.net to find rpm or up2date to install it by using this command # up2date -v -i mrtg

Our actual document is start from here because we already have all above things  
Step 5: Commands to configure mrtg 
Create document root to store mrtg graphs/html pages

# mkdir -p /home/farhan/mrtg/

 Run any one of the following cfgmaker command to create mrtg configuration file

1 ) # cfgmaker --global 'WorkDir: /home/farhan/mrtg ' --output /etc/mrtg/mymrtg.cfg ourcommunity @


OR (make sure your FQDN resolves) 

2) #cfgmaker --global 'WorkDir: /var/www/html/mymrtg' -output /etc/mrtg/mymrtg.cfg ourcommunity at datacenter1.cyber.net.pk  (only for example)

what exactly this cmd will do it will get n collect all physical interfaces of 


Create default by entering this command on your linux 

indexmaker -output /home/farhan/mrtg/index.html /etc/mrtg/mymrtg.cfg


Step 6: First test run of mrtg 
Run mrtg command from command line with your configuration file

# mrtg /etc/mrtg/mymrtg.cfg

Note: You may get few warning message for first time; ignore them run again approximately 3rd time it wont give you any error (it's an original url you can also check it by entering this url in yr browser)


Step 7: Create crontab entry so that mrtg graph / images get generated every 5 minutes 

As root or mrtg user type command
# crontab -e

Add mrtg entry to it

*/5 * * * * /usr/bin/mrtg /home/farhan/mrtg/mymrtg.cfg --logging /var/log/mrtg.log

Save file and you are done with MRTG config issues


Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://lists.ee.ethz.ch/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi

More information about the mrtg mailing list