[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Feature? svcs
- To: xymon (at) xymon.com
- Subject: Feature? svcs
- From: Vernon Everett <everett.vernon (at) gmail.com>
- Date: Wed, 28 Jul 2010 14:38:27 +0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=ywDwPQa0CA6UF/MVbqvzsKfW4wt+kKvhi161E28AUUE=; b=Inxbw46d4zUfhWZBUeBRtJisB5PoGMR8CAaHBhKarrbW3sM4yqUoFjpdGR4le5LQxu flX6YhkAxoKzxx28Apoef+aNLlzqKkXpdjnAMPA8RwslGw8UJJhJVBldDRyfHYaQWoTg jZxLG7f9teTpKz0s+17gltOPhEaxZOPfs0aPs=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=P9BFJkHJ/f7j/DA5VG4Y2t6qcPuIy1JE4otnr2xayxXTVPydvDiTBxhxgTtiDg2sEq fG6x8XKaECEwHng5R6OoCZvbSay8ALRX12mc/CPeQq69oML6ktS3BmBf2a/vWxyaIjHj JTlXa5IKQHsNrf9HJdJmKQMLkfKzfP+po2oe4=
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