checks fails at one script callback second script

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: checks fails at one script callback second script

Post by sreinhardt »

You can use your script as a plugin, it conforms to the nagios exit codes, and output requests just fine. If you are looking to run that on a remote system, check_by_ssh would be my suggested route.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
ganeshanrs1983
Posts: 55
Joined: Wed Jun 18, 2014 10:16 am

Re: checks fails at one script callback second script

Post by ganeshanrs1983 »

hello,

I have followed the below pdf to create the text file (First Event Handler In Nagios XI) if the host is down. I am stuck with the final step. It's not creating the txt file /tmp/hostinfo.txt on the localhost. What might be the issue ? Please suggest.

http://assets.nagios.com/downloads/nagi ... ios-XI.pdf
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: checks fails at one script callback second script

Post by tmcdonald »

What are the permissions on the event handler script?
Former Nagios employee
ganeshanrs1983
Posts: 55
Joined: Wed Jun 18, 2014 10:16 am

Re: checks fails at one script callback second script

Post by ganeshanrs1983 »

-rwxr-xr-x 1 nagios nagios 189 Sep 22 09:25 event_handler_test.sh
ganeshanrs1983
Posts: 55
Joined: Wed Jun 18, 2014 10:16 am

Re: checks fails at one script callback second script

Post by ganeshanrs1983 »

Here is the below information got from eventlog :

[09-22-2014 14:06:26] wproc: stderr line 01: execvp(“/usr/local/nagios/libexec/event_handler_test.sh, ...) failed. errno is 2: No such file or directory
Informational Message[09-22-2014 14:06:26] wproc: early_timeout=0; exited_ok=1; wait_status=512; error_code=0;
Informational Message[09-22-2014 14:06:26] wproc: HOST EVENTHANDLER job 185 from worker Core Worker 12331 is a non-check helper but exited with return code 2
Host Down[09-22-2014 14:06:26] HOST ALERT: event_handler_test;DOWN;HARD;1;TEST
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: checks fails at one script callback second script

Post by abrist »

Well, it *looks* like everything is configured correctly, but just to be sure, lets check a few things:

Code: Select all

ls -la /usr/local/nagios/libexec/event_handler_test.sh
chage -l nagios
getenforce
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
ganeshanrs1983
Posts: 55
Joined: Wed Jun 18, 2014 10:16 am

Re: checks fails at one script callback second script

Post by ganeshanrs1983 »

Please find the output. Please let me know in case of anything wrong.

-bash-4.1$ id
uid=39209(nagios) gid=9010(nagios) groups=9010(nagios),9011(nagcmd)
-bash-4.1$ cd /usr/local/nagios/libexec/
-bash-4.1$ ls -la /usr/local/nagios/libexec/event_handler_test.sh
-rwxrwxr-x 1 nagios nagios 189 Sep 22 13:33 /usr/local/nagios/libexec/event_handler_test.sh

-bash-4.1$ chage -l nagios
Last password change : Jun 26, 2014
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change : 1
Maximum number of days between password change : 4294967295
Number of days of warning before password expires : 7


-bash-4.1$ getenforce
Disabled
ganeshanrs1983
Posts: 55
Joined: Wed Jun 18, 2014 10:16 am

Re: checks fails at one script callback second script

Post by ganeshanrs1983 »

Hello friends,

This issue is resolved.Now it's creating the txt file on localhost if the host is down.

Thanks a lot for your response and time.

Regards
Ganeshan S
Locked