Page 1 of 1

Nagios XI 5.6.6 /etc/sysconfig/nagios not working

Posted: Thu Oct 17, 2019 11:24 am
by rwbanta
I am having issues with the commands.cfg file and JAVA_ABS_PATH. I tried creating /etc/sysconfig/Nagios file and restarting Nagios to set the following environment variables.

export JAVA_HOME=/opt/ds/java/jdk1.8.0_162
export JRE_HOME=/opt/ds/java/jdk1.8.0_162/jre
export JAVA_ABS_PATH=/opt/ds/java/jdk1.8.0_162/bin/java
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib:$CLASSPATH

I don't want to put commands.cfg in static as i want to be able to update it thru the web interface.

The following command fails when JAVA_ABS_PATH is not set. (No output on stdout) stderr: execvp(JAVA_ABS_PATH, ...) failed. errno is 2: No such file or directory)

define command {
command_name check_xi_java_as
command_line JAVA_ABS_PATH -Djava.class.path=$ARG2$:$USER1$/check_jvm.jar GenericASCheck $ARG1$
}

If I change the command like the following it works fine in the Web Interface.

define command {
command_name check_xi_java_as
command_line /opt/ds/java/jdk1.8.0_162/bin/java -Djava.class.path=$ARG2$:$USER1$/check_jvm.jar GenericASCheck $ARG1$
}

Is there any method to get commands.cfg to pick up variables so this is not overwritten every time when you apply configuration in the web interface? /etc/sysconfig/Nagios doesn't seem to work.
Thanks for any response.

Re: Nagios XI 5.6.6 /etc/sysconfig/nagios not working

Posted: Thu Oct 17, 2019 3:01 pm
by benjaminsmith
Hello @rwbata,

You can set your own variables using macros, and use those in you check commands. See the guide below.

Understanding User Macros

Let us know if you have any questions.

Re: Nagios XI 5.6.6 /etc/sysconfig/nagios not working

Posted: Thu Oct 17, 2019 3:06 pm
by rwbanta
Thanks for the response.

Re: Nagios XI 5.6.6 /etc/sysconfig/nagios not working

Posted: Thu Oct 17, 2019 4:07 pm
by benjaminsmith
Thanks for the response.
Your welcome.

Let us know if you have any questions.