[mrtg] MRTG Daemon at Startup with hundreds of configs

Koelstra, J. (Jan) JKoelstra at MINSZW.NL
Thu Aug 23 10:21:09 CEST 2007


What about a few 'master config'  files only containing some basic setup and 'include: ..' statements to all your existing config files? 
In this way you only need to start your master config files.
 
HTH,
 
Jan.

	-----Original Message-----
	From: mrtg-bounces at lists.oetiker.ch [mailto:mrtg-bounces at lists.oetiker.ch] On Behalf Of Brad Lodgen
	Sent: Wednesday, August 22, 2007 11:56 PM
	To: mrtg at lists.oetiker.ch
	Subject: [mrtg] MRTG Daemon at Startup with hundreds of configs
	
	
	Hi there,
	
	I'm looking at a project to switch a server that is using MRTG to monitor hundreds of devices over to running MRTG in daemon mode, for efficiency. As one could infer, there are hundreds of config files to go along with those hundreds of devices. Since MRTG has to be started once for each config, I'm trying to develop a Linux startup script that will execute all of the configs. I will copy/paste the startup script I'm currently working with. Does anyone have any idea how to change this to make it start up all of the configs? It may be an easy answer, but I'm very fresh on shell scripting and have spent hours searching for this info, to no avail. Please help! 
	
	Thanks in advance for any advice or help you may provide...here is the startup script I found....
	
	
	
	#!/bin/bash
	#
	# mrtg          This shell script starts mrtg
	#
	# Author:       Stefan SF 
	#
	# chkconfig:    345 90 35
	#
	# description:  mrtg The Multi Router Traffic Grapher
	# processname:  mrtg
	
	# config:       /etc/mrtg/mrtg.conf
	#
	### BEGIN INIT INFO
	# Provides: mrtg
	# Required-Start: $network
	# Default-Stop: 0 1 6
	# Short-Description: Starts the The Multi Router Traffic Grapher
	# Description: The Multi Router Traffic Grapher (MRTG) is a tool to monitor \
	
	#              the traffic load on network-links. MRTG generates HTML pages \
	#              containing GIF/PNG images which provide a live visual \
	#              representation of this traffic.
	### END INIT INFO
	
	
	# source function library
	. /etc/rc.d/init.d/functions
	
	MRTG="/usr/bin/mrtg"
	CONFIG="/etc/mrtg/mrtg.cfg"
	PIDFILE="/var/run/mrtg.pid"
	LOCKFILE="/var/lock/mrtg/mrtg"
	
	OPTIONS="--daemon"
	
	RETVAL=0
	
	start() {
		echo -n $"Enabling MRTG: "
		rm -f ${LOCKFILE} 2> /dev/null
		env LANG=C ${MRTG} --pid-file=${PIDFILE} --lock-file=${LOCKFILE} ${OPTIONS} ${CONFIG}
	
		RETVAL=$?
		echo
	}
	
	stop() {
		echo -n $"Disabling MRTG: "
		kill `cat ${PIDFILE}` && rm -f ${LOCKFILE}
		RETVAL=$?
		echo
	}
	
	restart() {
		stop
		start
	}
	
	case "$1" in
	
	  start)
		start
		;;
	  stop) 
		stop
		;;
	  restart|force-reload)
		restart
		;;
	  status)
		if [ -f $LOCKFILE ]; then
			echo $"MRTG is enabled."
			RETVAL=0
		else
			echo $"MRTG is disabled."
	
			RETVAL=3
		fi
		;;
	  *)
		echo $"Usage: $0 {start|stop|status|restart|force-reload}"
		exit 1
	esac
	
	exit $RETVAL




_________________________________________________________

Dit bericht kan informatie bevatten die niet voor u is bestemd. Indien u niet de geadresseerde bent of dit bericht abusievelijk aan u is toegezonden, wordt u verzocht dat aan de afzender te melden en het bericht te verwijderen. De staat aanvaardt geen aansprakelijkheid voor schade, van welke aard ook, die verband houdt met risico's verbonden aan het elektronisch verzenden van berichten.
_________________________________________________________

This message may contain information that is not intended for you. If you are not the addressee or if this message was sent to you by mistake, you are requested to inform the sender and delete the message. The state accepts no liability for damage of any kind resulting from the risks inherent in the electronic transmission of messages.
_________________________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/mrtg/attachments/20070823/012c4a91/attachment.html 


More information about the mrtg mailing list