Hi all<br><br>I have noticed, if you run BBWin, you get the svcs column, showing all the services running on the client.<br>And, the server understands this test. I can add entries into hobbit-client.cfg along the lines of <br>
<span style="font-family: courier new,monospace;">HOST=foo</span><br> <span style="font-family: courier new,monospace;">SVC     "SomeService" startup=automatic status=started COLOR=red</span><br>and if the service isn't running it will change to a red status.<br>
<br>I want the same functionality for Solaris services.<br>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.<br>
(It will also only register services in maintenance mode, not disabled services)<br>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)<br>
I even went so far as to massage the output of svcs -aH to look at least similar to the BBWin svcs output.<br><br>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<br>
<span style="font-family: courier new,monospace;">HOST=foo</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">SVC     /system/cron     STATE=online   COLOR=red</span><br>
And have the server bleat if that service isn't online.<br><br>What would that require to make work?<br><br>Regards<br>    Vernon<br><br><br><span style="font-family: courier new,monospace;">#!/bin/ksh</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">TEST="svcs"</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">SVCS=/usr/bin/svcs</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">TEMPFILE=$BBTMP/svcs.tmp</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">COLOUR="green"</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">date > $TEMPFILE</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">echo >> $TEMPFILE</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">$SVCS -x > $TEMPFILE.tmp</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">EXIT=$?</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">if [ $EXIT -eq 0 ]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">then</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">   # Command ran OK</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">   if [ -s $TEMPFILE.tmp ]</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">   then</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">      # It's not empty - bad</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">      COLOUR=red</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">      echo "There are issues with configured services." >> $TEMPFILE</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">      echo "Please investigate" >> $TEMPFILE</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">      echo >> $TEMPFILE</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">   else</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">      # It is empty - All is good.</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">      echo "All services running OK" >> $TEMPFILE</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">      echo >> $TEMPFILE</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">   fi</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">else</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">   # Error running command</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">   COLOUR="yellow"</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">   echo "Error running $SVCS -x " >> $TEMPFILE</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">   echo "Please investigate" >> $TEMPFILE</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">   echo >> $TEMPFILE</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">fi</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">cat $TEMPFILE.tmp >> $TEMPFILE</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">rm $TEMPFILE.tmp</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">$SVCS -a >> $TEMPFILE</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">$BB $BBDISP "status $MACHINE.$TEST $COLOUR `cat $TEMPFILE`"</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">rm $TEMPFILE</span><br style="font-family: courier new,monospace;"><br>