use CGI ':standard';
You don't appear to be using this anywhere in your script. Why not remove it?
my $cmd_1 = "sudo df -h |grep /var |awk '{print \$2}' | sed -e 's/.\$/
+/'";
my $cmd_2 = "sudo df -h |grep /var |awk '{print \$3}' | sed -e 's/.\$/
+/'";
my $result_used = qx/ $cmd_1 /; #$result_used shows 1.4
my $result_free = qx/ $cmd_2 /; #$result_free shows 85
You shell out, sudo and pipe through a grep an awk and a sed from perl! Twice. Let's try another way.
my @df = `df /var`;
my ($used, $free) = (split (/\s+/, $df[1]))[2,3];
Don't pass -h to df when using a script. You can easily end up with MB vs GB and then you'll have real confusion. Better yet, use something like Linux::Info::DiskUsage to avoid shelling out entirely.
I think Doughnut chart is NICER. But, I can't find many docs for them.
You already have the image as a pie so why not just overlay a background-coloured circle on the middle?
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|