How to get the IP where come the nrpe_check
How to get the IP where come the nrpe_check
Hi,
I have 2 IP on server.
From Nagios XI, I configure the check_nrpe to run the same service on the 2 IP of my remote server
On the remonte server, how can I get from the launched script which IP was used by check_nrpe?
Depending of which IP my script will do different check.
this is the test I would like to have in Nagios XI
check_nrpe -H 192.168.1.1 -c test
check_nrpe -H 192.168.1.2 -c test
And test on the remote server should be doing a different action if it's coming for 192.168.1.1 or for 192.168.1.2
I have 2 IP on server.
From Nagios XI, I configure the check_nrpe to run the same service on the 2 IP of my remote server
On the remonte server, how can I get from the launched script which IP was used by check_nrpe?
Depending of which IP my script will do different check.
this is the test I would like to have in Nagios XI
check_nrpe -H 192.168.1.1 -c test
check_nrpe -H 192.168.1.2 -c test
And test on the remote server should be doing a different action if it's coming for 192.168.1.1 or for 192.168.1.2
Last edited by steph007 on Wed Sep 26, 2018 9:31 am, edited 1 time in total.
Re: How to get the IP where come the nope_check
You cannot have two different commands with the same name (test), defined on the remote box in the nrpe.cfg file... This is not going to work. You will need to define two separate commands, e.g. "test1" and "test2". Then, you can run:
from your Nagios XI server.
Code: Select all
check_nrpe -H 192.168.1.1 -c test1
check_nrpe -H 192.168.1.2 -c test2
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: How to get the IP where come the nrpe_check
I will have only one commande defined into nrpe.cfg.
But because my server is listening on 2 IP, nrpe_check can contact the server with each IP to execute the service.
But because my server is listening on 2 IP, nrpe_check can contact the server with each IP to execute the service.
Last edited by steph007 on Wed Sep 26, 2018 9:32 am, edited 1 time in total.
Re: How to get the IP where come the nope_check
It would help to know how the "test" command is defined on the remote machine.But because my server is listening on 2 IP, nrpe_check can contact the server with each IP to execute the service.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: How to get the IP where come the nrpe_check
command[test]=/usr/local/NagiosIBM/plugins/test.pl
nrpe is listening on 2 IP and can be contacting by check_nrpe on both IP
nrpe is listening on 2 IP and can be contacting by check_nrpe on both IP
Re: How to get the IP where come the nrpe_check
To give more detail:
From Nagios XI server:
root@plgesmon02[/usr]# ./local/nagios/libexec/check_nrpe -H 10.217.77.34 -p 1766 -c test
OK
root@plgesmon02[/usr]# ./local/nagios/libexec/check_nrpe -H 10.217.77.33 -p 1766 -c test
OK
10.217.77.33 and 10.217.77.34 are both IP of my Host caapedb301.
When test.pl is launched on caapedb301, I would like to determine if it hit by 10.217.77.33 or 10.217.77.34
From Nagios XI server:
root@plgesmon02[/usr]# ./local/nagios/libexec/check_nrpe -H 10.217.77.34 -p 1766 -c test
OK
root@plgesmon02[/usr]# ./local/nagios/libexec/check_nrpe -H 10.217.77.33 -p 1766 -c test
OK
10.217.77.33 and 10.217.77.34 are both IP of my Host caapedb301.
When test.pl is launched on caapedb301, I would like to determine if it hit by 10.217.77.33 or 10.217.77.34
Re: How to get the IP where come the nrpe_check
I can't think of any way to pass the IP, used by NRPE to your script, other than passing it as an argument.
You command could be defined as such:
From the Nagios XI server, you could run:
You command could be defined as such:
Code: Select all
command[test]=/usr/local/NagiosIBM/plugins/test.pl $ARG1$Code: Select all
./check_nrpe -H 192.168.1.1 -c test -a '192.168.1.1'
./check_nrpe -H 192.168.1.2 -c test -a '192.168.1.2'Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: How to get the IP where come the nrpe_check
I was afraid of that kind of answer.
My nrpe is configure to not using argument
My nrpe is configure to not using argument
Re: How to get the IP where come the nrpe_check
I discussed the challenge with our developers, and I was told that using an argument would be the only way to do that. We can leave the topic open for the time being, just in case someone from the Nagios community comes up with a more creative solution. After a while, topic will "auto-close" though. Thanks!
Be sure to check out our Knowledgebase for helpful articles and solutions!