OVERVIEWMRTG as it is otherwise known as, is a daemon to graph on a webpage the stats for nics and routers. For this howto we will discuss howto make a graph for a nic interface ep0. You will also need to install SNMPD which I will be covering also, and it helps to have apache going. Ok here we go =) good luck.INSTALLATIONFirst off you are going to need SNMPD. If you do not have wget then # cd /usr/ports/ftp/wget/ # make install clean Now you can get the snmpd package using wget

And now you can compile gd # wget http://www.boutell.com/gd/http/gd-1.8.3.tar.gz # gunzip -c gd-1.8.3.tar.gz |tar xf - # mv gd-1.8.3 gd # cd gdThe \ characters at the end of the line mean that all the following material should actually be written on a single line. # make INCLUDEDIRS="-I. -I../zlib -I../libpng" \ LIBDIRS="-L../zlib -L. -L../libpng" \ LIBS="-lgd -lpng -lz -lm" # cd ..Ok now everything is ready for the mrtg compilation. # cd /usr/local # wget http://whisky.warnerve.net/files/mrtg-2.9.6.tar.gz # gunzip -c mrtg-2.9.6.tar.gz | tar xvf - # cd mrtg-2.9.6If you all the libraries have been preinstalled on your system you can configure mrtg by doing a simple: # ./configureOtherwise you may have to give some hints on where to find the various libraries required to compile mrtg: # ./configure --with-gd=/usr/local/src/gd \ --with-z=/usr/local/src/zlib \ --with-png=/usr/local/src/libpng # makeCREATING THE CONFIGOk mrtg runs off a mrtg.cfg that you have to create. Don't worry there is a nice little program called cfgmaker that is a great asset to you. # cd /usr/local/mrtg-2.9.6/bin/ # ./cfgmaker --global 'WorkDir: /home/mrtg/public_html' \ --global 'Options[_]: bits,growright' \ --output /home/mrtg/mrtg.cfg \ community@127.0.0.1The \ characters at the end of the line mean that all the following material should actually be written on a single line. This setup is presuming that there is a directory /home/mrtg/ and he has a public_html directory with apache for web pages. community@127.0.0.1 is used to access snmpd with gives stats on all nics ( Network Interface Card ) on the system.If you want the bottom pictures to work then do as follows.

# cp /usr/local/mrtg-2.9.6/doc/*.png /home/mrtg/public_htmlOr whereever the webdir is for it.Running MRTGMrtg needs to be run to update the .html files all the time to display new stats. I recommend running a cron.But this is how you run it. # /usr/local/mrtg-2.9.6/bin/mrtg /home/mrtg/mrtg.cfgAssuming /home/mrtg/mrtg.cfg is where you put the mrtg.cfgCRONTABNow to setup a crontab for it do as follows.I like to keep my crons organised for root so I have a file called /root/crons where I place all my crontabs for root. # ee /root/crons */5 * * * * /usr/local/mrtg-2.9.6/bin/mrtg /home/mrtg/mrtg.cfg >/dev/null 2>&1 # crontab /root/cronsThis will run it every 5 mins and update the graphs.Viewing the GraphsIf you followed this setup then you should find your graphs at http://localhost/~mrtg/127.0.0.1_1.html http://localhost/~mrtg/127.0.0.1_2.html http://localhost/~mrtg/127.0.0.1_3.html http://localhost/~mrtg/127.0.0.1_3.html And so on, depending how many interfaces you have._______________________________________________________________________HOWTO Done by whisky