Quick-n-Dirty Guide to MRTG 1) DO YOU HAVE MRTG? -------------------- In a shell, type: which mrtg This should return the path to mrtg, probably /usr/bin/mrtg. If it finds it, go to Step 3. If it doesn't, continue to Step 2. 2) INSTALLING MRTG ------------------ The process for installing MRTG varies depending on which Linux distribution (or flavour of Unix) you run. Here are instructions for some of the more common ones: a) Mandrake or Red Hat Linux Download the RPM from: http://www.rpmfind.net/linux/RPM/redhat/7.3/i386/mrtg-2.9.17-3.i386.html The RPM is called mrtg-2.9.17-3.i386.rpm. After downloading it, su to root in a shell, change to the directory where you downloaded the RPM, and type: rpm -Uvh mrtg-2.9.17-3.i386.rpm If this step does not work due to missing dependencies, see Appendix A, follow the steps it suggests, and then try this step again. c) Debian As root, type apt-get install mrtg d) SuSE *** again, not me *** e) Gentoo As root, type: emerge mrtg f) FreeBSD This will download, compile, and install MRTG. Now, repeat Step 1. If you find mrtg, note the path and move on to Step 3. If Step 1 still fails, something subtle is wrong. Try emailing your local Linux Users Group (*** link to a LUG finder of some sort *** you do have a LUG, right?) something like: "I am trying to install MRTG in . I am trying to install like this: . However, I run 'which mrtg', and mrtg is not found. Does anyone have any idea about what I am doing wrong? Thanks in advance!" 3) CONFIGURING MRTG ------------------- To generate an mrtg.cfg file, you can use the cfgmaker program (included in the MRTG distribution). In a shell, su to root and type: mkdir /usr/local/mrtg cfgmaker --global 'WorkDir: /usr/local/mrtg' \ --global 'Options[_]: bits,growright' \ --output /etc/mrtg.cfg \ community@router.my.domain In the second command, you need to change the WorkDir directive to reflect the path where you want MRTG to generate its graphs and HTML pages. If you are running a webserver, it might make sense to have MRTG use a subdirectory of htdocs. The Red Hat RPM suggested in this QND Guide actually creates the /var/www/html/mrtg directory, which is probably acceptable if you have installed Apache from the Red Hat RPM as well. You will also need to change the bit of the command that says 'community@router.my.domain' to reflect the community string and hostname or IP address of whichever piece of networking hardware you will be using MRTG to monitor. For more on cfgmaker, type 'man cfgmaker' into a shell. Now, continue on to Step 4. 4) LETTING MRTG GRAB ITS DATA ----------------------------- In a shell, su to root, then enter the command: crontab -e This will bring up root's crontab in a text editor (corresponding to your EDITOR environment variable). At the bottom, add the two lines: # Grab data for MRTG every five minutes */5 * * * * /usr/bin/mrtg /etc/mrtg.cfg This will run the MRTG script every five minutes, using the config file that you created in Step 3. If your mrtg script is installed in a difference place (type 'which mrtg' to find out), replace the /usr/bin/mrtg with that path. Likewise, if you saved your config to a file other than /etc/mrtg.cfg in Step 3, substitute that file above. 5) VIEW THE RESULTS ------------------- Congratulations, you should be done. Fire up a web browser and point it at the directory (or URL, if you are running a webserver and you chose to put your MRTG data in its documents tree) that you specified in Step 3. You should see plenty of colourful graphs. REFERENCES ---------- 1) For more information on MRTG, see: http://people.ee.ethz.ch/~oetiker/webtools/mrtg/ http://people.ee.ethz.ch/~oetiker/webtools/mrtg/mrtg.html 2) For more information on SNMP (Simple Network Management Protocol, which MRTG uses to get its data), see: ftp://ftp.isi.edu/in-notes/rfc1157.txt http://www.rescomp.berkeley.edu/about/training/senior/progs/SNMP-HOWTO/SNMP-HOWTO.html http://www.cisco.com/univercd/cc/td/doc/product/software/ios121/121cgcr/fun_c/fcprt3/fcd301.htm#xtocid176251 3) For more information on setting up MRTG to monitor Cisco hardware, see: http://www.cisco.com/univercd/cc/td/doc/cisintwk/intsolns/dialsol/nmssol/mrtg.htm 4) And finally, for more information on enabling and configuring SNMP on Cisco hardware (you *do* use Cisco, right?), see: http://www.cisco.com/univercd/cc/td/doc/cisintwk/intsolns/dialsol/nmssol/snmpios.htm http://www.cisco.com/univercd/cc/td/doc/product/software/ios121/121cgcr/fun_c/fcprt3/fcd301.htm http://www.cisco.com/univercd/cc/td/doc/product/software/ios121/121cgcr/fun_c/fcprt3/fcd301.htm APPENDIX A) CHASING DEPENDENCIES -------------------------------- If you are reading this, you must be having a problem with dependencies that is keeping MRTG from installing. If this is not the case, stop reading this appendix. The steps that you must follow to resolve your dependencies will again differ based on which distribution you run. a) Mandrake or Red Hat Linux The mrtg-2.9.17-3.i386.rpm RPM depends on the gd-devel package for generating the graphs. gd-devel has a few dependencies of its own. To fix the dependency problems, try the following steps: 1) In a shell, type: rpm -q freetype-devel If the freetype-devel package is found, move onto the next step. If not, download the freetype-2.0.9-2.i386.rpm and freetype-devel-2.0.9-2.i386.rpm RPMs from: http://www.rpmfind.net/linux/RPM/redhat/7.3/i386/freetype-2.0.9-2.i386.html http://www.rpmfind.net/linux/RPM/redhat/7.3/i386/freetype-devel-2.0.9-2.i386.html In a shell, change to the directory where you downloaded the RPMs, su to root, and type: rpm -Uvh freetype-2.0.9-2.i386.rpm freetype-devel-2.0.9-2.i386.rpm If the RPMs install with no problems, move onto the next step. If not, turn to your LUG. ***Link this to the help QND*** 2) In a shell, type: rpm -q libjpeg If the libjpeg package is found, move onto the next step. If not, download libjpeg-6b-19.i386.rpm from: http://www.rpmfind.net/linux/RPM/redhat/7.3/i386/libjpeg-6b-19.i386.html In a shell, change to the directory where you downloaded the RPM, su to root, and type: rpm -Uvh libjpeg-6b-19.i386.rpm If the RPM installs with no problems, move onto the next step. If not, turn to your LUG. ***Link this to the help QND*** 3) Download gd-1.8.4-4.i386.rpm and gd-devel-1.8.4-4.i386.rpm from: http://www.rpmfind.net/linux/RPM/redhat/7.3/i386/gd-1.8.4-4.i386.html http://www.rpmfind.net/linux/RPM/redhat/7.3/i386/gd-devel-1.8.4-4.i386.html In a shell, change to the directory where you downloaded the RPMs, su to root, and type: rpm -Uvh gd-1.8.4-4.i386.rpm gd-devel-1.8.4-4.i386.rpm If the RPMs install with no problems, return to Step 2 and try again. If not, turn to your LUG. ***Link this to the help QND***