Blame contrib/net-hosts/README

Packit 667938
PREREQUISITES:
Packit 667938
	- Linux operating system ( I am using RedHat 6.2 );
Packit 667938
        - MRTG version ( I used 2.8.8 version );
Packit 667938
	- SHELL scripting language;
Packit 667938
	- AWK scripting language;
Packit 667938
	- FPING utility ( I used 2.2b1 );
Packit 667938
	- CRON daemon installed;
Packit 667938
	- TCP/IP Network connection {:-)
Packit 667938
Packit 667938
net-hosts
Packit 667938
Packit 667938
        I use this script to monitor internet connection state
Packit 667938
        on a chosen route (from traceroute). Usage is very simple:
Packit 667938
Packit 667938
        - Put in your crontab file a line which have to be run
Packit 667938
	every five (5) minute or any other time interval you want
Packit 667938
	(but you have to edit, according with this new value,
Packit 667938
	'make-mrtg.cfg.awk' file). I am using Linux RedHat 6.2
Packit 667938
	and in my /etc/cron.d I put a file named 'net-hosts' with
Packit 667938
	the following structure:
Packit 667938
Packit 667938
##################################
Packit 667938
# /etc/cron.d/net-hosts -rw-r--r--
Packit 667938
#
Packit 667938
Packit 667938
*/05 * * * * root /usr/local/mrtg/contrib/net-hosts/net-hosts
Packit 667938
Packit 667938
#
Packit 667938
# EOF
Packit 667938
##################################
Packit 667938
	
Packit 667938
	- Restart your cron daemon... and wait
Packit 667938
Packit 667938
        To install, first edit the variables from both 'make-mrtg.cfg.awk'
Packit 667938
	and 'net-hosts files' as needed. I found it easier to have these defined
Packit 667938
	rather than hardcoded due to differences between code interpretations.
Packit 667938
	
Packit 667938
	You don't have to insert any other target in your own mrtg.cfg
Packit 667938
	file that you already have, because this script is launced by
Packit 667938
	the cron daemon.
Packit 667938
Packit 667938
Packit 667938
Packit 667938
internet
Packit 667938
	
Packit 667938
	This is the file which keep the IPs, FQDNs, dates and states
Packit 667938
	for hosts you want to monitor. The format of this file is:
Packit 667938
	
Packit 667938
	<IP_1>:<FQDN_1>:<LAST-MODIFIED_1>:<STATE_1>
Packit 667938
	<IP_2>:<FQDN_2>:<LAST-MODIFIED_2>:<STATE_2>
Packit 667938
	<IP_3>:<FQDN_3>:<LAST-MODIFIED_3>:<STATE_3>
Packit 667938
	.
Packit 667938
	.
Packit 667938
	.
Packit 667938
	
Packit 667938
	where:
Packit 667938
	 - IP_xxx is IP address (IPv4) for host xxx
Packit 667938
	 - FQDN_xxx is Fully Qualified Domain Name of host xxx
Packit 667938
	 - LAST-MODIFIED_1 is the date when the state of host xxx was last modified
Packit 667938
	 - STATE_1 is the current state of host xxx (1 = UP; 0 = DOWN)
Packit 667938
	
Packit 667938
	First time you create this file you just need IPs and  FQDNs,
Packit 667938
	blank dates and 1 (or 0) for the state of every hosts, like this:
Packit 667938
	
Packit 667938
	 aaa.aaa.aaa.aaa:your.router.name::1
Packit 667938
	 bbb.bbb.bbb.bbb:yourISP.router.name::1
Packit 667938
	 .
Packit 667938
	 .
Packit 667938
	 .
Packit 667938
	 zzz.zzz.zzz.zzz:that.host.name::1
Packit 667938
Packit 667938
	HINT: You could have an ordered list using traceroute and
Packit 667938
	awk (or any other shell-script).
Packit 667938
	
Packit 667938
	The file 'internet' shipped with this package it is
Packit 667938
	a demo.
Packit 667938
Packit 667938
Packit 667938
Packit 667938
Packit 667938
make-mrtg.cfg.awk
Packit 667938
Packit 667938
	This is the core of the entire task. Here I make 'mrtg-awk.cfg'
Packit 667938
	file using the content of 'internet' file and the state read
Packit 667938
	from fping utility (Fast Ping - it was not written by me...).
Packit 667938
	After doing this, internaly is lauched 'mrtg' executable
Packit 667938
	for net-hosts's mrtg.cfg file (named 'mrtg-awk.cfg').
Packit 667938
	Of course, it is created a file, 'internet.html', used
Packit 667938
	like an index file for the all targets in 'mrtg-awk.cfg',
Packit 667938
	but you could use 'indexmaker' script provided with MRTG
Packit 667938
	for doing this (see an example in 'net-hosts').
Packit 667938
	
Packit 667938
	Be aware ! You have to place icons (MRTG) and image files
Packit 667938
	(grnball.gif, redball.gif, cubprev.gif) in the same
Packit 667938
	location. You also have to place 'net-hosts.css' into declared
Packit 667938
	location inside that AWK script file.
Packit 667938
	
Packit 667938
Packit 667938
----------
Packit 667938
Packit 667938
        Direct questions or suggestions to me.
Packit 667938
Packit 667938
        Have fun!
Packit 667938
Packit 667938
        -Adrian Turcu <adrianturcu@yahoo.com>
Packit 667938
Packit 667938
Packit 667938