Custom Variable values issue

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
zkarman
Posts: 11
Joined: Wed Oct 15, 2014 6:26 am

Custom Variable values issue

Post 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
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Custom Variable values issue

Post by abrist »

How are you defining the variable on the host config? Could you post the full host config?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
zkarman
Posts: 11
Joined: Wed Oct 15, 2014 6:26 am

Re: Custom Variable values issue

Post 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
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Custom Variable values issue

Post 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.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
zkarman
Posts: 11
Joined: Wed Oct 15, 2014 6:26 am

Re: Custom Variable values issue

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

Re: Custom Variable values issue

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
zkarman
Posts: 11
Joined: Wed Oct 15, 2014 6:26 am

Re: Custom Variable values issue

Post 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
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Custom Variable values issue

Post 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?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
zkarman
Posts: 11
Joined: Wed Oct 15, 2014 6:26 am

Re: Custom Variable values issue

Post by zkarman »

Hi,

You can close this "case".

Regards, Zsolt
Locked