[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mon
Subject:    Re: isn't an update release overdue?
From:       Ed Ravin <eravin () panix ! com>
Date:       2001-06-14 16:55:29
[Download RAW message or body]

Joe Rhett writes:
> Obvious candidates for fixes -- mon just doesn't work without these:
> 	fping.monitor patches
> 	http.monitor patches
> 	monshow patches

I've also sent out patches for the SMTP, NNTP, FTP, POP, IMAP monitors, all
small stuff (they send "Time Out" as the summary insead of the hostname that
fell over).

There's also this minor improvement to dns.monitor that makes its output
much more usable:

RCS file: RCS/dns.monitor,v
retrieving revision 1.1
diff -r1.1 dns.monitor
19c19
< # $Id: dns.monitor,v 1.1 2000/07/14 16:47:52 root Exp $
---
> # $Id: dns.monitor,v 1.3 2000/12/14 04:50:38 root Exp $
94d93
<     print "$Program: problems with";
96c95
<       print " $FailedZones[$i]($FailedServers[$i])";
---
>       print "$FailedServers[$i](zone $FailedZones[$i])";


> 
> Things that really should be there:
> 	Init script that can be linked into place on the system

Here's what I use on NetBSD 1.4.  Note that I've set up a special
username to run mon, obviously that's specific to my site.


#!/bin/sh

#
# You probably want to set the path to include
# nothing but local filesystems.
#
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/sbin
export PATH

M=/usr/local/mon
PID=/var/state/mon/mon.pid
MONETC=/etc/mon

case "${1:-start}" in
    start)
        if [ -x $M/mon ]
        then
            su -m netmon -c "$M/mon -c $MONETC/mon.m4 -f -a $M/alert.d -P
$PID -
s $M/mon.d -f" #  2>/dev/null ???
        fi
        ;;

    stop)
        kill -TERM `cat $PID`
        ;;

    debug)
        if [ -x $M/mon ]
        then
                su -m netmon -c "$M/mon -c $MONETC/mon.cf -d >
/tmp/mon.debug 2>
&1"
        else
                echo "Cannot execute $M/mon."
        fi
        ;;

    *)
        echo "Usage: mon {start|stop}"
        exit 1
esac

exit 0

======================================================

And here's what I use on NetBSD 1.5 (plugs in to their specific rc.d
system):

#!/bin/sh

# PROVIDE: mon
# REQUIRE: DAEMON

. /etc/rc.subr

#
# You probably want to set the path to include
# nothing but local filesystems.
#
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/sbin
export PATH

M=/usr/local/mon
MONETC=/etc/mon
pidfile=/var/state/mon/mon.pid

name="mon"
rcvar=$name
extra_commands="status debug stop"
status_cmd=mon_status
stop_cmd=mon_stop
debug_cmd=mon_debug

mon_user="netmon"

command="$M/mon"
mon_flags="-c $MONETC/mon.m4 -f -a $M/alert.d -P $pidfile -s $M/mon.d -f"

# regular NetBSD status won't work since it's a script and won't look right
# to the ps tester

mon_status(){
	thepid="$(cat $pidfile)"
	if ps "$thepid" | grep "$M/mon" > /dev/null
	then
		echo "$name is running as pid $thepid."
	else
		echo "$name is not running."
	fi
}

mon_debug(){
	if [ -x $M/mon ]
	then
		su -m $mon_user -c "$M/mon -c $MONETC/mon.cf -d > /tmp/mon.debug 2>&1"
	else
		echo "Cannot execute $M/mon."
	fi
}

mon_stop(){
	thepid="$(cat $pidfile)"
	if kill "$thepid"
	then
		echo "pid $thepid has been killed."
	else
		echo "cannot kill pid $thepid: $?"
	fi
}

load_rc_config $name
run_rc_command "$1"

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic