-#!/usr/bin/perl
+#!/usr/local/bin/perl
=pod
use warnings;
use FindBin;
+use Convert::Base64;
use lib "$FindBin::Bin/lib", "$FindBin::Bin/../lib";
$opts{start},
$opts{end},
$opts{points},
- $opts{scaling}
+ $opts{scaling},
);
-graphError "No loadavg data found for system $opts{system}"
+graphError "No loadavg data"
unless @loads;
my (@x, @y);
-foreach (@loads) {
+for (@loads) {
my %load = %{$_};
if ($opts{tiny}) {
} # if
push @y, $load{loadavg};
-} # foreach
+} # for
my @data = ([@x], [@y]);
my $image = $graph->plot(\@data)
or croak $graph->error;
-print "Content-type: image/png\n\n";
-print $image->png;
+unless ($opts{generate}) {
+ print "Content-type: image/png\n\n";
+ print $image->png;
+} else {
+ print encode_base64 $image->png;
+} # unless
=pod
Copyright (c) 2010, ClearSCM, Inc. All rights reserved.
-=cut
\ No newline at end of file
+=cut