[hobbit] Using ssh to retrieve hobbit data
henrik at hswn.dk
Wed Jan 4 12:15:56 CET 2006
On Tue, Jan 03, 2006 at 02:37:15PM -0500, James B Horwath wrote:
> I am converting my BB 19.c system to Hobbit 4.1.2p1. With BB I used to
> use ssh to fetch data from remote servers in a DMZ (using the
> bb-fetchtab). Can I do this in Hobbit. I have searched the mail archive
> and manuals and didn't see the option anywhere.
I haven't done this, but off the top of my head it could be done like
1) Install the Hobbit client on the servers you monitor.
Near the bottom of the clients' ~hobbit/client/bin/hobbitclient.sh
you'll see this bit of code:
if test "$LOCALMODE" = "yes"; then
echo "@@" >> $TEMPFILE
$BBHOME/bin/hobbitd_client --local --config=$BBHOME/etc/localclient.cfg <$TEMPFILE
$BB $BBDISP "@" < $TEMPFILE
Which is what takes care of sending the client status to Hobbit.
Just comment out those lines, or delete them ... this will simply
make the client put the status message in client/tmp/msg.txt .
2) On the Hobbit server, run a script to fetch the client status files.
You can run it as a Hobbit server extension script (add it to
hobbitlaunch.cfg); it would go something like this:
bbhostgrep fetchdata | \
while read L; do
# Delete the old statusfile and get the new one
rm -f $MSGFILE
scp hobbit@$HOSTNAME:client/tmp/msg.txt $MSGFILE
if test -f $MSGFILE; then
# Got a statusfile, send it to Hobbit
$BB $BBDISP "@" < $MSGFILE
This uses the bbhostgrep command to pick out those hosts that have a
"fetchdata" in their bb-hosts entry. It then scp's the client status
file over to the Hobbit server, and runs the normal "bb" command to
feed the client status report into the Hobbit server.
You will of course need to arrange for ssh to login to each of the
clients without requiring a password, but you probably already did
that with bb-fetch.
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.
More information about the Xymon