Page 1 of 1
Custom Variable values issue
Posted: Wed Oct 22, 2014 5:22 am
by zkarman
Hi All,
Could anybody help to me the following problem:
i would like to use the defined variables at the host in the command:
Command: check_nrpe -H 10.31.52.31 -c CheckProcState -a MaxCritCount=$HOSTMAXJAVAW$ frmweb.exe=started
The HOSTMAXJAVAW -> value is in the host: 50
Result is:
COMMAND: /usr/local/nagios/libexec/check_nrpe -H xxx.xxx.xxx.xxx -c CheckProcState -a MaxCritCount=\$HOSTMAXJAVAW\$ frmweb.exe=started
OUTPUT: CHECK_NRPE: No output returned from daemon.
it looks like the nagios cannot change the variable to the value.\
Regards, Zsolt
Re: Custom Variable values issue
Posted: Wed Oct 22, 2014 3:19 pm
by abrist
How are you defining the variable on the host config? Could you post the full host config?
Re: Custom Variable values issue
Posted: Thu Oct 23, 2014 3:31 am
by zkarman
Hi,
This is the host config:
define host {
host_name FR-V-WIN-RA-MOP-APP01
alias Opera Application Server
address 10.31.52.31
hostgroups Opera Application Servers - Windows,Windows Servers
max_check_attempts 3
icon_image win_server.png
statusmap_image win_server.png
_MAXJAVAW 200
register 1
}
Regards, Zsolt
Re: Custom Variable values issue
Posted: Thu Oct 23, 2014 2:25 pm
by abrist
Does the check itself work when run as normally scheduled? You may have issues using USER or CUSTOM macros from the test check command.
Re: Custom Variable values issue
Posted: Fri Oct 24, 2014 2:18 am
by zkarman
Hi,
When I changed the variable to the number it works.
I tried only the variables in the host. So if I try to change to the variable it doesn't work.
I've read the lots of forums topic, and it should be work.
Regards, Zsolt
Re: Custom Variable values issue
Posted: Fri Oct 24, 2014 11:09 am
by Box293
zkarman wrote:check_nrpe -H 10.31.52.31 -c CheckProcState -a MaxCritCount=$HOSTMAXJAVAW$ frmweb.exe=started
You are not referencing the variable correctly. It needs to be referenced as $_HOSTMAXJAVAW$
Code: Select all
check_nrpe -H 10.31.52.31 -c CheckProcState -a MaxCritCount=$_HOSTMAXJAVAW$ frmweb.exe=started
http://nagios.sourceforge.net/docs/3_0/ ... tvars.html
Re: Custom Variable values issue
Posted: Mon Oct 27, 2014 9:08 am
by zkarman
Hi,
I found the issue. I've already tried with _ and without as well.
The issue is when I tried to test via -> create service -> test command -> this is not working just if i saved it.
Do you know what is the reason?
Rgs, Zsolt
Re: Custom Variable values issue
Posted: Mon Oct 27, 2014 12:25 pm
by abrist
The test check command does not populate user macros/custom variables as the test runs as user apache (for security reasons). The apache user does not have access to the necessary environment variables to run a test check with custom/user macros.
Can we lock the thread?
Re: Custom Variable values issue
Posted: Tue Oct 28, 2014 3:18 am
by zkarman
Hi,
You can close this "case".
Regards, Zsolt