[hobbit] XML from Hobbit via url
Galen Johnson
Galen.Johnson at sas.com
Sun May 25 17:57:43 CEST 2008
Henrik,
In testing this script, I noticed that if you enter a non-existant hostname (or test), hobbitdxboard actually returns XML as though you didn't enter any host (or test). I think it would be more helpful if it sent back an "Invalid host/test" message (note this is 4.2 with the AiO patch applied).
=G=
________________________________________
From: Galen Johnson [Galen.Johnson at sas.com]
Sent: Sunday, May 25, 2008 11:33 AM
To: hobbit at hswn.dk
Subject: RE: [hobbit] XML from Hobbit via url
Hey Andrew,
I hacked something together real quick for you...it requires the Hobbit Admin Tools available at The Shire's Addons page (http://www.trantor.org/theshire/doku.php/addons). I need to look into the hobbitdxboard command to fully flesh it out. I may then add it to the tool kit since the original maintainer seems to have disappeared (or at least left/graduated from his university).
Just add the following script to the hobbit cgi-bin folder after adding the toolkit and make it executable:
admintools_xmlreport.sh:
#!/bin/sh
echo "content-type: text/xml"
echo ""
# Change to point to your hobbit server config file
HOBBIT_SERVER_CFG="/usr/local/hobbit/server/etc/hobbitserver.cfg"
ADMINSCRIPTS_FUNCTIONS="/usr/local/hobbit/server/etc/adminscripts_functions.sh"
this_usePerl="false" #if you have perl (Use it when you have Problems with date (e.g. on Solaris))
#############################################
#Init Script
#############################################
#Load Hobbit configuration
. $HOBBIT_SERVER_CFG
. $ADMINSCRIPTS_FUNCTIONS
#Use Requestparameters from GET or Post
if [ "$REQUEST_METHOD" = POST ]; then
read -n $CONTENT_LENGTH query
else
query="$QUERY_STRING"
fi
this_cgiascii "$query"
this_getQuery "$query" "host";HOST_S="$RETURN"
$BBHOME/bin/bb 127.0.0.1 "hobbitdxboard $HOST_S"
exit 0;
=G=
________________________________________
From: Andrew Martin [agmweb at ilovemaths.co.uk]
Sent: Sunday, May 25, 2008 6:27 AM
To: hobbit at hswn.dk
Subject: [hobbit] XML from Hobbit via url
Hi,
This is my first post. I have searched the archives and the web as much as
possible but cant find anything so please point me in the right direction if
this has been covered before.
I'm trying to obtain xml from Hobbit so I can integrate the results into
other web based projects.
I can use the command
bb 127.0.0.1 "hobbitdxboard host=AServer"
within terminal to obtain the xml output below. This is suitable for the
purposes I require.
<?xml version='1.0' encoding='ISO-8859-1'?>
<StatusBoard>
<ServerStatus>
<ServerName>AServer</ServerName>
<Type>perf</Type>
<Status>green</Status>
<TestFlags></TestFlags>
<LastChange>Wed May 21 08:41:07 2008</LastChange>
<LogTime>Sat May 24 11:06:11 2008</LogTime>
<ValidTime>Sat May 24 11:36:11 2008</ValidTime>
<AckTime>N/A</AckTime>
<DisableTime>N/A</DisableTime>
<Sender>xxx.xxx.xxx.xxx</Sender>
<Cookie>N/A</Cookie>
<MessageSummary><![CDATA[status AServer.perf green Sat 24/05/2008
10:50:07]]></MessageSummary>
</ServerStatus>
</StatusBoard>
However, I'd like to obtain this output via a url.
For example,
http://<<hobbitserver>>/hobbit-cgi/bb-xmlreport.sh?HOST=AServer
would return the above xml. The host variable would of course need to be
passed appropriately to hobbitdxboard.
I'm not sure of how to correctly write my bb-xmlreport.sh file, or if im
going about this
the correct way or not.
Any help much appreciated.
Andrew
To unsubscribe from the hobbit list, send an e-mail to
hobbit-unsubscribe at hswn.dk
To unsubscribe from the hobbit list, send an e-mail to
hobbit-unsubscribe at hswn.dk
More information about the Xymon
mailing list