How to trigger Event_handler execution on WARNING?

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

Re: How to trigger Event_handler execution on WARNING?

Post by dlukinski »

Re-configured nagios-side

client side script does not run on WARNING (got the condition right now)

Zipped NSclient ini and client-side CMD file attached.
You do not have the required permissions to view the files attached to this post.
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?

Post by scottwilkerson »

I think you might need to change this line

Code: Select all

diskcleanup1=scripts\\custom\\diskcleanup1.cmd
to this

Code: Select all

diskcleanup1=scripts\custom\diskcleanup1.cmd
then restart

then I would dry running the command from the nagios server to verify it runs

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H "IP_ADDRESS" -p 5666 -c diskcleanup1
If that runs then your event handler should run ad well

Code: Select all

/usr/local/nagios/libexec/diskcleanup.sh WARNING IP_ADDRESS
Finally, if both of those run it should work if you have that event handler specified in the service and it return a warning.

If it isn't running on the remote server, you may need to look in the nsclient.log file for clues to what is erroring.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

Re: How to trigger Event_handler execution on WARNING?

Post by dlukinski »

scottwilkerson wrote:I think you might need to change this line

Code: Select all

diskcleanup1=scripts\\custom\\diskcleanup1.cmd
to this

Code: Select all

diskcleanup1=scripts\custom\diskcleanup1.cmd
then restart

then I would dry running the command from the nagios server to verify it runs

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H "IP_ADDRESS" -p 5666 -c diskcleanup1
If that runs then your event handler should run ad well

Code: Select all

/usr/local/nagios/libexec/diskcleanup.sh WARNING IP_ADDRESS
Finally, if both of those run it should work if you have that event handler specified in the service and it return a warning.

If it isn't running on the remote server, you may need to look in the nsclient.log file for clues to what is erroring.
check_nrpe have failed:

[root@fikc-nagxiprod01 libexec]# /usr/local/nagios/libexec/check_nrpe -H 10.102.33.100 -p 5666 -c diskcleanup1
The filename, directory name, or volume label syntax is incorrect.
ERROR: Input redirection is not supported, exiting the process immediately.
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?

Post by scottwilkerson »

This error is coming form trying to find the diskcleanup1.cmd file I think

can you also see the nsclient.log and share that
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

Re: How to trigger Event_handler execution on WARNING?

Post by dlukinski »

scottwilkerson wrote:This error is coming form trying to find the diskcleanup1.cmd file I think

can you also see the nsclient.log and share that
Here it is (no records in LOG)
You do not have the required permissions to view the files attached to this post.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: How to trigger Event_handler execution on WARNING?

Post by tgriep »

When using an external script, you have to have a setting in the wrappings section so NSClient++ knows how to execute it.
Edit your nsclient.ini file and under this section

Code: Select all

[/settings/external scripts/wrappings]
Add this

Code: Select all

cmd = scripts\\%SCRIPT% %ARGS%
Save the file and restart NSClient++

After the change the agent should know how to execute the cmd file.
Let us know if it works for you.

Another option is to change the script to a .bat file and update the command definition in the ini file.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked