This is a mrtg config file generator for pinging servers and parsing the output through MRTG. [ PROVIDED FILES ] (if you just plan to install this, skip to BASIC STEPS TO INSTALL topic below) Contents: ### net.sh: The actual script that pings the servers is net.sh. It relies on fping being available. Quote from 'man 8 fping' AUTHORS Roland J. Schemers III, Stanford University, concept and versions 1.x RL "Bob" Morgan, Stanford University, versions 2.x ZeroHype Technologies Inc. (http://www.zerohype.com), versions 2.3x and up, fping website: http://www.fping.com The script accepts as parameter a : pair (with ':' as delimiter), but normally you should not be interested in this, as it is called only internally by MRTG. ---- You MUST edit it and change as following: set WORKDIR to the root of your ping statistics (normally, this dir). set FPING to the path of your fping program (normally, /usr/sbin/fping) set HOST_TIMEOUT to the maximum ping delay before fping decides that the host is unreachable (I have it set to 500 msec) ### gencfg.sh This scripts generates the required mrtg config files, aswell as other various files. It accepts as paramters as string of one or more pairs :, corresponding to the hosts you want pinged. ---- You MUST edit it and change as following: set HOSTNAME to your hostname, to be used when reporting the statistics. This can be anything. set WORKDIR to the root of your ping statistics (normally, this dir). set WEBDIR to the dir where MRTG will generate the statistics. set FPING to the path of your fping program (normally, /usr/sbin/fping). set ICONDIR to the path where you plan copying MRTG's .png files. set INTERVAL to the number of minutes between calling MRTG (normally, 5). set HOST_TIMEOUT to the maximum ping delay before fping decides that the host is unreachable (I have it set to 500 msec) set MRTG_EXEC to the path to MRTG's executable. set MAINTAINER to a html string describing the maintainer of the page. You can now run ./gencfg.sh with a number of parameters. Example: ./gencfg.sh dns.ripe.net:193.0.0.193 www.extreme.ro:212.93.159.195 This will generate several files: - MRTG config files are in mrtg-gen-.cfg - The script that calls MRTG on the config files is in ./mrtg-run.sh - The web directory will be created, with a directory inside it for each host that is watched. - Inside the web directory you will find a file named 'index.html' that contains links to the hosts' MRTG files. - The ./add-hosts.sh file will be generated. By running it as it is, you will duplicate the effect of the command you're running (ie. re-build the upper mentioned files). If you want to add more hosts to watch, simply edit it and add one more line with its : pair. ### clean.sh This script will remove all generated files, except for add-hosts.sh file (in case you want to generate/move the MRTG statistics to another host), or change your mind. [ BASIC STEPS TO INSTALL ] - Uncompress this into a directory of your choice. - Modify gencfg.sh and set HOSTNAME, WORKDIR, WEBDIR, FPING and MAINTAINER accordingly (and/or the other options aswell). - Modify net.sh and set WORKDIR and FPING accordingly (and/or the other options aswell). - Run ./gencfg.sh : : .. - Link WEBDIR someplace in your apache html structure, add a link somewhere among your html files. - Copy the MRTG .png files (that can be found in mrtg/lib/mrtg) into your ICONDIR (usually defined as /mrtg/icons/, with the root your apache html root directory) - Add mrtg-run.sh with full path to your crontab, running every INTERVAL minutes (usually 5 minutes). You should be done now. --------------------------- Written by Dan Podeanu, pdan@extreme.ro, distributed under GNU.