NRDP and proxy

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
chuo1981
Posts: 4
Joined: Wed Nov 16, 2016 10:38 am

NRDP and proxy

Post 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:password@10.0.0.70:8080"
export https_proxy="http://user:password@10.0.0.70: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?
Attachments
Architecture
Architecture
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: NRDP and proxy

Post 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:password@10.0.0.70:8080" https_proxy="http://user:password@10.0.0.70: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:password@10.0.0.70:8080" https_proxy="http://user:password@10.0.0.70: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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
chuo1981
Posts: 4
Joined: Wed Nov 16, 2016 10:38 am

Re: NRDP and proxy

Post 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:password@10.0.0.70:8080" https_proxy="http://user:password@10.0.0.70: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:password@10.0.0.70:8080" https_proxy="http://user:password@10.0.0.70: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.
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: NRDP and proxy

Post 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?
Be sure to check out our Knowledgebase for helpful articles and solutions!
chuo1981
Posts: 4
Joined: Wed Nov 16, 2016 10:38 am

Re: NRDP and proxy

Post by chuo1981 »

Good morning,

Now, it's everything working fine.

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

Thank you so much
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: NRDP and proxy

Post by dwhitfield »

It sounds like this issue has been resolved. Is it okay if we lock this thread? Thanks for choosing the Nagios forums!
chuo1981
Posts: 4
Joined: Wed Nov 16, 2016 10:38 am

Re: NRDP and proxy

Post by chuo1981 »

Hello,

Yes, I don't have any problem.

Thank you to all
Locked