2010/02/11

MRTG in FreeBSD

I've searched online for a long time.... but today I found it is not that complicated to run MRTG on a FreeBSD server.

People recommended that installing net-snmpd first before MRTG. Somehow, since I have a FreeBSD 7.2, it has bsnmpd already.

So, all we have to do is to activate bsnmpd by adding the line, [ bsnmpd_enable="YES" ] in /etc/rc.conf .

Then, as usual, cd to /usr/ports/net-mgmt/mrtg to complete the installation.

After installing, do cfgmaker to configure everything as following.

In CLI:

cfgmaker --global 'WorkDir: /usr/local/www/apache22/data/mrtg'  --global 'Options[_]: growright, bits'  --global 'WithPeak[_]: wmy' public@localhost  >  /usr/local/etc/mrtg/mrtg.cfg

Next, the index:

indexmaker  --title 'MRTG'  --addhead=''  --output /usr/local/www/apache22/data/mrtg/index.html  --columns=1  --nolegend  /usr/local/etc/mrtg/mrtg.cfg

Last, run mrtg for about three times till no error messages.

mrtg /usr/local/etc/mrtg/mrtg.cfg

Add mrtg to crontab! (per 5 min)

*/5 * * * * /usr/local/bin/mrtg /usr/local/etc/mrtg/mrtg.cfg

No comments:

Post a Comment