Nagios XI 5.6.6 /etc/sysconfig/nagios not working

This board serves as an open discussion and support collaboration point for Nagios XI. NOTE: Nagios XI customers should use the Customer Support forum to obtain expedited support.

Nagios XI 5.6.6 /etc/sysconfig/nagios not working

Postby rwbanta » Thu Oct 17, 2019 11:24 am

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.
rwbanta
 
Posts: 2
Joined: Wed Oct 16, 2019 8:30 am

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

Postby benjaminsmith » Thu Oct 17, 2019 3:01 pm

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!
User avatar
benjaminsmith
 
Posts: 1864
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

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

Postby rwbanta » Thu Oct 17, 2019 3:06 pm

Thanks for the response.
rwbanta
 
Posts: 2
Joined: Wed Oct 16, 2019 8:30 am

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

Postby benjaminsmith » Thu Oct 17, 2019 4:07 pm

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!
User avatar
benjaminsmith
 
Posts: 1864
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul


Return to Nagios XI

Who is online

Users browsing this forum: Fess [Nagios Bot], Google [Bot] and 14 guests