Simple steps to install mrtg on plesk

MRTG is a fantastic tool that keeps track of several processes on servers via SNMP. Installation and configuration is quit simple and you can get this done in just 5 minutes. This tutorials shows how to install mrtg in plesk using rpm by just using yum.

Pre-requests :


  • net-snmp & yum

Configuring net-snmp for mrtg :


Make sure you have net-snmp installed in your server or just use yum to install it.

  • yum install net-snmp
    chkconfig snmpd on
    echo > /etc/snmp/snmpd.conf
    vi /etc/snmp/snmpd.conf

And add the following line :

  • rocommunity <your-snmp-password>
  • service snmpd restart

Installing mrtg on plesk


Just use the yum to install the mrtg which is so simple than using the tar

  • yum install mrtg

Now create the mrtg configuration using the cfgmaker

  • cfgmaker -global ‘WorkDir:/var/www/mrtg’ -global “Options[_]:bits,growright” -snmp-options=:::::2 -output /etc/mrtg/mrtg.cfg <your-snmp-password>@localhost

To test the installation run (yes run it twice):

  • env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg –lock-file /var/lock/mrtg/mrtg_l –confcache-file /var/lib/mrtg/mrtg.ok
    env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg –lock-file /var/lock/mrtg/mrtg_l –confcache-file /var/lib/mrtg/mrtg.ok

You will get a warning on first run and it will disapper on the second run.

Use the indexmake command to generate the index.html file in the /var/www/mrtg/ folder

  • /usr/bin/indexmaker /etc/mrtg/mrtg.cfg > /var/www/mrtg/index.html

Now open the mrtg cron file and just make sure the following lines are added (if not added it)

  • */5 * * * * root /usr/bin/mrtg /etc/mrtg/mrtg.cfg –lock-file /var/lock/mrtg/mrtg_l –confcache-file /var/lib/mrtg/mrtg.ok

service mrtg start

Now you have to sym link the default mrtg document root with the plesk default document root directory to access it via http://<yourserverip>/mrtg/

  • cd /var/www/vhosts/default/htdocs/
  • ln -s /var/www/mrtg

Now try access the http://<yourserverip>/mrtg/ and you will see graphs started loading now which will update itself every 5 minutes as per the cron.