Page 1 of 1

NRDP and proxy

Posted: Thu Jan 11, 2018 5:17 am
by chuo1981
Good morning

I have a issues with NRDP passive checks and proxy server.

This is the network architecture:
-------------------------------------> Proxy (10.0.0.70:8080) ---------------> INTERNET -------------------> Nagios XI (20.20.20.20) NRDP
| (HTTPS/HTTP) NRDP
|
|
Nagios Core ----------------------------------------------> firewall (10.0.0.19) --------------------> INTERNET
INTERNET
IP:10.0.0.10
MASK: /24
DG: 10.0.0.19

nagios.cfg:

ocsp_command=send_nrdp_service
obsess_over_services=1
obsess_over_hosts=1
ochp_command=send_nrdp_host

-------------------------------------------------------------------
command.cfg:

### NRDP ###

define command{
command_name send_nrdp_host
command_line $USER1$/send_nrdp.php --url=https://20.20.20.20/nrdp/ --token=XXXXX --host="$HOSTNAME$" --state=$HOSTSTATEID$ --output="$HOSTOUTPUT$"
}

define command{
command_name send_nrdp_service
command_line $USER1$/send_nrdp.php --url=https://20.20.20.20/nrdp/ --token=XXXXX --host="$HOSTNAME$" --service="$SERVICEDESC$" --state=$SERVICESTATEID$ --output="$SERVICEOUTPUT$"
}
------------------------------------------------

Into ./bachrc and ./bash_profile

export http_proxy="http://user:[email protected]:8080"
export https_proxy="http://user:[email protected]:8080"

When the nagios execute this commands, all checks go through to the firewall (default gateway), but if I execute this commands in the command line, the checks go through to proxy server.

I don't know why these issues happen.

Can somebody help me?

Re: NRDP and proxy

Posted: Thu Jan 11, 2018 2:59 pm
by tgriep
What I think is happening is when you are running the commands from the comand line, the environment variables for the proxy are set but when the nagios server they are not set so it doesn't know to use the proxy server.
What you could do is to is to set the environment variables in the global environment.

Or, in the commands, call out the environment variable like this.

The host command

Code: Select all

/usr/bin/env http_proxy="http://user:[email protected]:8080" https_proxy="http://user:[email protected]:8080" $USER1$/send_nrdp.php --url=https://20.20.20.20/nrdp/ --token=XXXXX --host="$HOSTNAME$" --state=$HOSTSTATEID$ --output="$HOSTOUTPUT$"
The service command

Code: Select all

/usr/bin/env http_proxy="http://user:[email protected]:8080" https_proxy="http://user:[email protected]:8080" $USER1$/send_nrdp.php --url=https://20.20.20.20/nrdp/ --token=XXXXX --host="$HOSTNAME$" --service="$SERVICEDESC$" --state=$SERVICESTATEID$ --output="$SERVICEOUTPUT$"
Try one of those solutions and let us know if you have any other questions.

Re: NRDP and proxy

Posted: Mon Jan 15, 2018 6:44 pm
by chuo1981
@tgriep

Thanks you it's working now, I've configured the "command.cfg" files like you said:

Host:

/usr/bin/env http_proxy="http://user:[email protected]:8080" https_proxy="http://user:[email protected]:8080" $USER1$/send_nrdp.php --url=https://20.20.20.20/nrdp/ --token=XXXXX --host="$HOSTNAME$" --state=$HOSTSTATEID$ --output="$HOSTOUTPUT$"

Services:

/usr/bin/env http_proxy="http://user:[email protected]:8080" https_proxy="http://user:[email protected]:8080" $USER1$/send_nrdp.php --url=https://20.20.20.20/nrdp/ --token=XXXXX --host="$HOSTNAME$" --service="$SERVICEDESC$" --state=$SERVICESTATEID$ --output="$SERVICEOUTPUT$"

But I don't know why it only send hosts checks passive, the nagios xi remote only receives to unconfigured objects hosts without services.

Re: NRDP and proxy

Posted: Tue Jan 16, 2018 11:55 am
by tgriep
One thing, make sure the obsess over services it set to 1 in the nagios.cfg file.

Code: Select all

obsess_over_services=1
If it is enabled, make sure you do not have the obsess disabled in any templates or services which would stop the services from sending it's data/

Do you see any errors / messages in the nagios.log file when the command is run?

Re: NRDP and proxy

Posted: Wed Jan 17, 2018 6:00 am
by chuo1981
Good morning,

Now, it's everything working fine.

In the nagios.cfg the item ocsp was disable "#"

Thank you so much

Re: NRDP and proxy

Posted: Wed Jan 17, 2018 12:57 pm
by dwhitfield
It sounds like this issue has been resolved. Is it okay if we lock this thread? Thanks for choosing the Nagios forums!

Re: NRDP and proxy

Posted: Sat Jan 20, 2018 8:57 am
by chuo1981
Hello,

Yes, I don't have any problem.

Thank you to all