BB Unix Network Monitor - Message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: {bb} External Scripts in BB



On Thu, 2005-07-07 at 21:27, Cole, Michael - MLMC Toronto wrote:
> Hello Brothers,
> 
> I have set up a bunch of new tests for big brother and I thought I had
> taken of all the details but I must be missing something and all my
> reading of the BB manual (section 3.7) is not helping much.
> 
> The scripts are for environmental monitors that we have established
> throughout our office. For example, tor-office-temp~temp looks something
> like this:

Is that the filename? You should avoid using the tilde (~) character.
Filename expansion wants to replace that with a home directory and it
could lead to all sorts of weirdness.

> BBPROG=temperature.sh
> TEST="temperature"
> jsname="-t"
>  if [ $ObservedTemp -lt $CriticalLow ] ; then
>   COLOR="red"
> elif [ $ObservedTemp -lt $WarnLow ] ; then
>   COLOR="yellow"
> elif [ $ObservedTemp -lt $WarnHigh ] ; then
>   COLOR="green"
> elif [ $ObservedTemp -lt $CriticalHigh ] ; then
>   COLOR="yellow"
> else
>   COLOR="red"
> fi
> export BBPROG
> HTMLOUT="<P align=center> <b>Environmental Conditions</b>"
> JSName=$MN$DOMAIN~$jsname.js
> HTMLOUT="$HTMLOUT <script language=\"JavaScript\" src=\"../$JSName\">"
> HTMLOUT="$HTMLOUT</script> </P>"
> LINE="status tor-cr-temp,domain,tld.$TEST $COLOR `date +%c`
> $HTMLOUT"
> $BB $BBDISP "$LINE"
> 
> I removed a lot of the initialization and the like to improve
> readability, but this is a pretty good summary of one of my scripts.

As long as your initialization is loading the BB environment correctly,
I can't see any obvious problems. I have reservations about including
javascript within the report, however, and it would probably be better
to remove that until you're confident how the script is working.

> To summarize my script, if I add the following:
> LINE="status $MACHINE.$TEST $COLOR `date +%c`
> $HTMLOUT"
> echo XXXXXXXXXXXXXXXXXXXXXX
> echo LINE:
> echo $LINE
> echo XXXXXXXXXXXXXXXXXXXXXX
> $BB $BBDISP "$LINE"
> 
> I see the following:
> 
> XXXXXXXXXXXXXXXXXXXXXX
> LINE:
> status mlmc-mon,domain,tld.temperature green Thu 07 Jul 2005 04:25:14 PM
> EDT <P align=center> <b>Environmental Conditions</b> <script
> language="JavaScript" src="../tor-cr-temp.mlmc.com~-t.js"></script> </P>
> XXXXXXXXXXXXXXXXXXXXXX

It would be helpful to also echo $BB and $BBDISP too, just to check on
the loading of the environment.

> In the svcerrlist section of bbwarnsetup I have added a token:
> temperature:490
> 
> In my bb-hosts file I have the following entry:
> <IP address>  tor-cr-temp.domain.tld    # tor-cr-temp~temp
> tor-cr-temp~humid

Assuming that the host is just a place-holder for the tests and not
a real computer, the line should look like:

<IP address>  tor-cr-temp.domain.tld  # noconn

Adding directives for your own external script tests does not do
anything unless your script actually parses bb-hosts in order to
discover which machines to run on.

> In my bb-bbexttab I have:
> localhost : : tor-office-temp~temp;300
> localhost : : tor-office-temp~humid;300
> 
> Yet on the BigBrother main page I get my device name,
> tor-cr-temp.domain.tld and a "-" under both the humidity and temperature
> columns, no status indicators. What am I forgetting? Any suggestions
> welcome.

I have two theories. Either processing of bb-bbexttab is being thrown
by the yucky tilde characters in you filenames, or the BB environment
is not being correctly loaded by the script.

> Thanks brothers,
> 
> Michael

Cheers, Phil.



-- 
Character Density, n.: The number of very weird people in the office.

--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=
To unsubscribe from this list, or to subscribe to the bb-digest list
send e-mail to mailto:majordomo@bb4.com with unsubscribe bb -and/or-
subscribe bb-digest in the BODY of the message.


Home | Main Index | Thread Index