Page 1 of 1

Writing output to disk during a check

Posted: Fri Dec 11, 2015 4:38 pm
by darran
Hello!

Just getting started on the Nagios journey and have made a check that executes a jar file and then displays the output. The jar also writes a file with the same output which will be used by an event handler.

The check fails when it tries to write the file on the nagios server (I'm assuming this is because the nagios user doesn't have write permission). If I run the same jar on the nagios server as a privileged user everything works as expected.

Has anyone tried something like this. A suggestion on how to fix this or a different way to approach this is greatly appreciated!

Thank you,

Darran

Re: Writing output to disk during a check

Posted: Mon Dec 14, 2015 12:54 pm
by hsmith
Where do you have it writing to? Can you change the permissions on that directory, or use one with the proper permissions?

Re: Writing output to disk during a check

Posted: Mon Dec 14, 2015 4:32 pm
by darran
I have it writing to a specific directory that is chmod 777, but it still seems that the file is unable to be written. I'm wondering if it is a JVM issue. Here is the command that is being executed via a service definition:

java -jar /etc/nagios3/objects/services/gaphound/GapHound.jar '$ARG1$' '$ARG2$'

Thank you!

Re: Writing output to disk during a check

Posted: Mon Dec 14, 2015 7:35 pm
by Box293
Can you do:

Code: Select all

ls -la /location/of/tmp/files
This needs to be the location where the output is written to.