forked from juttle/juttle-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththroughput.juttle
More file actions
34 lines (29 loc) · 990 Bytes
/
Copy paththroughput.juttle
File metadata and controls
34 lines (29 loc) · 990 Bytes
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
function round(number, precision) {
// works with max precision of 15
var aux = Math.pow(10, precision);
return Math.round(number * aux) / aux;
}
(
read postgres -table 'kb_out'
-timeField 'time'
-from :2014-02-22T20:52:36.000Z: -to :2014-02-23T22:52:34.000Z:
| reduce -every :1h: value=sum(value) by host
| put value = round(value / 1024 / 1024, 2); // now in GB
read file -file '/incoming/disks.json'
)
| join host
|(
unbatch // to make the downstream reduce apply in aggregate instead of per hour
| reduce value = avg(value) by diskmodel
| sort value -desc
| filter value != 0
| view barchart -title 'Average hourly throughput by disk model, GB' -categoryField 'diskmodel' -row 0;
reduce -every :1h: sum(value) by region
|(
view timechart -title 'Hourly throughput by region, GB' -row 1 -col 0;
reduce sum(sum) by region
| put sum = round(sum, 2)
| sort sum -desc
| view table -title 'Total GB by region' -row 1 -col 1
);
)