Xymon Mailing List Archive search

Using ssh to retrieve hobbit data

list Ralph Mitchell
Wed, 4 Jan 2006 06:11:12 -0600
Message-Id: <user-2dff7aff9ec5@xymon.invalid>

On 1/4/06, Henrik Stoerner <user-ce4a2c883f75@xymon.invalid> wrote:
   [snip]

This is a rough solution. It doesn't deal with scp taking a loooooong
time to login or timeout if your client is down; it doesn't delete the
client-side status message, so if you client stops running you won't
notice it going purple. But it should give you an idea of how it can
be done, and it would work for the common case.
bb-fetch.sh doesn't delete the client-side status message either.  It
keeps the old copy and diffs the new copy against it.  If there's no
difference, the client-side isn't updating.  So, your rough solution
would become something along the lines of:

         # Save the old statusfile and get the new one
        mv $HOSTNAME.$MSGFILE $HOSTNAME.$MSGFILE.old
        scp hobbit@$HOSTNAME:client/tmp/msg.txt $HOSTNAME.$MSGFILE
        if [ -f $HOSTNAME.$MSGFILE.old ]; then
            changed=`$DIFF $HOSTNAME.$MSGFILE $HOSTNAME.$MSGFILE.old`
        else
            changed="new"
        fi

        if [ "$changed" = "" ]; then
             # report that the client isn't updating
        fi

Perhaps scp options ConnectionAttempts & ConnectTimeout would help
deal with the long login timeout??

Ralph Mitchell