[Nagios-users] event handler debug

2012-11-27 Thread fatcharly
Hi,

I`m using a nagios 3.0.3 on a CentOS 5.8 and I´m a little stuck with a 
eventhandeler problem- I can`t see it running and I can´t find a problem in the 
logfiles. Here a short overview:

define service{
  use generic-service
  host_name   hostname
  service_description host_hh_prod1_1
  check_command   check_nrpe!hh_prod1_1
  event_handler   hh_prod11_down
  notifications_enabled   1
}


 in commands.cfg is defined:

define command{
command_namehh_prod11_down
command_line
/usr/local/nagios/libexec/eventhandlers/hh_prod1_1_down.sh $HOSTSTATE$ 
$HOSTSTATETYPE$ $HOSTATTEMPT$
}


/usr/local/nagios/libexec/eventhandlers/hh_prod1_1_down.sh :

#/bin/bash
# $1=State $2=Zustandstyp hard oder soft $3= Versuch
case $1 in
OK)
#/usr/local/nagios/libexec/check_nrpe -H 192.168.18.30 -c route_back_1
echo `date`route hh_prod1_1 ok /var/log/ipsecrouting_beth.log
;;
CRITICAL)
if [ $2 == HARD ] || [[ $2=SOFT  $3 -gt 0 ]]; then
/usr/local/nagios/libexec/check_nrpe -H 192.168.16.4 -c check_hhprod11
echo `date`route hh_prod1_1 down /var/log/ipsecrouting_beth.log
fi
;;
UNKNOWN)
echo `date`route hh_prod1_1 down unkonwn error kein event 
/var/log/ipsecrouting_beth.log
;;
esac
exit 0

When I call the hh_prod1_1_down.sh manuell with the appropriate numbers, I get 
entries in the ipsecrouting_beth.log-file and the command is executed, but when 
I let it run by nagios nothing is happening.


Any suggestions or hints to debug (I already switched the debug to -1 but 
nothing can be found about the event handler) are welcome.

Kind regards

fatcharly

--
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
___
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null

Re: [Nagios-users] event handler debug

2012-11-27 Thread fatcharly

I forgot to mention that log_event_handlers is set to 1.

Kind regards

fatcharly


 Original-Nachricht 
 Datum: Tue, 27 Nov 2012 18:32:58 +0100
 Von: fatcha...@gmx.de
 An:  nagios-list nagios-users@lists.sourceforge.net
 Betreff: [Nagios-users] event handler debug

 Hi,
 
 I`m using a nagios 3.0.3 on a CentOS 5.8 and I´m a little stuck with a
 eventhandeler problem- I can`t see it running and I can´t find a problem in
 the logfiles. Here a short overview:
 
 define service{
   use generic-service
   host_name   hostname
   service_description host_hh_prod1_1
   check_command   check_nrpe!hh_prod1_1
   event_handler   hh_prod11_down
   notifications_enabled   1
 }
 
 
  in commands.cfg is defined:
 
 define command{
 command_namehh_prod11_down
 command_line   
 /usr/local/nagios/libexec/eventhandlers/hh_prod1_1_down.sh $HOSTSTATE$ 
 $HOSTSTATETYPE$ $HOSTATTEMPT$
 }
 
 
 /usr/local/nagios/libexec/eventhandlers/hh_prod1_1_down.sh :
 
 #/bin/bash
 # $1=State $2=Zustandstyp hard oder soft $3= Versuch
 case $1 in
 OK)
 #/usr/local/nagios/libexec/check_nrpe -H 192.168.18.30 -c
 route_back_1
 echo `date`route hh_prod1_1 ok /var/log/ipsecrouting_beth.log
 ;;
 CRITICAL)
 if [ $2 == HARD ] || [[ $2=SOFT  $3 -gt 0 ]]; then
 /usr/local/nagios/libexec/check_nrpe -H 192.168.16.4 -c
 check_hhprod11
 echo `date`route hh_prod1_1 down
 /var/log/ipsecrouting_beth.log
 fi
 ;;
 UNKNOWN)
 echo `date`route hh_prod1_1 down unkonwn error kein event
 /var/log/ipsecrouting_beth.log
 ;;
 esac
 exit 0
 
 When I call the hh_prod1_1_down.sh manuell with the appropriate numbers, I
 get entries in the ipsecrouting_beth.log-file and the command is executed,
 but when I let it run by nagios nothing is happening.
 
 
 Any suggestions or hints to debug (I already switched the debug to -1 but
 nothing can be found about the event handler) are welcome.
 
 Kind regards
 
 fatcharly
 
 --
 Monitor your physical, virtual and cloud infrastructure from a single
 web console. Get in-depth insight into apps, servers, databases, vmware,
 SAP, cloud infrastructure, etc. Download 30-day Free Trial.
 Pricing starts from $795 for 25 servers or applications!
 http://p.sf.net/sfu/zoho_dev2dev_nov
 ___
 Nagios-users mailing list
 Nagios-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/nagios-users
 ::: Please include Nagios version, plugin version (-v) and OS when
 reporting any issue. 
 ::: Messages without supporting info will risk being sent to /dev/null

--
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
___
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null

Re: [Nagios-users] event handler debug

2012-11-27 Thread Assaf Flatto
On 27/11/12 17:32, fatcha...@gmx.de wrote:
 Hi,

 I`m using a nagios 3.0.3 on a CentOS 5.8 and I´m a little stuck with a 
 eventhandeler problem- I can`t see it running and I can´t find a problem in 
 the logfiles. Here a short overview:

 define service{
use generic-service
host_name   hostname
service_description host_hh_prod1_1
check_command   check_nrpe!hh_prod1_1
event_handler   hh_prod11_down
notifications_enabled   1
  }


   in commands.cfg is defined:

 define command{
  command_namehh_prod11_down
  command_line
 /usr/local/nagios/libexec/eventhandlers/hh_prod1_1_down.sh $HOSTSTATE$ 
 $HOSTSTATETYPE$ $HOSTATTEMPT$
  }


 /usr/local/nagios/libexec/eventhandlers/hh_prod1_1_down.sh :

 #/bin/bash
 # $1=State $2=Zustandstyp hard oder soft $3= Versuch
 case $1 in
  OK)
  #/usr/local/nagios/libexec/check_nrpe -H 192.168.18.30 -c 
 route_back_1
  echo `date`route hh_prod1_1 ok/var/log/ipsecrouting_beth.log
  ;;
  CRITICAL)
  if [ $2 == HARD ] || [[ $2=SOFT  $3 -gt 0 ]]; then
  /usr/local/nagios/libexec/check_nrpe -H 192.168.16.4 -c 
 check_hhprod11
  echo `date`route hh_prod1_1 down/var/log/ipsecrouting_beth.log
  fi
  ;;
  UNKNOWN)
  echo `date`route hh_prod1_1 down unkonwn error kein 
 event/var/log/ipsecrouting_beth.log
  ;;
 esac
 exit 0

 When I call the hh_prod1_1_down.sh manuell with the appropriate numbers, I 
 get entries in the ipsecrouting_beth.log-file and the command is executed, 
 but when I let it run by nagios nothing is happening.


 Any suggestions or hints to debug (I already switched the debug to -1 but 
 nothing can be found about the event handler) are welcome.

 Kind regards

 fatcharly

 --
 Monitor your physical, virtual and cloud infrastructure from a single
 web console. Get in-depth insight into apps, servers, databases, vmware,
 SAP, cloud infrastructure, etc. Download 30-day Free Trial.
 Pricing starts from $795 for 25 servers or applications!
 http://p.sf.net/sfu/zoho_dev2dev_nov
 ___
 Nagios-users mailing list
 Nagios-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/nagios-users
 ::: Please include Nagios version, plugin version (-v) and OS when reporting 
 any issue.
 ::: Messages without supporting info will risk being sent to /dev/null
can you see anything on the nrpe side ?

when you are testing , are you running it as the nagios user or as root?

Where are you passing the parameters to the eventhandler in your command 
definition ?

--
Keep yourself connected to Go Parallel: 
DESIGN Expert tips on starting your parallel project right.
http://goparallel.sourceforge.net
___
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null

Re: [Nagios-users] event handler debug

2012-11-27 Thread Matthew Jurgens
For shell based event handlers I normally add these lines to the top of 
the script:


set -x
exec  /tmp/event.log 21
echo = Started `date` 
set

This way, everything the event handler does is written to the file 
/tmp/event.log


Also, this page: http://edcint.co.nz/checkwmiplus/?q=genericeventhandler
is about a generic event handler which could replace your event handler 
just by passing it some parameters. The other advantage of the generic 
event handler is that is has good logging and debug features.


This page: http://edcint.co.nz/checkwmiplus/?q=faq_worksoncommandline
is about plugins that don't work in Nagios but work on the command line. 
Most of the pointers here also apply to event handlers.


On 28/11/2012 6:16 AM, Assaf Flatto wrote:

On 27/11/12 17:32, fatcha...@gmx.de wrote:

Hi,

I`m using a nagios 3.0.3 on a CentOS 5.8 and I´m a little stuck with a 
eventhandeler problem- I can`t see it running and I can´t find a problem in the 
logfiles. Here a short overview:






--
Smartmon System Monitoring http://www.smartmon.com.au
www.smartmon.com.au http://www.smartmon.com.au
--
Keep yourself connected to Go Parallel: 
DESIGN Expert tips on starting your parallel project right.
http://goparallel.sourceforge.net___
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null