hi Guys,
Maybe you know on how to resolve this issue from the apache template.
Our apache server stats is working using https upon access.. So, I have no idea why it didn't work now
Did you modify it in the above script, and it still failed to work? Or did you modify it in the SolarWinds template and it failed? There is no such module as HTTPS::Request, which would be why it's failing (search cpan.org). You should be able to just pass in an HTTPS url by changing the line you did to use https:// instead of http:// but leave the rest alone. For example:
my $req = new HTTP::Request GET => "https://$url";
Which Apache template are you using? It looks like it has a perl dependency that you may not have, or it isn't properly called out in the script. If you can provide a link to the template, we can look at it and see what's going on.
@ !Here's the template that I am using.
Thanks for the update. I did a quick skim and cannot find any reference to an HTTPS::Request, nor can I really find a perl module on cpan with that name either. There are calls to HTTP::Request, but that's not what is in your screen shot. Do you have shell access to the server? Can you perform a quick test? This is same code, so if you copy it into a perl script, for example ServerUptime.pl and then make it executable, and test it:
#!/usr/bin/perl### Copyright ¿ 1999-2008 SolarWinds, Inc. All Rights Reserved.##use LWP::UserAgent;if (@ARGV[0] =~ /\bhelp\b/){ print "ServerUptime.pl StatusURL\n"; print "StatusURL - url to apache server status (ex. www.mysite.com/server-status ) \n"; exit 1;}# Get hostname and trim newline$localhost = `hostname`;$localhost =~ s/\s*$//g;$hostname = shift || "localhost"; # $localhost$url = "$hostname/server-status?auto&match=www&errors=0";# Create a user agent object$ua = new LWP::UserAgent;$ua->agent("AgentName/0.1 " . $ua->agent);# Create a requestmy $req = new HTTP::Request GET => "http://$url";#print "http://$url\n";$req->content_type("application\/x-www-form-urlencoded");$req->content("match=www&errors=0");# Pass request to the user agent and get a response backmy $res = $ua->request($req);my $val ="";# Check the outcome of the responseif ($res->is_success) { #print $res->content; $content = $res->content; while ( $content =~ /Uptime:\s(\d+)/ig){ $hour = sprintf("%d",$1 / 3600); $min = sprintf("%d",($1-$hour*3600)/60); $sec = sprintf("%d",($1-$hour*3600-$min*60)); $sut = "${hour}h ${min}m ${sec}s"; print "Message: Server Uptime at host \"$hostname\" $sut\n"; print "statistic: $1\n"; exit 0; }} else { print "Message: unable access to $hostname\n"; print "Statistic: 0\n"; exit 1;}
You should be able to execute it using ./ServerUptime.pl. If you get the same error, try putting: "use HTTP::Request;" either before or after the "use LWP::UserAgent;".
I modified this line
my $req = new HTTP::Request GET => "http://$url"; --> my $req = new HTTPS::Request GET => "https://$url";
as we're using 443 than 80