-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathteststats.pl
executable file
·61 lines (55 loc) · 1.57 KB
/
teststats.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/perl
use strict;
use warnings;
my @ports = (0,
21512, 21512, 21512, 21512, 21512,
22522, 22522, 22522, 22522, 22522 );
my @counts= (0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0);
my @gauges= (0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0);
my @consts= (0,
1, 1, 1, 1, 1,
2, 2, 2, 2, 2);
while(1) {
my $i = 0;
my $date = scalar (localtime(time()));
foreach my $n (1, 2, 3, 4, 5, 6, 7, 8 ,9, 10) {
$i++;
my $port = $ports[$n];
my $const = $consts[$n];
my $host = "host_$n"."_".$port;
$counts[$n] += $n * 10 * 60;
$gauges[$n] = $n * 20;
print "$date\t$port\t$host\tfoo\t$counts[$n]\tbar\t$gauges[$n]\n";
`mondemand-tool -o lwes::172.16.101.128:$port -c host:$host -s counter:foo:$counts[$n] -s gauge:bar:$gauges[$n]`;
}
foreach my $l ([1,2,3,4,5], [6,7,8,9,10]) {
my %s = ('foo' => \@counts, 'bar' => \@gauges);
foreach my $m (keys %s) {
my @data = @{$s{$m}};
my $min = 5000000000;
my $max = -5000000000;
my $count = 0;
my $sum = 0;
my $port;
foreach my $n (@{$l}) {
$min = $data[$n] < $min ? $data[$n] : $min;
$max = $data[$n] > $max ? $data[$n] : $max;
$count++;
$sum += $data[$n];
$port = $ports[$n];
}
print "$date\t$port\t$m\tmin\t$min\n";
print "$date\t$port\t$m\tmax\t$max\n";
print "$date\t$port\t$m\tcount\t$count\n";
print "$date\t$port\t$m\tsum\t$sum\n";
}
}
foreach my $n (1,2,3,4,5,6,7,8,9,10) {
$gauges[$n] = 0;
}
sleep 60
}