in reply to doughnut charts with gd:graph
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?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: doughnut charts with gd:graph
by theravadamonk (Scribe) on Jul 25, 2018 at 11:53 UTC | |
by hippo (Archbishop) on Jul 25, 2018 at 13:06 UTC | |
by Tux (Canon) on Jul 26, 2018 at 11:31 UTC | |
by theravadamonk (Scribe) on Jul 26, 2018 at 10:30 UTC | |
Re^2: doughnut charts with gd:graph
by theravadamonk (Scribe) on Jul 30, 2018 at 04:42 UTC | |
by theravadamonk (Scribe) on Aug 01, 2018 at 04:15 UTC |