-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathmunin-plugin
executable file
·223 lines (209 loc) · 5.74 KB
/
munin-plugin
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
#!/usr/bin/env php
<?php
if ($argc > 1 && $argv[1] === 'config') {
echo <<<'EOT'
multigraph throttle_submitted
graph_title Crashes submitted
graph_period minute
graph_args --lower-limit 0
graph_vlabel crashes per ${graph_period}
graph_category throttle
graph_order accepted rejected_no_minidump rejected_no_steam rejected_rate_limit presubmitted submitted
presubmitted.label presubmitted
presubmitted.type DERIVE
presubmitted.min 0
presubmitted.colour COLOUR4
submitted.label submitted
submitted.type DERIVE
submitted.min 0
submitted.colour 000000
accepted.label accepted
accepted.type DERIVE
accepted.min 0
accepted.colour COLOUR0
accepted.draw AREASTACK
rejected_no_minidump.label rejected: no minidump
rejected_no_minidump.type DERIVE
rejected_no_minidump.min 0
rejected_no_minidump.colour COLOUR1
rejected_no_minidump.draw AREASTACK
rejected_no_steam.label rejected: no-steam
rejected_no_steam.type DERIVE
rejected_no_steam.min 0
rejected_no_steam.colour COLOUR2
rejected_no_steam.draw AREASTACK
rejected_rate_limit.label rejected: rate limited
rejected_rate_limit.type DERIVE
rejected_rate_limit.min 0
rejected_rate_limit.colour COLOUR3
rejected_rate_limit.draw AREASTACK
multigraph throttle_processed
graph_title Crashes processed
graph_period minute
graph_args --lower-limit 0
graph_vlabel crashes per ${graph_period}
graph_category throttle
graph_order failed processed needs_reprocessing
processed.label processed
processed.type DERIVE
processed.min 0
processed.colour COLOUR0
processed.draw AREASTACK
failed.label failed
failed.type DERIVE
failed.min 0
failed.colour COLOUR2
failed.draw AREASTACK
needs_reprocessing.label marked for reprocessing
needs_reprocessing.type DERIVE
needs_reprocessing.min 0
needs_reprocessing.colour COLOUR1
multigraph throttle_cleaned
graph_title Crashes cleaned
graph_period minute
graph_args --lower-limit 0
graph_vlabel crashes per ${graph_period}
graph_category throttle
graph_order limit old orphan
limit.label reached user limit
limit.type DERIVE
limit.min 0
limit.draw AREASTACK
old.label reached age limit
old.type DERIVE
old.min 0
old.draw AREASTACK
orphan.label orphaned minidumps
orphan.type DERIVE
orphan.min 0
orphan.colour 000000
multigraph throttle_symbols
graph_title Symbol lookups
graph_period minute
graph_args --lower-limit 0
graph_vlabel lookups per ${graph_period}
graph_category throttle
graph_order missing_memory missing found cached found_memory
missing_memory.label missing cached
missing_memory.type DERIVE
missing_memory.min 0
missing_memory.colour COLOUR3
missing_memory.draw AREASTACK
missing.label missing
missing.type DERIVE
missing.min 0
missing.colour COLOUR2
missing.draw AREASTACK
found.label found compressed
found.type DERIVE
found.min 0
found.colour COLOUR0
found.draw AREASTACK
cached.label found
cached.type DERIVE
cached.min 0
cached.colour COLOUR1
cached.draw AREASTACK
found_memory.label found cached
found_memory.type DERIVE
found_memory.min 0
found_memory.colour COLOUR5
found_memory.draw AREASTACK
multigraph throttle_repocache
graph_title Symbol repo cache
graph_period minute
graph_args --lower-limit 0
graph_vlabel lookups per ${graph_period}
graph_category throttle
graph_order hit miss
miss.label miss
miss.type DERIVE
miss.min 0
miss.colour COLOUR2
miss.draw AREASTACK
hit.label hit
hit.type DERIVE
hit.min 0
hit.colour COLOUR0
hit.draw AREASTACK
multigraph throttle_userupdate
graph_title Users updated
graph_period minute
graph_args --lower-limit 0
graph_vlabel users per ${graph_period}
graph_category throttle
graph_order failed updated
updated.label updated
updated.type DERIVE
updated.min 0
updated.colour COLOUR0
updated.draw AREASTACK
failed.label failed
failed.type DERIVE
failed.min 0
failed.colour COLOUR2
failed.draw AREASTACK
multigraph throttle_processingtime
graph_title Processing duration
graph_category throttle
graph_vlabel duration (seconds)
min.label min
avg.label average
max.label max
EOT;
exit();
}
$redis = new \Redis();
$redis->connect('127.0.0.1', 6379, 1);
$stats = $redis->hGetAll('throttle:stats');
//print_r($stats);
list($times) = $redis->multi()
->lRange('throttle:stats:processing', 0, -1)
->del('throttle:stats:processing', 0, 0)
->exec();
$time_values = array_map(function($time) {
return (float)substr($time, strpos($time, ':') + 1);
}, $times);
$time_min = 'U';
$time_avg = 'U';
$time_max = 'U';
if (!empty($time_values)) {
$time_min = min($time_values);
$time_avg = array_sum($time_values) / count($time_values);
$time_max = max($time_values);
}
$redis->close();
echo <<<EOT
multigraph throttle_submitted
presubmitted.value {$stats['crashes:presubmitted']}
submitted.value {$stats['crashes:submitted']}
accepted.value {$stats['crashes:accepted']}
rejected_no_minidump.value {$stats['crashes:rejected:no-minidump']}
rejected_no_steam.value {$stats['crashes:rejected:no-steam']}
rejected_rate_limit.value {$stats['crashes:rejected:rate-limit']}
multigraph throttle_processed
processed.value {$stats['crashes:processed']}
failed.value {$stats['crashes:failed']}
needs_reprocessing.value {$stats['crashes:needs-reprocessing']}
multigraph throttle_cleaned
limit.value {$stats['crashes:cleaned:limit']}
old.value {$stats['crashes:cleaned:old']}
orphan.value {$stats['crashes:cleaned:orphan']}
multigraph throttle_symbols
missing_memory.value {$stats['symbols:missing-cached']}
missing.value {$stats['symbols:missing']}
found.value {$stats['symbols:found-compressed']}
cached.value {$stats['symbols:found']}
found_memory.value {$stats['symbols:found-cached']}
multigraph throttle_repocache
miss.value {$stats['symbols:repo-cache:miss']}
hit.value {$stats['symbols:repo-cache:hit']}
multigraph throttle_userupdate
updated.value {$stats['users:updated']}
failed.value {$stats['users:failed']}
multigraph throttle_processingtime
min.value {$time_min}
avg.value {$time_avg}
max.value {$time_max}
EOT;
//exit(1);