Event_handler - OK Status Problema

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
paulo.ferreira
Posts: 32
Joined: Wed Feb 26, 2020 10:26 am

Event_handler - OK Status Problema

Post by paulo.ferreira »

i'm trying to create a event_handler to open and close a ticket automatically in an internal ticket system.
But my event works well if the service status change of OK to critical or warning, but otherway don't, so that way I'm not able to close the ticket automatically.

Any guess ?

PS: I follow the instructions below:
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Event_handler - OK Status Problema

Post by scottwilkerson »

Can you show the event_handler_ticket.sh you created?

Did you add an elif block on what to do if the $SERVICESTATE is OK?
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
paulo.ferreira
Posts: 32
Joined: Wed Feb 26, 2020 10:26 am

Re: Event_handler - OK Status Problema

Post by paulo.ferreira »

Code: Select all

#!/bin/bash
#Script nagios - top

#Variaveis

DATE=$(date)
title="${3} - ${4} - Nagios Alert ${1}"
desc="${DATE} - ${3}- ${8} - ${7}"

case "$1" in
OK)

/opt/mssql-tools/bin/sqlcmd -S 1.1.1.1 -U nagios -P password -Q "exec sp_event_bus @object = '$3',@code = 'MONC',@event_key = '',@summary = '$title',@descripti
on = '$desc',@has_clear_event = 1,@is_clear_event = 1" | tee -a /tmp/log.txt
;;
WARNING)
#chamados warning

/opt/mssql-tools/bin/sqlcmd -S 1.1.1.1 -U nagios -P password -Q "exec sp_event_bus @object = '$3',@code = 'MONW',@event_key = '',@summary = '$title',@descripti
on = '$desc',@has_clear_event = 1,@is_clear_event = 0" | tee -a /tmp/log.txt
;;
UNKNOWN)
;;
CRITICAL)

#chamados critical

/opt/mssql-tools/bin/sqlcmd -S 1.1.1.1 -U nagios -P password -Q "exec sp_event_bus @object = '$3',@code = 'MONC',@event_key = '',@summary = '$title',@descripti
on = '$desc',@has_clear_event = 1,@is_clear_event = 0" | tee -a /tmp/log.txt
;;
esac
exit 0
If SERVICESTATE is WARNING or CRITICAL, the event_handler is called and execute the script, but it seems that the event_handler is not called when the SERVICESTATE go to OK status.

If we call the script mannualy informing the SERVICESTATE status, the script works. The question is why the event_handler script is not called when the status changed from CRITICAL to OK?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Event_handler - OK Status Problema

Post by scottwilkerson »

Are you adding this to an individual service, or as a global event handler?

They should be kicked off on recovery
https://assets.nagios.com/downloads/nag ... dlers.html
When Are Event Handlers Executed?

Event handlers are executed when a service or host:

Is in a SOFT problem state
Initially goes into a HARD problem state
Initially recovers from a SOFT or HARD problem state

SOFT and HARD states are described in detail here .
What version of Nagios XI are you running?
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
paulo.ferreira
Posts: 32
Joined: Wed Feb 26, 2020 10:26 am

Re: Event_handler - OK Status Problema

Post by paulo.ferreira »

Individual Services.
Nagios XI 5.8
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Event_handler - OK Status Problema

Post by scottwilkerson »

paulo.ferreira wrote:Individual Services.
Nagios XI 5.8
Nagios XI 5.8 has not been released yet, can you re-check the version?
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
paulo.ferreira
Posts: 32
Joined: Wed Feb 26, 2020 10:26 am

Re: Event_handler - OK Status Problema

Post by paulo.ferreira »

Sorry, mb.

5.5.8
paulo.ferreira
Posts: 32
Joined: Wed Feb 26, 2020 10:26 am

Re: Event_handler - OK Status Problem

Post by paulo.ferreira »

Actually, when we were trying to test the event handler, and we were using a test script call event_handler_ping.sh, but we don't no why, when the service status change, runs our prior event_handler which the name is event_handler.sh, although our configuration at service panel.

Any guess, where maybe i acidentally setup a global event handler ?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Event_handler - OK Status Problema

Post by scottwilkerson »

Can you PM me a profile.zip from Admin -> System profile

Also, please include the name of the host & service this is assigned to
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked