Here is an example: this script would generate data.
#!/opt/local/bin/perl
use Data::Dumper;
use strict;
my $i=0;
my $startTime=time;
$startTime += $ARGV[0] + 5;
my $dTime = localtime( $startTime );
print "\n##################\nLAUNCHING REQUESTS\n COUNT: $ARGV[0]\n DELAY: | 1 \nThe scripts will fire at : $dTime\n##################\n\n";
while ( $ARGV[0] > $i )
{
$i++;
system("php avtestTimed.php $ARGV[0] $ARGV[2] $startTime");
print "RUN system('php avtestTimed.php $ARGV[0] $ARGV[2] $startTime'); \n";
sleep 1;
}
The Result on stdout is:
################## LAUNCHING REQUESTS COUNT: 5 DELAY: | 1 The scripts will fire at : Mon Dec 6 09:38:15 2010 ################## EXECUTING AT 0.00015100 1291646295 -- WITH SID 28a952711439a8f98e5acf807da3455c -- AGAINST test.yakabod.net RESPONSE RECEIVED FROM (https://test.yakabod.net/activityViewer/index.html) IN 1.5974318981171 RUN system('php avtestTimed.php 5 test.yakabod.net 1291646295'); EXECUTING AT 0.35701200 1291646299 -- WITH SID 492cdb3e3893d1fa6ea1a6e8b4961087 -- AGAINST test.yakabod.net RESPONSE RECEIVED FROM (https://test.yakabod.net/activityViewer/index.html) IN 1.5956890583038 RUN system('php avtestTimed.php 5 test.yakabod.net 1291646295'); EXECUTING AT 0.16751000 1291646304 -- WITH SID b97a379d2a73a9bb8df2ab0ee9665417 -- AGAINST test.yakabod.net RESPONSE RECEIVED FROM (https://test.yakabod.net/activityViewer/index.html) IN 1.5704379081726 RUN system('php avtestTimed.php 5 test.yakabod.net 1291646295'); EXECUTING AT 0.51596300 1291646308 -- WITH SID 997b017d830cdd357036a24dd77313e9 -- AGAINST test.yakabod.net RESPONSE RECEIVED FROM (https://test.yakabod.net/activityViewer/index.html) IN 1.5980801582336 RUN system('php avtestTimed.php 5 test.yakabod.net 1291646295'); EXECUTING AT 0.89809900 1291646312 -- WITH SID c512edc3491fb6ebc11ce72d547af201 -- AGAINST test.yakabod.net RESPONSE RECEIVED FROM (https://test.yakabod.net/activityViewer/index.html) IN 1.5987639427185 RUN system('php avtestTimed.php 5 test.yakabod.net 1291646295');
Now what i need to do is to take the two variables: 1. EXECUTING AT 0.51596300 1291646308 2. RESPONSE RECEIVED FROM (https:开发者_开发百科//test.yakabod.net/activityViewer/index.html) IN 1.5987639427185
and store them in teo variables: $exec_at $receive_at and update RRDTool with these values. Any hints on how i can do this ?, what i am trying to plot is : 1. line graphs for EXECUTING AT variable 2. Scatter graph for RESPONSE
Thanks, -Kamal.
You can use CPAN's RRD::Simple to plot this very quickly: simply create the rrd, and on each iteration call update with your data points. You should be able to adapt the example on the link to your script.
精彩评论