//

2009/06/17

MRTG on Ubuntu Server

Assuming that you want to monitor your networking equipment with MRTG, you need to set up the snmp community on the piece of equipment. Usually its just a matter of enabling snmp, and the default community will be public. If you change the default community to another name, make sure you remember the name for later.

Now lets set up MRTG to read the data.
With Ubuntu server, MRTG will automatically set up /var/www/mrtg. In other distrobutions, it will set it up in a different area, so you will need to change the 'WorkDir:' variable in the following scenario to the directory where MRTG is installed.

I'm going to create an /etc/mrtg directory rather then move the mrtg.cfg file within /etc/ This will make it less confusing in the future.

mkdir /etc/mrtg

mv /etc/mrtg.cfg /etc/mrtg/

Now we run the cfgmaker command to get things up and running:

cfgmaker --global 'WorkDir:/var/www/mrtg' --global 'Options[_]: bits,growright' --output /etc/mrtg/mrtg.cfg public@192.168.1.85

We need to make sure the following lines are correct in /etc/mrtg/mrtg.cfg If they are not there, add them.

EnableIPv6: no
RunAsDaemon: Yes
Interval: 5
Logdir: /var/log/mrtg

Now run:

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

Which will build the index so you can view the output.

Then I run this command to set an environmental variable

env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg

and open http://localhost/mrtg/index.html


Ref:
http://www.linuxbasement.com/content/mrtg-ubuntu-server
http://www.cyberciti.biz/faq/centos-fedora-linux-multi-router-traffic-grapher-tutorial/

No comments:

IP address