Xymon Mailing List Archive search

Ext tests/scripts

10 messages in this thread

list Kevin Hanrahan · Mon, 14 Feb 2005 16:15:00 -0500 ·
We have several custom tests we use from our BB server to check
applications. In BB it was possible to add these into the /ext directory and
then call them from /etc/bb-bbexttab. Is there a provision for this type of
thing in Hobbit?


Note:  The information contained in this email and in any attachments is
intended only for the person or entity to which it is addressed and may
contain confidential and/or privileged material.  Any review,
retransmission, dissemination or other use of, or taking of any action in
reliance upon, this information by persons or entities other than the
intended recipient is prohibited.  The recipient should check this email and
any attachments for the presence of viruses.  Sender accepts no liability
for any damages caused by any virus transmitted by this email. If you have
received this email in error, please notify us immediately by replying to
the message and delete the email from your computer.  This e-mail is and any
response to it will be unencrypted and, therefore, potentially unsecure.
Thank you.  NOVA Information Systems, Inc.
list Henrik Størner · Mon, 14 Feb 2005 22:59:19 +0100 ·
quoted from Kevin Hanrahan
On Mon, Feb 14, 2005 at 04:15:00PM -0500, user-fd47fec4b039@xymon.invalid wrote:
We have several custom tests we use from our BB server to check
applications. In BB it was possible to add these into the /ext directory and
then call them from /etc/bb-bbexttab. Is there a provision for this type of
thing in Hobbit?
Set them up as tasks in hobbitlaunch.cfg .

NB: The environment variables provided by Hobbit to a script is not 
quite the same as that which BB provides. Some BB extensions use
environment variables for some commands, e.g $GREP instead of grep.
Hobbit does not set this up by default, so you should check what 
your scripts expect, and if necessary add the extra environment
variables to hobbitserver.cfg (or change the script).


Henrik
list Adam Goryachev · Tue, 15 Feb 2005 09:32:02 +1100 ·
quoted from Henrik Størner
On Mon, 2005-02-14 at 22:59 +0100, Henrik Stoerner wrote:
On Mon, Feb 14, 2005 at 04:15:00PM -0500, user-fd47fec4b039@xymon.invalid wrote:
We have several custom tests we use from our BB server to check
applications. In BB it was possible to add these into the /ext directory and
then call them from /etc/bb-bbexttab. Is there a provision for this type of
thing in Hobbit?
Set them up as tasks in hobbitlaunch.cfg .

NB: The environment variables provided by Hobbit to a script is not 
quite the same as that which BB provides. Some BB extensions use
environment variables for some commands, e.g $GREP instead of grep.
Hobbit does not set this up by default, so you should check what 
your scripts expect, and if necessary add the extra environment
variables to hobbitserver.cfg (or change the script).
Just wondering if there is a reason for this?

Personally, whenever writing ext scripts, I always made an effort to
call all the various utilities like sed/grep/etc as ${SED}/${GREP}/etc.
This, I figured saved everyone from editing the ext script for each
platform they needed to run it on (assuming it is either being shared on
deadcat, or else being used across multiple OS's.... Even different
releases of linux use different paths.

It would seem a shame to need to make all these scripts *more*
specific...

PS, I haven't yet had a chance to install hobbit, so perhaps I am
missing something really obvious... It sounds great, and once it is
released, I'm sure I will install and use it.

Regards,
Adam

-- 
 -- 
Adam Goryachev
Website Managers
Ph:  +XX X XXXX XXXX                        user-eaec2ffb4cbc@xymon.invalid
Fax: +XX X XXXX XXXX                        www.websitemanagers.com.au
list Asif Iqbal · Mon, 14 Feb 2005 17:47:18 -0500 ·
quoted from Adam Goryachev
On Tue, Feb 15, 2005 at 09:32:02AM, Adam Goryachev wrote:
On Mon, 2005-02-14 at 22:59 +0100, Henrik Stoerner wrote:
On Mon, Feb 14, 2005 at 04:15:00PM -0500, user-fd47fec4b039@xymon.invalid wrote:
We have several custom tests we use from our BB server to check
applications. In BB it was possible to add these into the /ext directory and
then call them from /etc/bb-bbexttab. Is there a provision for this type of
thing in Hobbit?
Set them up as tasks in hobbitlaunch.cfg .

NB: The environment variables provided by Hobbit to a script is not 
quite the same as that which BB provides. Some BB extensions use
environment variables for some commands, e.g $GREP instead of grep.
Hobbit does not set this up by default, so you should check what 
your scripts expect, and if necessary add the extra environment
variables to hobbitserver.cfg (or change the script).
Just wondering if there is a reason for this?

Personally, whenever writing ext scripts, I always made an effort to
call all the various utilities like sed/grep/etc as ${SED}/${GREP}/etc.
This, I figured saved everyone from editing the ext script for each
I would assume it would be owner's responsibility to make their script,
be it shell/perl or something else, as portable as possible. Assuming,
you rather depend on the environment for your script to work, switching
from BB environment to HOBBIT environment you get a lot more performance
and flexibility gain compare to the lose of enviroment variables.

Such a small loss for such a huge gain, you do the math. Now if you
still want your scripts to work just follow what Henrik said and add
those variables to hobbitserver.cfg file.

Thanks
quoted from Adam Goryachev
platform they needed to run it on (assuming it is either being shared on
deadcat, or else being used across multiple OS's.... Even different
releases of linux use different paths.

It would seem a shame to need to make all these scripts *more*
specific...

PS, I haven't yet had a chance to install hobbit, so perhaps I am
missing something really obvious... It sounds great, and once it is
released, I'm sure I will install and use it.

Regards,
Adam

-- 
 -- 
Adam Goryachev
Website Managers
Ph:  +XX X XXXX XXXX                        user-eaec2ffb4cbc@xymon.invalid
Fax: +XX X XXXX XXXX                        www.websitemanagers.com.au

-- 

Asif Iqbal
PGP Key: 0xE62693C5 KeyServer: pgp.mit.edu
"...it said: Install Windows XP or better...so I installed Solaris..."
list Henrik Størner · Tue, 15 Feb 2005 00:09:16 +0100 ·
quoted from Adam Goryachev
On Tue, Feb 15, 2005 at 09:32:02AM +1100, Adam Goryachev wrote:
On Mon, 2005-02-14 at 22:59 +0100, Henrik Stoerner wrote:
NB: The environment variables provided by Hobbit to a script is not 
quite the same as that which BB provides. Some BB extensions use
environment variables for some commands, e.g $GREP instead of grep.
Hobbit does not set this up by default, so you should check what 
your scripts expect, and if necessary add the extra environment
variables to hobbitserver.cfg (or change the script).
Just wondering if there is a reason for this?
Sure is.

Finding the commands to go with those environment variables is tricky,
since some implementations hide the useful ones in odd
places. E.g. have you ever tried getting the wrong "id" command on
Solaris ? The useful one is /usr/xpg4/bin/id, not /bin/id (which
doesn't know about all those options I take for granted because I'm
spoilt by GNU software).

Just an example ... don't get me started on /usr/ccs/bin or
/usr/ucb/bin or the horrors in /opt :-(

Since Hobbit doesn't use those commands *at all* - the only shell
scripts in Hobbit are the wrappers to set up environments for the CGI
scripts - it would be a lot of effort with no benefit to Hobbit.

And really, most of the BB extensions really are client-side scripts.
They'll run just fine as extensions to the BB client. Hobbit is a
server-side replacement (yes, I know there are thoughts and plans and
even some code for a Hobbit client, but that's some time into the
future), so the number of scripts that are bitten by this is fairly
small, I think.
quoted from Asif Iqbal
It would seem a shame to need to make all these scripts *more*
specific...
Just add the needed ones to hobbitserver.cfg - it might be as simple
as 

  SED=sed
  GREP=grep
  AWK=awk
  CAT=cat
  TR=tr

to make them work and just use whatever is in the PATH.


Regards,
Henrik
list Adam Goryachev · Tue, 15 Feb 2005 10:44:37 +1100 ·
quoted from Henrik Størner
On Tue, 2005-02-15 at 00:09 +0100, Henrik Stoerner wrote:
On Tue, Feb 15, 2005 at 09:32:02AM +1100, Adam Goryachev wrote:
On Mon, 2005-02-14 at 22:59 +0100, Henrik Stoerner wrote:
NB: The environment variables provided by Hobbit to a script is not 
quite the same as that which BB provides. Some BB extensions use
environment variables for some commands, e.g $GREP instead of grep.
Hobbit does not set this up by default, so you should check what 
your scripts expect, and if necessary add the extra environment
variables to hobbitserver.cfg (or change the script).
Just wondering if there is a reason for this?
Sure is.

Finding the commands to go with those environment variables is tricky,
since some implementations hide the useful ones in odd
places. E.g. have you ever tried getting the wrong "id" command on
Solaris ? The useful one is /usr/xpg4/bin/id, not /bin/id (which
doesn't know about all those options I take for granted because I'm
spoilt by GNU software).
Yes, going from Linux to solaris was..... fun <?> same for linux ->
*BSD, though maybe not so bad. I very much missed by GNU software :)
quoted from Henrik Størner
Just an example ... don't get me started on /usr/ccs/bin or
/usr/ucb/bin or the horrors in /opt :-(
Yep....
quoted from Henrik Størner
Since Hobbit doesn't use those commands *at all* - the only shell
scripts in Hobbit are the wrappers to set up environments for the CGI
scripts - it would be a lot of effort with no benefit to Hobbit.
Yep, I begin to see...
quoted from Henrik Størner
And really, most of the BB extensions really are client-side scripts.
They'll run just fine as extensions to the BB client. Hobbit is a
server-side replacement (yes, I know there are thoughts and plans and
even some code for a Hobbit client, but that's some time into the
future), so the number of scripts that are bitten by this is fairly
small, I think.
This I suppose is the real reason.... ie, it doesn't matter *most* of
the time....
quoted from Henrik Størner
It would seem a shame to need to make all these scripts *more*
specific...
Just add the needed ones to hobbitserver.cfg - it might be as simple
as 

  SED=sed
  GREP=grep
  AWK=awk
  CAT=cat
  TR=tr

to make them work and just use whatever is in the PATH.
Are these defined once for all ext scripts, or once for each ext script?
Can they be sourced (. /foo.bar)?
It would be interesting if we could take these file location definitions
from BB, but maybe even that small amount of data is copyright/license
infringing/something...

Perhaps all those ext scripts I wrote should start with something like:
if [ ! -x ${GREP} ]
then
	if [ ! -x grep ]
	then
		COLOR=red
		LINE="grep binary not found and env variable GREP not executable
(${GREP})"
	else
		GREP=grep
	fi
fi

or something similar....

Mostly, as you said, this will affect the clients more.... so, for now,
I will just keep quiet.
quoted from Asif Iqbal

Regards,
Adam

-- 
 -- 
Adam Goryachev
Website Managers
Ph:  +XX X XXXX XXXX                        user-eaec2ffb4cbc@xymon.invalid
Fax: +XX X XXXX XXXX                        www.websitemanagers.com.au
list Henrik Størner · Tue, 15 Feb 2005 07:57:28 +0100 ·
quoted from Adam Goryachev
On Tue, Feb 15, 2005 at 10:44:37AM +1100, Adam Goryachev wrote:
On Tue, 2005-02-15 at 00:09 +0100, Henrik Stoerner wrote:
Just add the needed ones to hobbitserver.cfg - it might be as simple
as 

  SED=sed
  GREP=grep
  AWK=awk
  CAT=cat
  TR=tr

to make them work and just use whatever is in the PATH.
Are these defined once for all ext scripts, or once for each ext script?
Can they be sourced (. /foo.bar)?
Hobbit has a "master program" called "hobbitlaunch" which takes care
of running the various tasks at scheduled intervals. It also sets up
all of the environment variables defined in the configuration file
hobbitserver.cfg - bbgen (which is part of Hobbit) still uses quite a
few. So if we decide to add these command variables to the setup, then
the scripts can generally assume that they are defined.

I did actually try running the standard BB client from hobbitlaunch,
i.e. without any of the setup that is normally done by bbdef.sh and
friends. There were about 75 variables that had to be defined.
quoted from Adam Goryachev

Mostly, as you said, this will affect the clients more.... so, for now,
I will just keep quiet.
Please don't, I do appreciate your input. I have my own ideas about
how to use Hobbit, but there's an immense body of experience in the BB
community that Hobbit can benefit from. If this project is going to
succeed, then I need all of the bright ideas I can get - so the
feedback here is essential.


Regards,
Henrik
list Craig Cook · Tue, 15 Feb 2005 09:25:35 -0500 ·
I'd like to throw in a vote for platform specific definitions as well.

As the maintainer of over 40 scripts, it is a nice feature in BB to allow me to rely on pre defined
variables so I don't need to work out which grep I need to use, and be fairly confident a variable will be available.

Personally, I don't like to rely on what my path will return, it is challenging to keep path statements consistent.
For security reasons, I always call binaries with the full path if I can.  (Some systems may have /usr/local/bin first, others don't).

I'm okay with hobbit not defining $GREP and friends out of the box, but the ability to do it for each platform would be very nice.

I've been bitten by the stupid default binaries on Solaris as well.  Some of us do not have the ability to easily add software to systems (company policies, change control, laws, etc).

Most of my shell scripts check for pre defined variables, if not set, it defines what it thinks it should use and posts a yellow warning complaining about it.

One of the great features of hobbit is the ability to use any BB deadcat script...

I agree this is mainly a client side issue, but something to keep in mind... ;)


Craig

ps. I agree with the knowledge thought, it looks like hobbit will attract some talented followers!
--
Big Brother Consulting and Training Services
www.cookitservices.com
list David Gore · Tue, 15 Feb 2005 20:48:14 +0000 ·
To get all my server side 'ext' scripts to work consistently, all I did was copy bbdef.sh and bbsys.sh to Hobbit and added the same few lines to each 'ext' script.  Something like:

if [ -f $MY_BBDEF ]; then
  . $MY_BBDEF
else
  echo "Need $MY_BBDEF to run!"
  exit 1
fi

I made a few edits to bbdef.sh and bbdef.sh calls bbsys.sh, problem solved.  Took about 5 minutes.  bbsys.sh has all those binaries you are looking for. 
~David
quoted from Craig Cook

Craig Cook wrote:
I'd like to throw in a vote for platform specific definitions as well.

As the maintainer of over 40 scripts, it is a nice feature in BB to allow me to rely on pre defined
variables so I don't need to work out which grep I need to use, and be fairly confident a variable will be available.

Personally, I don't like to rely on what my path will return, it is challenging to keep path statements consistent.
For security reasons, I always call binaries with the full path if I can.  (Some systems may have /usr/local/bin first, others don't).

I'm okay with hobbit not defining $GREP and friends out of the box, but the ability to do it for each platform would be very nice.

I've been bitten by the stupid default binaries on Solaris as well.  Some of us do not have the ability to easily add software to systems (company policies, change control, laws, etc).

Most of my shell scripts check for pre defined variables, if not set, it defines what it thinks it should use and posts a yellow warning complaining about it.

One of the great features of hobbit is the ability to use any BB deadcat script...

I agree this is mainly a client side issue, but something to keep in mind... ;)


Craig

ps. I agree with the knowledge thought, it looks like hobbit will attract some talented followers!
--
Big Brother Consulting and Training Services
www.cookitservices.com

list Henrik Størner · Wed, 16 Feb 2005 11:52:02 +0100 ·
quoted from Craig Cook
On Tue, Feb 15, 2005 at 09:25:35AM -0500, Craig Cook wrote:
I'd like to throw in a vote for platform specific definitions as
well.
[snip]
One of the great features of hobbit is the ability to use any BB deadcat 
script...
OK, I give in :-)

I posted a script this morning that sniffs out the settings commonly
used by BB scripts - SED, GREP, AWK, CUT and so on - and I'll include
that in the default setup so hobbitserver.cfg provides these to all
scripts. 
quoted from David Gore
ps. I agree with the knowledge thought, it looks like hobbit will
attract some talented followers!
Yes, this will be fun.


Regards,
Henrik