Hi
I am currently running NagiosXI trial, I would like to know how to call custom variables that are defined for the host?
Eg.
I added a custom variable to a host: _oraclesid = test
On my command definition I would like to call the _oraclesid variable as a parameter argument
check_oracle_health --usr=xxx --password=xxx --connect= (This is where I want to call the variable defined in the host, I have tried $_oraclesid$ and just _oraclesid but that doesn't work)
Doing it like this will allow me to define an Oracle sid for each host which can be used by all oracle service checks for all hosts.
Any help will be greatly appreciated.
Custom host Variables for services use
Re: Custom host Variables for services use
Custom variables can be referenced in macros if you use all uppercase letters. Thus, this macro should work:
$_ORACLESID$
Hope that helps!
$_ORACLESID$
Hope that helps!
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Ethan Galstad
President
Ethan Galstad
President
Re: Custom host Variables for services use
Thanks for your assistance
I still get the following error:
CRITICAL - cannot connect to $. ORA-24327: need explicit attach before authenticating a user (DBD ERROR: OCISessionBegin
looks like it is not picking up the variable
My command looks like this:
check_oracle_health --username $ARG1$ --password $ARG2$ --connect $_ORACLESID$
Thanks
Hendrik
I still get the following error:
CRITICAL - cannot connect to $. ORA-24327: need explicit attach before authenticating a user (DBD ERROR: OCISessionBegin
looks like it is not picking up the variable
My command looks like this:
check_oracle_health --username $ARG1$ --password $ARG2$ --connect $_ORACLESID$
Thanks
Hendrik
Re: Custom host Variables for services use
Hi guys
Any ideas, I have tried a few different ways.
Regards
Hendrik
Any ideas, I have tried a few different ways.
Regards
Hendrik
Re: Custom host Variables for services use
Are you able to get it to work by manually entering an SID into the command-line.
You can run quick tests from
/usr/local/nagios/libexec/check_<your_plugin> <your_args>
If you can get it working can you post the command-line data (minus the private data) that you got running. Usually there's just something small that's missing.
Does it work if you do it this way? $ARG3$ being the sid
You can run quick tests from
/usr/local/nagios/libexec/check_<your_plugin> <your_args>
If you can get it working can you post the command-line data (minus the private data) that you got running. Usually there's just something small that's missing.
Does it work if you do it this way? $ARG3$ being the sid
Code: Select all
check_oracle_health --username $ARG1$ --password $ARG2$ --connect $ARG3$Re: Custom host Variables for services use
Yup it works 100% fine, I already have 600 Oracle_health checks going 100% with the following command line:
$USER1$/check_oracle_health --username $ARG1$ --password $ARG2$ --connect $HOSTNAME$ --mode $ARG4$
As you can see above I use the $HOSTNAME$ as the SID and define the hostname in my tnsadmin file to point to the relevant database.
It rather wan't to assign a custom variable to each host like below:
define host {
host_name Test
use linux-server
alias Test
address 10.1XX.X.XX
parents Testparent
icon_image hp.png
statusmap_image hp.png
_ORACLESID test.mwdw
register 1
}
Now i would l;ike to set up my check as follows:
$USER1$/check_oracle_health --username $ARG1$ --password $ARG2$ --connect $_ORACLESID$ --mode $ARG4$
So the only difference is that I call another variable, but it shows it cannot connect to $.
$USER1$/check_oracle_health --username $ARG1$ --password $ARG2$ --connect $HOSTNAME$ --mode $ARG4$
As you can see above I use the $HOSTNAME$ as the SID and define the hostname in my tnsadmin file to point to the relevant database.
It rather wan't to assign a custom variable to each host like below:
define host {
host_name Test
use linux-server
alias Test
address 10.1XX.X.XX
parents Testparent
icon_image hp.png
statusmap_image hp.png
_ORACLESID test.mwdw
register 1
}
Now i would l;ike to set up my check as follows:
$USER1$/check_oracle_health --username $ARG1$ --password $ARG2$ --connect $_ORACLESID$ --mode $ARG4$
So the only difference is that I call another variable, but it shows it cannot connect to $.
Re: Custom host Variables for services use
Hmm, at the moment I'm not seeing why that isn't working, because from what you have there it should work. I'll look around and see if I can figure anything else out. Is there a way on the Oracle end to see exactly what command came in? It almost seems like the '$' sign got escaped and is actually being passed to the command.
Re: Custom host Variables for services use
Yup, not sure if there is any way, if I go command line and manually export the vaiable then it all works fine, it is almost like the variable that i assign to the host does not get exported, if i use the $hostname$ as the variable it works 100%mguthrie wrote:Hmm, at the moment I'm not seeing why that isn't working, because from what you have there it should work. I'll look around and see if I can figure anything else out. Is there a way on the Oracle end to see exactly what command came in? It almost seems like the '$' sign got escaped and is actually being passed to the command.
Thanks for all your help
Re: Custom host Variables for services use
I'm wondering if check commands are setup to be able to use the free variable definitions. I'm not sure what all is happening under the hood in that regard, but if it's only expecting a certain list of variables.... I'm wondering if it's literally passing $_ORACLESID$ as the value there.
I'll ask our lead developer about this today.
I'll ask our lead developer about this today.
Re: Custom host Variables for services use
Thats will be awesome, thanks!mguthrie wrote:I'm wondering if check commands are setup to be able to use the free variable definitions. I'm not sure what all is happening under the hood in that regard, but if it's only expecting a certain list of variables.... I'm wondering if it's literally passing $_ORACLESID$ as the value there.
I'll ask our lead developer about this today.