Amazon EC2 Wizard and proxy

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
sgargano
Posts: 51
Joined: Mon May 23, 2016 9:06 am

Amazon EC2 Wizard and proxy

Post by sgargano »

Dear support,

due to our network design we are forced to use our Nagios XI instaces behind a proxy for both HTTP and HTTPS calls.

The proxy is setup under /etc/environment as well as under the Proxy Configuration under Nagios webpage where we are able to check for the updates outside and it is working properly.

What is not working as expected is the Amazon EC2 wizard: at the first page, where it is required the Access Key ID and the Secret Access Key the wizard hangs right after the "Get Available Instance" button is pressed.

The AWS rights looks correct, the user involved has the administrator rights but analyzing the network flow it looks like we are not able to reach the proxy with this call.

Is this wizard forced to use the proxy or not?

Thanks
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Amazon EC2 Wizard and proxy

Post by ssax »

Based on the information I've found, it should inherit the environmental variables automatically:
So boto3 does not require the global config to set proxies. All you need to do is set the general https_proxy environment variable and requests/urllib3 should use the value stored in that environment variable. So something like:

export https_proxy=https://username:password@hostname:port
Taken from here:

Code: Select all

https://github.com/boto/boto3/issues/338#issuecomment-153442206
PHP should inherit the values automatically if they are set for all users, please send me your:

Code: Select all

/etc/environment
Adding your proxy info to your /etc/environment (so all users pick it up, even without tty) should resolve the issue but since the wizard is going to use the apache user to do it you need to make sure the apache user has those set.

Try this and let us know if that resolves the issue:

https://serverfault.com/a/233227
sgargano
Posts: 51
Joined: Mon May 23, 2016 9:06 am

Re: Amazon EC2 Wizard and proxy

Post by sgargano »

Is not working to me,
and reading the link you sent it looks like many other users having the same problem:

https://github.com/boto/boto3/issues/33 ... -226714116

My proxy env are set under:

Code: Select all

/etc/environment
http_proxy=http://xxxx.xxxx.com:8080/
https_proxy=http://xxxx.xxxx.com:8080/
and I also added

Code: Select all

/etc/sysconfig/httpd
export http_proxy="http://xxxx.xxxx.com:8080/"
export https_proxy="http://xxxx.xxxx.com:8080/"
but all of these settings looks to be override by boto3.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Amazon EC2 Wizard and proxy

Post by ssax »

Try editing this file:

Code: Select all

/usr/local/nagios/libexec/check_ec2.py
BELOW THIS CODE:

Code: Select all

# Booleans
inclusive = False
ADD THIS CODE:

Code: Select all

# Set Proxy Envars
os.environ['HTTP_PROXY'] = 'http://xxxx.xxxx.com:8080/'
os.environ['HTTPS_PROXY'] = 'http://xxxx.xxxx.com:8080/'
Then test again (force a check) and see if if it works.
sgargano
Posts: 51
Joined: Mon May 23, 2016 9:06 am

Re: Amazon EC2 Wizard and proxy

Post by sgargano »

Great, that worked!

Thanks for your support.
Locked