Nagios XI 5.6.6 /etc/sysconfig/nagios not working

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
rwbanta
Posts: 2
Joined: Wed Oct 16, 2019 8:30 am

Nagios XI 5.6.6 /etc/sysconfig/nagios not working

Post 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.
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

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

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

Be sure to check out our Knowledgebase for helpful articles and solutions!
rwbanta
Posts: 2
Joined: Wed Oct 16, 2019 8:30 am

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

Post by rwbanta »

Thanks for the response.
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

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

Post by benjaminsmith »

Thanks for the response.
Your welcome.

Let us know if you have any questions.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked