我有一个 perl 脚本,它使用 WWW::Mechanize 打开到我们的单点登录页面的 SSL 连接,以测试 Nagios 的连接性。昨天,该脚本停止工作,我不知道为什么。这是该脚本的调试片段:
main::(./check_profiles.pl:13): $auth_url = "https://account.example.com/SSO/index.html";
main::(./check_profiles.pl:14): $profile_url = "https://example.com/prof";
main::(./check_profiles.pl:16): $user = "nagios\@heyyou.com";
main::(./check_profiles.pl:17): $pass = "testing123";
main::(./check_profiles.pl:18): $expected_string = "Bunnies";
main::(./check_profiles.pl:21): $digest_username = "user";
main::(./check_profiles.pl:22): $digest_password = "pass";
main::(./check_profiles.pl:25): $mech = WWW::Mechanize->new( agent=>"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.4) Gecko/2008102920 Firefox/3.0.4" );
main::(./check_profiles.pl:28): $mech->credentials("example.com/prof:443","Nokia", $digest_username=>$digest_password);
main::(./check_profiles.pl:31): $mech->add_handler("request_send", sub { shift->dump; return });
main::(./check_profiles.pl:32): $mech->add_handler("response_done", sub { shift->dump; return });
main::(./check_profiles.pl:35): $mech->get( $auth_url );
GET https://account.example.com/SSO/index.html
Accept-Encoding: gzip
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.4) Gecko/2008102920 Firefox/3.0.4
(no content)
500 Can't connect to account.example.com:443 (connect: Network is unreachable)
Content-Type: text/plain
Client-Date: Wed, 15 May 2013 16:16:25 GMT
Client-Warning: Internal response
500 Can't connect to account.example.com:443 (connect: Network is unreachable)\n
Error GETing https://account.example.com/SSO/index.html: Can't connect to account.example.com:443 (connect: Network is unreachable) at ./check_profiles.pl line 35
at /usr/share/perl5/vendor_perl/WWW/Mechanize.pm line 2747
WWW::Mechanize::_die('Error ', 'GET', 'ing ', 'URI::https=SCALAR(0x3291d40)', ': ', 'Can\'t connect to account.example.com:443 (connect: Network is ...') called at /usr/share/perl5/vendor_perl/WWW/Mechanize.pm line 2734
WWW::Mechanize::die('WWW::Mechanize=HASH(0x31ce490)', 'Error ', 'GET', 'ing ', 'URI::https=SCALAR(0x3291d40)', ': ', 'Can\'t connect to account.example.com:443 (connect: Network is ...') called at /usr/share/perl5/vendor_perl/WWW/Mechanize.pm line 2383
WWW::Mechanize::_update_page('WWW::Mechanize=HASH(0x31ce490)', 'HTTP::Request=HASH(0x330f490)', 'HTTP::Response=HASH(0x3489c28)') called at /usr/share/perl5/vendor_perl/WWW/Mechanize.pm line 2213
WWW::Mechanize::request('WWW::Mechanize=HASH(0x31ce490)', 'HTTP::Request=HASH(0x330f490)') called at /usr/share/perl5/LWP/UserAgent.pm line 387
LWP::UserAgent::get('WWW::Mechanize=HASH(0x31ce490)', 'https://account.example.com/SSO/index.html') called at /usr/share/perl5/vendor_perl/WWW/Mechanize.pm line 407
WWW::Mechanize::get('WWW::Mechanize=HASH(0x31ce490)', 'https://account.example.com/SSO/index.html') called at ./check_profiles.pl line 35
如您所见,WWW::Mechanize 认为没有 443 访问 account.example.com,但事实并非如此。如果这是真的,我的整个应用程序就会崩溃,并且运行良好。这是进一步的证明:
> telnet account.example.com 443
Trying 2.2.2.2...
Connected to account.example.com.
Escape character is '^]'.
我不知道为什么会这样。任何人都可以根据调试信息确定问题,或提供任何进一步的帮助吗?谢谢!