Writing output to disk during a check

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
darran
Posts: 2
Joined: Fri Dec 11, 2015 4:30 pm

Writing output to disk during a check

Post 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
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Writing output to disk during a check

Post by hsmith »

Where do you have it writing to? Can you change the permissions on that directory, or use one with the proper permissions?
Former Nagios Employee.
me.
darran
Posts: 2
Joined: Fri Dec 11, 2015 4:30 pm

Re: Writing output to disk during a check

Post 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!
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Writing output to disk during a check

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked