Xymon Mailing List Archive search

Status Question

5 messages in this thread

list Michael Dingeldey · Sat, 10 Feb 2007 09:21:34 -0800 (PST) ·
Is there any way to query hobbit directly via an external script (separate from hobbit) so that
  I can get the current status of a device and display the status dot on a floor plan (or in this case, a hand-crafted web page with our floor plans as  jpegs)? What would I query? The 
  reason I ask is that there is other information that I might want to monitor besides the connectivity status of the device.
   
  At this point I am looking for any suggestions as to the best way for doing this. If possible,
  I would like to have this process separate from hobbit - but I completely understand if I need
  to have the script run by hobbit.
   
  Has anyone done this, or should I not even consider this? Any and all thoughts are welcome.
   
  TIA!


Mike Dingeldey 

Like Jimmy says:  If we weren't all crazy, we'd all go insane....
list Richard Leyton · Sat, 10 Feb 2007 18:00:37 +0000 ·
Hi Mike,

If you want to query the status of a test/host, you need to use the  'hobbitdboard' command to bb to pull back the status. There are a  bunch of other operations that might be useful. See the bb(1) manpage.

An example (see below) I have is for a particular host ('reports'),  we need to clear out the purples every week (as the 'service' is the  name of the report, and these can vary). As I don't care beyond a day  or two about old reports. So the first part does what you want -  pulls back the status for the host. The second remainder just pulls  out the bits I want and wraps it around to drop the host.

There's no security, server side, with hobbit, so this can be run by  any user on any system, so long as the IP details are correct. Note  I've two servers here. If you've just one server you can just specify  the IP address on the command line.

Hope that helps or gives you something to start with.

Richard.
#!/bin/bash

export BBDISPLAYS="127.0.0.1 192.168.50.13"

~hobbit/client/bin/bb  0.0.0.0 "hobbitdboard host=reports"|grep  purple|awk -F\| '{print $2}'|xargs -i ~/client/bin/bb 0.0.0.0 'drop  reports {}'

--
Richard Leyton - user-787ca786c598@xymon.invalid
http://www.leyton.org
quoted from Michael Dingeldey


On 10 Feb 2007, at 17:21, Michael Dingeldey wrote:
Is there any way to query hobbit directly via an external script  (separate from hobbit) so that
I can get the current status of a device and display the status dot  on a floor plan (or in this case, a hand-crafted web page with our  floor plans as  jpegs)? What would I query? The
reason I ask is that there is other information that I might want  to monitor besides the connectivity status of the device.

At this point I am looking for any suggestions as to the best way  for doing this. If possible,
I would like to have this process separate from hobbit - but I  completely understand if I need
to have the script run by hobbit.

Has anyone done this, or should I not even consider this? Any and  all thoughts are welcome.

TIA!


Mike Dingeldey

Like Jimmy says:  If we weren't all crazy, we'd all go insane....
list Henrik Størner · Sat, 10 Feb 2007 19:29:41 +0100 ·
quoted from Michael Dingeldey
On Sat, Feb 10, 2007 at 09:21:34AM -0800, Michael Dingeldey wrote:
Is there any way to query hobbit directly via an external script (separate from hobbit) so that
I can get the current status of a device and display the status dot on a floor plan (or in this 
case, a hand-crafted web page with our floor plans as  jpegs)? 
Before re-inventing the wheel, you may want to check out the BBMap
utility available on the Big Brother add-ons site, http://deadcat.net/ .
I believe it can do this for you. Even though it's on the Big Brother
site, it should be compatible with Hobbit (it was originally written for
the bbgen toolkit, which over time evolved into Hobbit).
quoted from Richard Leyton

What would I query? The reason I ask is that there is other information that I might want to monitor 
besides the connectivity status of the device.
There are several commands you can send to the Hobbit daemon to retrieve 
the current value of one or more statuses.

   bb 127.0.0.1 "hobbitdboard"
retrieves the list of all statuses. You can add a filter and a set of
fields you want to retrieve, e.g. to get the hostnames of all "http" tests that 
are red you can do
   bb 127.0.0.1 "hobbitdboard test=http color=red fields=hostname"


Another command is
   bb 127.0.0.1 "hobbitdlog host=HOSTNAME test=TESTNAME"
retrieves the full status message of a single test.

If convenient, there are also "hobbitdxboard" and "hobbitdxlog" commands
that return this in an XML format.


Finally, there's a "query" command:
   bb 127.0.0.1 "query HOSTNAME.TESTNAME"
This returns the first line of the status, with the color as the first
word.


Regards,
Henrik
list Mike Dingeldey · Sat, 10 Feb 2007 13:50:49 -0500 ·
Thanks Richard. I'm still trying to determine what I *really* want to do.
Thanks for the help with my random thought.

----- Original Message ----- From: "Richard Leyton" <user-787ca786c598@xymon.invalid>
To: <user-ae9b8668bcde@xymon.invalid>
Sent: Saturday, February 10, 2007 1:00 PM
Subject: Re: [hobbit] Status Question
quoted from Richard Leyton

Hi Mike,

If you want to query the status of a test/host, you need to use the  'hobbitdboard' command to bb to pull back the status. There are a  bunch of other operations that might be useful. See the bb(1) manpage.

An example (see below) I have is for a particular host ('reports'),  we need to clear out the purples every week (as the 'service' is the  name of the report, and these can vary). As I don't care beyond a day  or two about old reports. So the first part does what you want -  pulls back the status for the host. The second remainder just pulls  out the bits I want and wraps it around to drop the host.

There's no security, server side, with hobbit, so this can be run by  any user on any system, so long as the IP details are correct. Note  I've two servers here. If you've just one server you can just specify  the IP address on the command line.

Hope that helps or gives you something to start with.

Richard.
#!/bin/bash

export BBDISPLAYS="127.0.0.1 192.168.50.13"

~hobbit/client/bin/bb  0.0.0.0 "hobbitdboard host=reports"|grep  purple|awk -F\| '{print $2}'|xargs -i ~/client/bin/bb 0.0.0.0 'drop  reports {}'

--
Richard Leyton - user-787ca786c598@xymon.invalid
http://www.leyton.org


On 10 Feb 2007, at 17:21, Michael Dingeldey wrote:
Is there any way to query hobbit directly via an external script  (separate from hobbit) so that
I can get the current status of a device and display the status dot  on a floor plan (or in this case, a hand-crafted web page with our  floor plans as  jpegs)? What would I query? The
reason I ask is that there is other information that I might want  to monitor besides the connectivity status of the device.

At this point I am looking for any suggestions as to the best way  for doing this. If possible,
I would like to have this process separate from hobbit - but I  completely understand if I need
to have the script run by hobbit.

Has anyone done this, or should I not even consider this? Any and  all thoughts are welcome.

TIA!


Mike Dingeldey

Like Jimmy says:  If we weren't all crazy, we'd all go insane....
list Mike Dingeldey · Sat, 10 Feb 2007 13:56:29 -0500 ·
Wow. Thanks Henrik!
From what you and Richard have said, it looks like I'll be a bit busy.

I will let you know how this turns out - now all I need to do is find time
to implement it!  I have a feeling that this is only the tip of the 
iceberg.....
quoted from Henrik Størner


----- Original Message ----- 
From: "Henrik Stoerner" <user-ce4a2c883f75@xymon.invalid>
To: <user-ae9b8668bcde@xymon.invalid>
Sent: Saturday, February 10, 2007 1:29 PM
Subject: Re: [hobbit] Status Question

On Sat, Feb 10, 2007 at 09:21:34AM -0800, Michael Dingeldey wrote:
Is there any way to query hobbit directly via an external script 
(separate from hobbit) so that
I can get the current status of a device and display the status dot on a 
floor plan (or in this
case, a hand-crafted web page with our floor plans as  jpegs)?
Before re-inventing the wheel, you may want to check out the BBMap
utility available on the Big Brother add-ons site, http://deadcat.net/ .
I believe it can do this for you. Even though it's on the Big Brother
site, it should be compatible with Hobbit (it was originally written for
the bbgen toolkit, which over time evolved into Hobbit).

What would I query? The reason I ask is that there is other information 
that I might want to monitor
besides the connectivity status of the device.
There are several commands you can send to the Hobbit daemon to retrieve
the current value of one or more statuses.

  bb 127.0.0.1 "hobbitdboard"
retrieves the list of all statuses. You can add a filter and a set of
fields you want to retrieve, e.g. to get the hostnames of all "http" tests 
that
are red you can do
  bb 127.0.0.1 "hobbitdboard test=http color=red fields=hostname"


Another command is
  bb 127.0.0.1 "hobbitdlog host=HOSTNAME test=TESTNAME"
retrieves the full status message of a single test.

If convenient, there are also "hobbitdxboard" and "hobbitdxlog" commands
that return this in an XML format.


Finally, there's a "query" command:
  bb 127.0.0.1 "query HOSTNAME.TESTNAME"
This returns the first line of the status, with the color as the first
word.


Regards,
Henrik