How to trigger Event_handler execution on WARNING?
How to trigger Event_handler execution on WARNING?
Hello XI Support
We've create commands and scripts to execute CMD file (disk cleanup) via Event Handler
How to trigger its execution when DISK space gets WARNING (not CRITICAL), any way to differentiate in between two?
Thank you
We've create commands and scripts to execute CMD file (disk cleanup) via Event Handler
How to trigger its execution when DISK space gets WARNING (not CRITICAL), any way to differentiate in between two?
Thank you
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: How to trigger Event_handler execution on WARNING?
You can pass the state into your event handler script and use it's value to choose when to take action.
Here's some documentation
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
Here's some documentation
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
Event Handler does not trigger CMD batch to run
Hello XI Support
We 've got working (tested) *.cmd batch to run in response to the event, but it is not running or triggered?
1. INI config looks this way
[/settings/external scripts/scripts]
allow arguments = true
diskcleanup1=scripts\\custom\\diskcleanup1.cmd
timeout=300
2. XI command looks this way
Command Name: nrpe_disk_cleanup1
Command Line: $USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c diskcleanup1
3. Event configuration (still unsure how to make it run on WARNING) is as attached (templated vs other configs)
----------------------------------------------------------------------------------------------------------------------------------
Believe we've missed free variable configuration (unsure what and how to configure in this case)
We 've got working (tested) *.cmd batch to run in response to the event, but it is not running or triggered?
1. INI config looks this way
[/settings/external scripts/scripts]
allow arguments = true
diskcleanup1=scripts\\custom\\diskcleanup1.cmd
timeout=300
2. XI command looks this way
Command Name: nrpe_disk_cleanup1
Command Line: $USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c diskcleanup1
3. Event configuration (still unsure how to make it run on WARNING) is as attached (templated vs other configs)
----------------------------------------------------------------------------------------------------------------------------------
Believe we've missed free variable configuration (unsure what and how to configure in this case)
You do not have the required permissions to view the files attached to this post.
Re: How to trigger Event_handler execution on WARNING?
Please provide the sample / example of the configuration. So far thing s do not work for us (another case just created)scottwilkerson wrote:You can pass the state into your event handler script and use it's value to choose when to take action.
Here's some documentation
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: How to trigger Event_handler execution on WARNING?
I merged these topics because it is the same issue.
We have documentation in doing this in windows
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
The document is for restarting a service but the same theory applies.
We have documentation in doing this in windows
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
The document is for restarting a service but the same theory applies.
Re: How to trigger Event_handler execution on WARNING?
This does NOT help us with fixing the problem.scottwilkerson wrote:I merged these topics because it is the same issue.
We have documentation in doing this in windows
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
The document is for restarting a service but the same theory applies.
Please schedule a support session with us!
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: How to trigger Event_handler execution on WARNING?
With all due respect, support with your licenses does not include "done for you" service, that would be added custom consulting.dlukinski wrote:This does NOT help us with fixing the problem.
Please schedule a support session with us!
Sometime when problems arise on a clients system we may choose to assist via remote session but that is at our discretion when the client has made a reasonable attempt to follow direction and we may need to see the problem to resolve it.
The document I provided gives very precise examples of how to accomplish what you described you are looking to do. Where in the document did you get stuck?
Re: How to trigger Event_handler execution on WARNING?
I do not know or understand what kind of Free variable should be created to support script execution on warning. Reboot example is not helping.scottwilkerson wrote:With all due respect, support with your licenses does not include "done for you" service, that would be added custom consulting.dlukinski wrote:This does NOT help us with fixing the problem.
Please schedule a support session with us!
Sometime when problems arise on a clients system we may choose to assist via remote session but that is at our discretion when the client has made a reasonable attempt to follow direction and we may need to see the problem to resolve it.
The document I provided gives very precise examples of how to accomplish what you described you are looking to do. Where in the document did you get stuck?
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: How to trigger Event_handler execution on WARNING?
I'm sorry I should have been clearer, on page 3-5 starts a section "Create Event Handler Script" there is an example of a script that you can use as your event handler. The service restart example has more information that you need for a less complicated example
This script in the example looks something like this
$USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c diskcleanup1
But for you, I would make one that looks like this so it only runs on warning
/usr/local/nagios/libexec/diskcleanup.sh
Then define your event handler command like this
This script in the example looks something like this
Code: Select all
#!/bin/sh
case "$1" in
OK)
;;
WARNING)
;;
UNKNOWN)
;;
CRITICAL)
/usr/local/nagios/libexec/check_nrpe -H "$2" -p 5666 -c restart_service -a "$3"
;;
esac
exit 0But for you, I would make one that looks like this so it only runs on warning
/usr/local/nagios/libexec/diskcleanup.sh
Code: Select all
#!/bin/sh
case "$1" in
OK)
;;
WARNING)
/usr/local/nagios/libexec/check_nrpe -H "$2" -p 5666 -c diskcleanup1
;;
UNKNOWN)
;;
CRITICAL)
;;
esac
exit 0Code: Select all
$USER1$/diskcleanup.sh $SERVICESTATE$ $HOSTADDRESS$Re: How to trigger Event_handler execution on WARNING?
scottwilkerson wrote:I'm sorry I should have been clearer, on page 3-5 starts a section "Create Event Handler Script" there is an example of a script that you can use as your event handler. The service restart example has more information that you need for a less complicated example
This script in the example looks something like this$USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c diskcleanup1Code: Select all
#!/bin/sh case "$1" in OK) ;; WARNING) ;; UNKNOWN) ;; CRITICAL) /usr/local/nagios/libexec/check_nrpe -H "$2" -p 5666 -c restart_service -a "$3" ;; esac exit 0
But for you, I would make one that looks like this so it only runs on warning
/usr/local/nagios/libexec/diskcleanup.shThen define your event handler command like thisCode: Select all
#!/bin/sh case "$1" in OK) ;; WARNING) /usr/local/nagios/libexec/check_nrpe -H "$2" -p 5666 -c diskcleanup1 ;; UNKNOWN) ;; CRITICAL) ;; esac exit 0Code: Select all
$USER1$/diskcleanup.sh $SERVICESTATE$ $HOSTADDRESS$
Thank you
I got fixated on client-side only script solution. Now trying this one instead