Xymon Mailing List Archive search

How to send alert via script ?

5 messages in this thread

list Casedj · Wed, 6 Jun 2007 21:07:07 +0800 ·
I put the commands in a script alert.sh and call that script in hobbit-alerts.cfg:

  HOST=my_linux   SERVICE=disk
          SCRIPT alert.sh  my_linux


But still failed, no alert messages sent while disk state went to warning level, color was changed.

alert.sh:

#!/bin/sh
echo "$RCPT disk went to warning state" |smbclient -M cici
echo "$BBHOSTNAME disk reached warning state" |write hobbit

This test script works well in terminal mode.

[hobbit at my_linux etc]$ ../bin/bbcmd hobbitd_alert --test my_linux disk
2007-05-31 06:04:23 Using default environment file /home/hobbit/server/etc/hobbitserver.cfg
00005798 2007-05-31 06:04:23 send_alert my_linux:disk state Paging
00005798 2007-05-31 06:04:23 Matching host:service:page 'my_linux:disk:' against rule line 120
00005798 2007-05-31 06:04:23 *** Match with 'HOST=my_linux   SERVICE=disk' ***
00005798 2007-05-31 06:04:23 Matching host:service:page 'my_linux:disk:' against rule line 120
00005798 2007-05-31 06:04:23 *** Match with 'HOST=my_linux   SERVICE=disk' ***
00005798 2007-05-31 06:04:23 Script alert with command 'alert.sh' and recipient my_linux

The call looked like invalid, any other detail debug mechanism available? 

Thanks again.

Case
list Henrik Størner · Wed, 6 Jun 2007 15:12:17 +0200 ·
quoted from Casedj
On Wed, Jun 06, 2007 at 09:07:07PM +0800, casedj wrote:
I put the commands in a script alert.sh and call that script in hobbit-alerts.cfg:

  HOST=my_linux   SERVICE=disk
          SCRIPT alert.sh  my_linux
You'd better use the full path to the script.


Henrik
list Brian O'Mahony · Wed, 6 Jun 2007 15:17:45 +0100 ·
I have my server as part of the hobbit monitoring pages.

However as this is the only system that it looks for bbgen and
hobbitlaunch, I want to remove these. (one is yellow and one is purple
so I just want to get rid of them)

Also on this server the mysql section is also constant orange, saying
mysql has been restarted recently, when I know for a fact it hasn't. how
do I resolve this? (Or even just remove it altogether)

B


The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this email by anyone else
is unauthorized. If you are not the intended recipient, any disclosure,
copying, distribution or any action taken or omitted to be taken in reliance
on it, is prohibited and may be unlawful. If you are not the intended
addressee please contact the sender and dispose of this e-mail. Thank you.
list Daniel Bourque · Wed, 06 Jun 2007 10:47:58 -0500 ·
you can look at these logs

/var/log/hobbit/notifications.cfg
/var/log/hobbit/page.log

Daniel Bourque
Systems/Network Administrator
Weather Data Inc

Office (XXX) XXX-XXXX
Office (XXX) XXX-XXXX ext. XXXX
Mobile (XXX) XXX-XXXX
quoted from Casedj


casedj wrote:
I put the commands in a script alert.sh and call that script in
hobbit-alerts.cfg:
HOST=my_linux SERVICE=disk
SCRIPT alert.sh my_linux
But still failed, no alert messages sent while disk state went to
warning level, color was changed.

alert.sh:

#!/bin/sh
echo "$RCPT disk went to warning state" |smbclient -M cici
echo "$BBHOSTNAME disk reached warning state" |write hobbit

This test scriptworks well in terminal mode.
quoted from Casedj
[hobbit at my_linux etc]$ ../bin/bbcmd hobbitd_alert --test my_linux disk
2007-05-31 06:04:23 Using default environment file
/home/hobbit/server/etc/hobbitserver.cfg
00005798 2007-05-31 06:04:23 send_alert my_linux:disk state Paging
00005798 2007-05-31 06:04:23 Matching host:service:page
'my_linux:disk:' against rule line 120
00005798 2007-05-31 06:04:23 *** Match with 'HOST=my_linux
SERVICE=disk' ***
00005798 2007-05-31 06:04:23 Matching host:service:page
'my_linux:disk:' against rule line 120
00005798 2007-05-31 06:04:23 *** Match with 'HOST=my_linux
SERVICE=disk' ***
00005798 2007-05-31 06:04:23 Script alert with command 'alert.sh' and
recipient my_linux
The call looked like invalid, any other detail debug mechanism available?
Thanks again.
Case
list Buchan Milne · Wed, 6 Jun 2007 18:53:15 +0200 ·
quoted from Brian O'Mahony
On Wednesday, 6 June 2007, Brian O'Mahony wrote:
I have my server as part of the hobbit monitoring pages.

However as this is the only system that it looks for bbgen and
hobbitlaunch, I want to remove these. (one is yellow and one is purple
so I just want to get rid of them)
If you want to get rid of the yellow, rather address the problems reported on that page (as there is a good reason it is yellow ...).

To get rid of the purple, drop it (see the bb man page), something like:
$ ~hobbit/bin/bb localhost 'drop localhost hobbitlaunch'
quoted from Brian O'Mahony
Also on this server the mysql section is also constant orange, saying
mysql has been restarted recently, when I know for a fact it hasn't. how
do I resolve this? (Or even just remove it altogether)
AFAIK there is no built-in mysql check that does this, so this is probably running as an extension script. The published ones are client-side, meaning there is most likely a script on the host being monitored, which needs fixing (or removal, and subsequent dropping of the check as above). It could be running out of cron, or from clientlaunch.cfg on the client.

However, you may rather want to replace this check with dbcheck.pl from http://sourceforge.net/projects/hobbit-perl-cl/ (which runs server-side and works relatively well).

Regards,
Buchan

-- 
Buchan Milne
ISP Systems Specialist - Monitoring/Authentication Team Leader
B.Eng,RHCE(803004789010797),LPIC-2(LPI000074592)