【问题标题】:How can i use one perl script to create/populate and draw a RRDTool graph我如何使用一个 perl 脚本来创建/填充和绘制 RRDTool 图
【发布时间】:2010-12-07 09:20:42
【问题描述】:

这里是一个例子:这个脚本会生成数据。


#!/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;
}

标准输出的结果是:

################## 启动请求 计数:5 延迟:| 1 脚本将在 2010 年 12 月 6 日星期一 09:38:15 触发 ################## 在 0.00015100 1291646295 处执行——使用 SID 28a952711439a8f98e5acf807da3455c——反对 test.yakabod.net 从 (https://test.yakabod.net/activityViewer/index.html) IN 1.5974318981171 收到的响应 运行系统('php avtestTimed.php 5 test.yakabod.net 1291646295'); 在 0.35701200 1291646299 处执行——使用 SID 492cdb3e3893d1fa6ea1a6e8b4961087——反对 test.yakabod.net 从 (https://test.yakabod.net/activityViewer/index.html) IN 1.5956890583038 收到的响应 运行系统('php avtestTimed.php 5 test.yakabod.net 1291646295'); 在 0.16751000 1291646304 处执行——使用 SID b97a379d2a73a9bb8df2ab0ee9665417——反对 test.yakabod.net 从 (https://test.yakabod.net/activityViewer/index.html) IN 1.5704379081726 收到的响应 运行系统('php avtestTimed.php 5 test.yakabod.net 1291646295'); 在 0.51596300 1291646308 处执行——使用 SID 997b017d830cdd357036a24dd77313e9——反对 test.yakabod.net 从 (https://test.yakabod.net/activityViewer/index.html) IN 1.5980801582336 收到的响应 运行系统('php avtestTimed.php 5 test.yakabod.net 1291646295'); 在 0.89809900 1291646312 处执行——使用 SID c512edc3491fb6ebc11ce72d547af201——反对 test.yakabod.net 从 (https://test.yakabod.net/activityViewer/index.html) IN 1.5987639427185 收到的响应 运行系统('php avtestTimed.php 5 test.yakabod.net 1291646295');

现在我需要做的是获取两个变量: 1.在0.51596300 1291646308执行 2. 从 (https://test.yakabod.net/activityViewer/index.html) IN 1.5987639427185 收到的响应

并将它们存储在 teo 变量中: $exec_at $receive_at 并使用这些值更新 RRDTool。 关于我如何做到这一点的任何提示?,我想要绘制的是: 1. EXECUTING AT 变量的折线图 2. RESPONSE的散点图

谢谢, -卡马尔。

【问题讨论】:

    标签: perl rrdtool


    【解决方案1】:

    您可以使用 CPAN 的 RRD::Simple 快速绘制此图:只需创建 rrd,并在每次迭代调用时使用您的数据点进行更新。您应该能够将链接上的示例改编为您的脚本。

    【讨论】:

      猜你喜欢
      • 2021-12-22
      • 2013-06-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-24
      • 1970-01-01
      • 2014-06-29
      • 2011-07-17
      • 2021-01-25
      相关资源
      最近更新 更多