Nagios Global Event Handler

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
selvi
Posts: 12
Joined: Wed Feb 15, 2012 12:24 am

Re: Nagios Global Event Handler

Post by selvi »

I have run the following command, the shell file has permissions and got executed,
su nagios -c '/opt/SomClient/bin/somClient.sh

Nagios monitor the server machine and updates the "Service Status" but the Event Handler is not executing somClient.sh file.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios Global Event Handler

Post by scottwilkerson »

On the previous screen you had a different file path.

Change

Code: Select all

./root/SomClient/bin/somClient.shh
to

Code: Select all

/opt/SomClient/bin/somClient.sh
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
selvi
Posts: 12
Joined: Wed Feb 15, 2012 12:24 am

Re: Nagios Global Event Handler

Post by selvi »

Yes i have change the file from '/root/SomClient/bin/somClient.sh' to '/opt/SomClient/bin/somClient.sh'
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios Global Event Handler

Post by scottwilkerson »

At this point it really depends on what is in the shell script. does it use environment variables?

Can you place something like the following as the first item of the script to verify it is opening

Code: Select all

touch /tmp/it_works
then after a state change you can test to see if the file /tmp/it_works exists...
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
selvi
Posts: 12
Joined: Wed Feb 15, 2012 12:24 am

Re: Nagios Global Event Handler

Post by selvi »

I have tried the touch command (touch /opt/test.txt) inside my shell script (/opt/SomClient/bin/somClient.sh), the command was got executed and the file got created but at the same time the "java command" which is inside that same shell file was not executed
Example:
"java -cp ${SOM_HOME}/lib/somClient.jar:${SOM_HOME}/lib/jbossall-client.jar:${SOM_HOME}/lib/ojdbc14.jar:${SOM_HOME}/lib/log4j.jar:${SOM_HOME}/lib/mailapi.jar:${SOM_HOME}/lib/activation.jar::${SOM_HOME}/lib/bsh.jar:${SOM_HOME}/lib/jbossall-client.jar:${SOM_HOME}/lib/smtp.jar:${SOM_HOME}/lib/snmp.jar:${SOM_HOME}/lib/mail.jar: -Dsom.home=${SOM_HOME} com.firstis.telaweb.somClient.SomClientAdapter -d selvi -m TestMessage"

Is there any way to execute the java command inside the nagios ?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios Global Event Handler

Post by scottwilkerson »

you might need to enter the full path to java.

Also, when nagios executes the event handler it does not load the profile so if ${SOM_HOME} is an environment variable it will not have access to it unless you place it in /home/nagios/.bashrc
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
selvi
Posts: 12
Joined: Wed Feb 15, 2012 12:24 am

Re: Nagios Global Event Handler

Post by selvi »

Hi scottwilkerson

Thanks for support. we have tried by updating environment variable in .bashrc file, but it had no effect in the Nagios Event Handler. We had given the path in the shell file(somClient.sh) directly and it worked.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Nagios Global Event Handler

Post by lmiltchev »

Thanks for the feedback! We really appreciate it!
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked