Server side EXT script not running or appearing on web page
list Mark Ashley
Hi,
I'm trying to replace the inbuilt SSH test with one that does something
intelligent and have put this into ~hobbit/server/ext:
hobbit% cat server/ext/NGssh
#!/bin/sh
BBHTAG=NGssh # What we put in bb-hosts to trigger this test
COLUMN=NGssh # Name of the column, often same as tag in bb-hosts
$BBHOME/bin/bbhostgrep $BBHTAG | while read L
do
set $L # To get one line of output from bbhostgrep
HOSTIP="$1"
MACHINEDOTS="$2"
MACHINE=`echo $2 | $SED -e's/\./,/g'`
MSG="$BBHTAG status for host $MACHINEDOTS"
reply = `ssh $MACHINE -l hobbit /usr/ucb/whoami`
if [ "$reply" = "hobbit" ]
COLOR=green
else
COLOR=red
fi
$BB $BBDISP "status $MACHINE.$COLUMN $COLOR `date`
${MSG}
"
done
exit 0
Then the script is added to bb-hosts:
hobbit% grep NGssh ~hobbit/server/etc/bb-hosts
group-only conn|cpu|disk|info|memory|msgs|procs|NGssh|trends Campus
123.123.5.52 hostert # noping NGssh
123.123.1.12 hostick # noping NGssh
123.123.16.9 hostker # noping NGssh
123.123.3.11 hostel # noping NGssh
123.123.8.8 hostay # noping NGssh
123.123.5.49 hostmis # noping NGssh
123.123.3.17 hosteus # noping NGssh
123.123.1.11 hosty # noping NGssh
123.123.9.13 hostger # noping NGssh
What else needs to be done to action this script?
The script doesn't seem to be running and nothing is appearing in a
column. Scripts from the deadcat site mention a BBEXT variable but
it's not in any of the hobbit config files.
Thanks,
Mark
user-fe6952e72a18@xymon.invalid
list Dan Vande More
You shouldn't add external tests to bb-hosts. You add them to etc/bb-bbexttab. -Dan $ head -30 etc/bb-bbexttab # bb-bbexttab: configuration file for launching external scripts # # Format: # # host: misc settings : external scripts list # localhost: misc settings : external scripts list # : misc settings : external scripts list # # host can be FQDN (fully qualified domain name) or # just a plain hostname but it is preferred that you # use a FQDN. # localhost: using this specifies that the scripts # specified on the line are to be launched on all clients # # The same host can be specified on multiple lines to aid readability # # Misc settings field is unimplemented ... # For future use... # # You can override the default sleep between cycles # by addding a time qualifier to the script: # e.g.: localhost: script1;600 # **NOTE** The sleep delimiter in BBEXT of bbdef.sh was # ':' (script1:600) but here it is ';' # in order to keep the same format as the # other bb-*tab files (the : is used to delimit # file entry fields in all bb-*tab files) . # The time qualifier is specified in SECONDS
▸
#
On 1/2/06, Mark Ashley <user-fe6952e72a18@xymon.invalid> wrote:Hi,
I'm trying to replace the inbuilt SSH test with one that does something
intelligent and have put this into ~hobbit/server/ext:
hobbit% cat server/ext/NGssh
#!/bin/sh
BBHTAG=NGssh # What we put in bb-hosts to trigger this test
COLUMN=NGssh # Name of the column, often same as tag in bb-hosts
$BBHOME/bin/bbhostgrep $BBHTAG | while read L
do
set $L # To get one line of output from bbhostgrep
HOSTIP="$1"
MACHINEDOTS="$2"
MACHINE=`echo $2 | $SED -e's/\./,/g'`
MSG="$BBHTAG status for host $MACHINEDOTS"
reply = `ssh $MACHINE -l hobbit /usr/ucb/whoami`
if [ "$reply" = "hobbit" ]
COLOR=green
else
COLOR=red
fi
$BB $BBDISP "status $MACHINE.$COLUMN $COLOR `date`
${MSG}
"
done
exit 0
Then the script is added to bb-hosts:
hobbit% grep NGssh ~hobbit/server/etc/bb-hosts
group-only conn|cpu|disk|info|memory|msgs|procs|NGssh|trends Campus
123.123.5.52 hostert # noping NGssh
123.123.1.12 hostick # noping NGssh
123.123.16.9 hostker # noping NGssh
123.123.3.11 hostel # noping NGssh
123.123.8.8 hostay # noping NGssh
123.123.5.49 hostmis # noping NGssh
123.123.3.17 hosteus # noping NGssh
123.123.1.11 hosty # noping NGssh
123.123.9.13 hostger # noping NGssh
What else needs to be done to action this script?
The script doesn't seem to be running and nothing is appearing in a
column. Scripts from the deadcat site mention a BBEXT variable but
it's not in any of the hobbit config files.
Thanks,
Mark
user-fe6952e72a18@xymon.invalid
list Mark Ashley
That file isn't mentioned anywhere in the source code: host:/var/tmp/hobbit-4.1.2p1 root# find . -print | xargs grep -i bbexttab host:/var/tmp/hobbit-4.1.2p1 root#
▸
Dan Vande More wrote:You shouldn't add external tests to bb-hosts. You add them to etc/bb-bbexttab. -Dan $ head -30 etc/bb-bbexttab # bb-bbexttab: configuration file for launching external scripts # # Format: # # host: misc settings : external scripts list # localhost: misc settings : external scripts list # : misc settings : external scripts list # # host can be FQDN (fully qualified domain name) or # just a plain hostname but it is preferred that you # use a FQDN. # localhost: using this specifies that the scripts # specified on the line are to be launched on all clients # # The same host can be specified on multiple lines to aid readability # # Misc settings field is unimplemented ... # For future use... # # You can override the default sleep between cycles # by addding a time qualifier to the script: # e.g.: localhost: script1;600 # **NOTE** The sleep delimiter in BBEXT of bbdef.sh was # ':' (script1:600) but here it is ';' # in order to keep the same format as the # other bb-*tab files (the : is used to delimit # file entry fields in all bb-*tab files) . # The time qualifier is specified in SECONDS # On 1/2/06, Mark Ashley <user-fe6952e72a18@xymon.invalid> wrote:Hi, I'm trying to replace the inbuilt SSH test with one that does something intelligent and have put this into ~hobbit/server/ext: hobbit% cat server/ext/NGssh #!/bin/sh BBHTAG=NGssh # What we put in bb-hosts to trigger this test COLUMN=NGssh # Name of the column, often same as tag in bb-hosts $BBHOME/bin/bbhostgrep $BBHTAG | while read L do set $L # To get one line of output from bbhostgrep HOSTIP="$1" MACHINEDOTS="$2" MACHINE=`echo $2 | $SED -e's/\./,/g'` MSG="$BBHTAG status for host $MACHINEDOTS" reply = `ssh $MACHINE -l hobbit /usr/ucb/whoami` if [ "$reply" = "hobbit" ] COLOR=green else COLOR=red fi $BB $BBDISP "status $MACHINE.$COLUMN $COLOR `date` ${MSG} " done exit 0 Then the script is added to bb-hosts: hobbit% grep NGssh ~hobbit/server/etc/bb-hosts group-only conn|cpu|disk|info|memory|msgs|procs|NGssh|trends Campus 123.123.5.52 hostert # noping NGssh 123.123.1.12 hostick # noping NGssh 123.123.16.9 hostker # noping NGssh 123.123.3.11 hostel # noping NGssh 123.123.8.8 hostay # noping NGssh 123.123.5.49 hostmis # noping NGssh 123.123.3.17 hosteus # noping NGssh 123.123.1.11 hosty # noping NGssh 123.123.9.13 hostger # noping NGssh What else needs to be done to action this script? The script doesn't seem to be running and nothing is appearing in a column. Scripts from the deadcat site mention a BBEXT variable but it's not in any of the hobbit config files. Thanks, Mark user-fe6952e72a18@xymon.invalid
list Dan Vande More
Oh geez, my fault, I'm sorry. I'm still using the bb client:) Here ya go: http://hobbitmon.sourceforge.net/docs/hobbit-tips.html#scripts
▸
On 1/2/06, Mark Ashley <user-fe6952e72a18@xymon.invalid> wrote:That file isn't mentioned anywhere in the source code: host:/var/tmp/hobbit-4.1.2p1 root# find . -print | xargs grep -i bbexttab host:/var/tmp/hobbit-4.1.2p1 root# Dan Vande More wrote:You shouldn't add external tests to bb-hosts. You add them to etc/bb-bbexttab. -Dan $ head -30 etc/bb-bbexttab # bb-bbexttab: configuration file for launching external scripts # # Format: # # host: misc settings : external scripts list # localhost: misc settings : external scripts list # : misc settings : external scripts list # # host can be FQDN (fully qualified domain name) or # just a plain hostname but it is preferred that you # use a FQDN. # localhost: using this specifies that the scripts # specified on the line are to be launched on all clients # # The same host can be specified on multiple lines to aid readability # # Misc settings field is unimplemented ... # For future use... # # You can override the default sleep between cycles # by addding a time qualifier to the script: # e.g.: localhost: script1;600 # **NOTE** The sleep delimiter in BBEXT of bbdef.sh was # ':' (script1:600) but here it is ';' # in order to keep the same format as the # other bb-*tab files (the : is used to delimit # file entry fields in all bb-*tab files) . # The time qualifier is specified in SECONDS # On 1/2/06, Mark Ashley <user-fe6952e72a18@xymon.invalid> wrote:Hi, I'm trying to replace the inbuilt SSH test with one that does something intelligent and have put this into ~hobbit/server/ext: hobbit% cat server/ext/NGssh #!/bin/sh BBHTAG=NGssh # What we put in bb-hosts to trigger this test COLUMN=NGssh # Name of the column, often same as tag in bb-hosts $BBHOME/bin/bbhostgrep $BBHTAG | while read L do set $L # To get one line of output from bbhostgrep HOSTIP="$1" MACHINEDOTS="$2" MACHINE=`echo $2 | $SED -e's/\./,/g'` MSG="$BBHTAG status for host $MACHINEDOTS" reply = `ssh $MACHINE -l hobbit /usr/ucb/whoami` if [ "$reply" = "hobbit" ] COLOR=green else COLOR=red fi $BB $BBDISP "status $MACHINE.$COLUMN $COLOR `date` ${MSG} " done exit 0 Then the script is added to bb-hosts: hobbit% grep NGssh ~hobbit/server/etc/bb-hosts group-only conn|cpu|disk|info|memory|msgs|procs|NGssh|trends Campus 123.123.5.52 hostert # noping NGssh 123.123.1.12 hostick # noping NGssh 123.123.16.9 hostker # noping NGssh 123.123.3.11 hostel # noping NGssh 123.123.8.8 hostay # noping NGssh 123.123.5.49 hostmis # noping NGssh 123.123.3.17 hosteus # noping NGssh 123.123.1.11 hosty # noping NGssh 123.123.9.13 hostger # noping NGssh What else needs to be done to action this script? The script doesn't seem to be running and nothing is appearing in a column. Scripts from the deadcat site mention a BBEXT variable but it's not in any of the hobbit config files. Thanks, Mark user-fe6952e72a18@xymon.invalid
list Mark Ashley
http://hobbitmon.sourceforge.net/docs/hobbit-tips.html#scripts
I originally looked at that, I've since concluded it's dodgy documentation
in that it's not specific or complete. The first bit is for client side,
the server-side bit lacks the final steps.
Cheers,
Mark
Here's how to do it:
In ~/server/etc/hobbitlaunch.cfg add:
[NGssh]
ENVFILE /home/hobbit/server/etc/hobbitserver.cfg
NEEDS hobbitd
CMD $BBHOME/ext/NGssh.sh
LOGFILE $BBSERVERLOGS/NGssh.log
INTERVAL 5m
In ~/server/ext/NGssh.sh add:
▸
#!/bin/sh
BBHTAG=NGssh # What we put in bb-hosts to trigger this test
COLUMN=NGssh # Name of the column, often same as tag in bb-hosts
$BBHOME/bin/bbhostgrep $BBHTAG | while read L
do
set $L # To get one line of output from bbhostgrep
HOSTIP="$1"
MACHINEDOTS="$2"
MACHINE=`echo $2 | $SED -e's/\./,/g'`
MSG="$BBHTAG status for host $MACHINEDOTS"
reply=`ssh $MACHINE -l hobbit /usr/ucb/whoami`
if [ "$reply" = "hobbit" ]
then
▸
COLOR=green
else
COLOR=red
fi
$BB $BBDISP "status $MACHINE.$COLUMN $COLOR `date`
${MSG}
"
done
exit 0
In your ~/server/etc/bb-hosts add:
▸
group-only conn|cpu|disk|info|memory|msgs|procs|NGssh|trends Campus
123.123.5.52 hostert # noping NGssh
123.123.1.12 hostick # noping NGssh
123.123.16.9 hostker # noping NGssh
123.123.3.11 hostel # noping NGssh
123.123.8.8 hostay # noping NGssh
123.123.5.49 hostmis # noping NGssh
123.123.3.17 hosteus # noping NGssh
123.123.1.11 hosty # noping NGssh
123.123.9.13 hostger # noping NGssh