Hello, I am fairly new to perl programming.I am using a perl script to monitor apache web server.

I wanted to use the same script for monitoring http/https sites.Currently the script works great for any http site. I am not able to get it working for https sites.Below my code and apache2 settings on my remote server.

#!/usr/bin/perl use LWP::Simple; use strict; my($url)="http://10.28.128.138/server-status?auto"; my($server_status)=get($url); my($total_accesses,$total_kbytes,$cpuload,$uptime, $reqpersec,$bytespe +rsec,$bytesperreq,$busyworkers, $idleworkers,$totalworkers); if (! $server_status) { print "Can't access $url\nCheck apache configuration\n\n"; exit(1); } # $total_accesses = $1 if ($server_status =~ /Total\ Accesses:\ ([\d|\.] ++)/ig)||0; $total_kbytes = $1 if ($server_status =~ /Total\ kBytes:\ ([\d|\.]+)/g +i); $cpuload = $1 if ($server_status =~ /CPULoad:\ ([\d|\.]+)/gi); $uptime = $1 if ($server_status =~ /Uptime:\ ([\d|\.]+)/gi); $reqpersec = $1 if ($server_status =~ /ReqPerSec:\ ([\d|\.]+)/gi); $bytespersec = $1 if ($server_status =~ /BytesPerSec:\ ([\d|\.]+)/gi); $bytesperreq = $1 if ($server_status =~ /BytesPerReq:\ ([\d|\.]+)/gi); $busyworkers = $1 if ($server_status =~ /BusyWorkers:\ ([\d|\.]+)/gi); $idleworkers = $1 if ($server_status =~ /IdleWorkers:\ ([\d|\.]+)/gi); $totalworkers = $busyworkers + $idleworkers; # #printf "TotalAccess %i:Total_kbytes %i:CPU-Load %.2f:reqpersec %.2f:b +ytespersec %.2f:bytesperreq %.2f:busyworkers %i:idleworkers %i:totalw +orkers %i\n",$total_accesses,$total_kbytes,$cpuload,$reqpersec,$bytes +persec,$bytesperreq,$busyworkers,$idleworkers,$totalworkers; print "busyworkers:$busyworkers bytesperreq:$bytesperreq bytespersec:$ +bytespersec CPULoad:$cpuload idleworkers:$idleworkers reqpersec:$reqp +ersec TotalAccess:$total_accesses totalworkers:$totalworkers Total_kb +ytes:$total_kbytes \n"; exit(0);
ExtendedStatus On <Location /server-status> SetHandler server-status Order deny,allow Deny from all Allow from 10.28.128.180 </Location>

Output

busyworkers:1 bytesperreq:1202.99 bytespersec:4.01738 CPULoad:5.52999 idleworkers:49 reqpersec:.0033395 TotalAccess:1087 totalworkers:50 Total_kbytes:1277

But when I change the url

my($url)="https://10.28.128.138/server-status?auto";

root@cacti-host:/var/www/cacti/scripts# ./check_apache.pl

Can't access https://10.28.128.138/server-status?auto

Check apache configuration

I wanted to know what needs to be changed in my script/apache2 settings to get it working for any https sites.Can anyone please help !!!I am trying to get it working from past two days with no luck still.


In reply to Apache statistics with perl by Shivaramakrishnan

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.