问题
I am trying to configure aws cloudwatch
script for monitoring memory etc. While executing the script we get below error and I upgraded the perl
package the LWP version is also latest as 6 but still script is failing with below error.
I tried setting env variables as PERL_LWP_ENV_PROXY=1
and PERL_LWP_SSL_VERIFY_HOSTNAME=0
but still failing. Please help on this.
[ec2-user@ip-10-175-82-195 aws-scripts-mon]$ sudo ./mon-put-instance-data.pl --mem-util --mem-used --mem-avail --aws-credential-file=./awscreds.template
ERROR: Failed to call CloudWatch: HTTP 500. Message: Can't connect to monitoring.ap-southeast-1.amazonaws.com:443 (timeout)
LWP::Protocol::https::Socket: connect: timeout at /usr/local/share/perl5/LWP/Protocol/http.pm line 47.
For more information, run 'mon-put-instance-data.pl --help'
回答1:
PERL_LWP_ENV_PROXY=1
I guess this also means that you have the http_proxy
environment variable set to a proxy it should use and that there is no way to the target except by using this proxy.
$ sudo ./mon-put-instance-data.pl
Calling something using sudo will run it with different privileges. For security reasons the environment variables are heavily scrubbed before by sudo before calling the program which probably means that http_proxy
is empty for the program run by sudo. This again means that it will try to reach the target site directly instead of using a proxy and will timeout on connection since the site can only be reached using the proxy.
回答2:
It seems to be build-essential is not installed. Please install the build essentials. I faced the same issue. Once build- essential installed , install all the related cpan module.
sudo apt-get install build-essential
Thanks Amit
回答3:
Try the following:
yum install openssl openssl-devel
perl -MCPAN -e 'install LWP::Protocol::https'
If the issue persists, try
perl -MCPAN -e 'install Bundle::CPAN'
perl -MCPAN -e 'install Bundle::LWP5_837'
来源:https://stackoverflow.com/questions/40123294/lwpprotocolhttpssocket-connect-timeout-error