Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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'

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
152 views
Welcome To Ask or Share your Answers For Others

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...