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
Event_handler - OK Status Problema
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Event_handler - OK Status Problema
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?
Did you add an elif block on what to do if the $SERVICESTATE is OK?
-
paulo.ferreira
- Posts: 32
- Joined: Wed Feb 26, 2020 10:26 am
Re: Event_handler - OK Status Problema
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 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
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
They should be kicked off on recovery
https://assets.nagios.com/downloads/nag ... dlers.html
What version of Nagios XI are you running?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 .
-
paulo.ferreira
- Posts: 32
- Joined: Wed Feb 26, 2020 10:26 am
Re: Event_handler - OK Status Problema
Individual Services.
Nagios XI 5.8
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
Nagios XI 5.8 has not been released yet, can you re-check the version?paulo.ferreira wrote:Individual Services.
Nagios XI 5.8
-
paulo.ferreira
- Posts: 32
- Joined: Wed Feb 26, 2020 10:26 am
Re: Event_handler - OK Status Problema
Sorry, mb.
5.5.8
5.5.8
-
paulo.ferreira
- Posts: 32
- Joined: Wed Feb 26, 2020 10:26 am
Re: Event_handler - OK Status Problem
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 ?
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
Can you PM me a profile.zip from Admin -> System profile
Also, please include the name of the host & service this is assigned to
Also, please include the name of the host & service this is assigned to