Feature? svcs
Vernon Everett
everett.vernon at gmail.com
Wed Jul 28 08:38:27 CEST 2010
Hi all
I have noticed, if you run BBWin, you get the svcs column, showing all the
services running on the client.
And, the server understands this test. I can add entries into
hobbit-client.cfg along the lines of
HOST=foo
SVC "SomeService" startup=automatic status=started COLOR=red
and if the service isn't running it will change to a red status.
I want the same functionality for Solaris services.
I wrote a very simple test for Solaris services (see below), but of course,
that's a client-side test, and the services to alert on can't be configured
at server side.
(It will also only register services in maintenance mode, not disabled
services)
I thought maybe I could hack the hobbitclient-sunos.sh to send the stuff
under the [svcs] heading, like BBWin does, but that didn't work. (I assume
there is some logic defining what the server expects from each client type)
I even went so far as to massage the output of svcs -aH to look at least
similar to the BBWin svcs output.
I would like to be able to have a Solaris client, sending service info, and
be able to define entries in hobbit-client.cfg similar to this
HOST=foo
SVC /system/cron STATE=online COLOR=red
And have the server bleat if that service isn't online.
What would that require to make work?
Regards
Vernon
#!/bin/ksh
TEST="svcs"
SVCS=/usr/bin/svcs
TEMPFILE=$BBTMP/svcs.tmp
COLOUR="green"
date > $TEMPFILE
echo >> $TEMPFILE
$SVCS -x > $TEMPFILE.tmp
EXIT=$?
if [ $EXIT -eq 0 ]
then
# Command ran OK
if [ -s $TEMPFILE.tmp ]
then
# It's not empty - bad
COLOUR=red
echo "There are issues with configured services." >> $TEMPFILE
echo "Please investigate" >> $TEMPFILE
echo >> $TEMPFILE
else
# It is empty - All is good.
echo "All services running OK" >> $TEMPFILE
echo >> $TEMPFILE
fi
else
# Error running command
COLOUR="yellow"
echo "Error running $SVCS -x " >> $TEMPFILE
echo "Please investigate" >> $TEMPFILE
echo >> $TEMPFILE
fi
cat $TEMPFILE.tmp >> $TEMPFILE
rm $TEMPFILE.tmp
$SVCS -a >> $TEMPFILE
$BB $BBDISP "status $MACHINE.$TEST $COLOUR `cat $TEMPFILE`"
rm $TEMPFILE
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20100728/f9713a36/attachment.html>
More information about the Xymon
mailing list