I have five servers and want to measure the streams of each one and graph
it.
So I have a for loop, foreach (@hostname) ...
The data is pulled out of database with select statement.
The X axis is time say 1-5min. Naturally I want all of my graphs to show
from time 1 to five
with different colors for each server.
but instead I get five sets of 1-5min on the x axis. This displays
only one meaningless continuous
graph.######################################################################
# (2) Do the select statement (into $sql)
######################################################################
my @hostname = ('fig', 'dates', 'walnut','almond');
foreach $i(@hostname){
$hostname = $i;
$sql = qq{select time, streams from newcmstats where hostname="$hostname"
and date="$date" and
time>"$startTime" and cmup<2;};
$sth = $dbh->prepare ($sql)or die "Couldn't prepare statement: " .
$dbh->errstr;
$sth->execute();
my @result = $sth->execute or die "Couldn't execute statement: " .
$sth->errstr;
$streams = 0;
#}#end foreach
while (my @row = $sth->fetchrow_array())
{
my ($time, $streams) = (@row);
push @time, $time;
push @streams, $streams;
}
print @time, @streams;
$sth->finish();
}#end foreach
# Set up our data array
my @data = (\@time, \@streams);
# Send an appropriate MIME header
print $query->header(-type => "image/png");
# Create a graph object
my $graph = new GD::Graph::lines();
# Draw the graph
print $graph->plot(\@data);
---
You are currently subscribed to perl-win32-users as: [[email protected]]
To unsubscribe, forward this message to
[EMAIL PROTECTED]
For non-automated Mailing List support, send email to
[EMAIL PROTECTED]