Lines 1-806
Link Here
|
1 |
commit 0eebd2655842fbb634f67afd44fa4fdcf4e6f189 |
|
|
2 |
Author: Ruben Kerkhof <ruben@rubenkerkhof.com> |
3 |
Date: Sat Jul 4 22:49:49 2015 +0200 |
4 |
|
5 |
varnish: fix leak on read |
6 |
|
7 |
Since VSM_Close doesn't free the object we leak a few bytes |
8 |
every interval |
9 |
|
10 |
commit b208ddc7d08978f4cf52364c1935e94a0479ee42 |
11 |
Author: Marc Fournier <marc.fournier@camptocamp.com> |
12 |
Date: Wed Nov 4 21:12:36 2015 +0100 |
13 |
|
14 |
varnish: isolate varnish v2 code |
15 |
|
16 |
Segregating v2-specific code will allow reworking the v3 and v4 parts, |
17 |
while ensuring backwards compatibility with v2. |
18 |
|
19 |
The downside is that this leads to a large chunk of mostly duplicate |
20 |
code. That said, my suggestion would be to drop support for varnish v2 |
21 |
in collectd 5.6. |
22 |
|
23 |
NB: this commit breaks v3 and v4 support. |
24 |
|
25 |
commit d010d9eff882765201359959a583033dae4b373c |
26 |
Author: Marc Fournier <marc.fournier@camptocamp.com> |
27 |
Date: Wed Nov 4 22:57:00 2015 +0100 |
28 |
|
29 |
varnish: rework v3 and v4 support |
30 |
|
31 |
By using VSC_Iter() to loop over the list of metrics exposed by varnish, |
32 |
we can pick those we're interested *if they are found*. |
33 |
|
34 |
Not explicitly referring to metrics in the VSC_C_main struct makes the |
35 |
plugin more resilient to small differences between minor varnish |
36 |
versions. |
37 |
|
38 |
It also opens the possibility to monitor non-MAIN metrics, such as |
39 |
per-backend or per-storage engine stats. |
40 |
|
41 |
This patch should be compatible with the previous way of doing, from the |
42 |
user point of view. |
43 |
|
44 |
Fix #1302 |
45 |
|
46 |
commit 08bd4dd86e0fcb6828819cdf6bb3ae2115b1b8f4 |
47 |
Author: Marc Fournier <marc.fournier@camptocamp.com> |
48 |
Date: Thu Nov 5 10:23:19 2015 +0100 |
49 |
|
50 |
varnish: remove unused variable |
51 |
|
52 |
This was used in a DEBUG statement I didn't check in. |
53 |
|
54 |
--- src/varnish.c.orig 2015-03-10 14:14:45 UTC |
55 |
+++ src/varnish.c |
56 |
@@ -135,6 +135,397 @@ static int varnish_submit_derive (const |
57 |
return (varnish_submit (plugin_instance, category, type, type_instance, value)); |
58 |
} /* }}} int varnish_submit_derive */ |
59 |
|
60 |
+#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4 |
61 |
+static int varnish_monitor (void *priv, const struct VSC_point * const pt) /* {{{ */ |
62 |
+{ |
63 |
+ uint64_t val; |
64 |
+ const user_config_t *conf; |
65 |
+ const char *class; |
66 |
+ const char *name; |
67 |
+ |
68 |
+ if (pt == NULL) |
69 |
+ return (0); |
70 |
+ |
71 |
+ conf = priv; |
72 |
+ |
73 |
+#if HAVE_VARNISH_V4 |
74 |
+ class = pt->section->fantom->type; |
75 |
+ name = pt->desc->name; |
76 |
+ |
77 |
+ if (strcmp(class, "MAIN") != 0) |
78 |
+ return (0); |
79 |
+ |
80 |
+#elif HAVE_VARNISH_V3 |
81 |
+ class = pt->class; |
82 |
+ name = pt->name; |
83 |
+ |
84 |
+ if (strcmp(class, "") != 0) |
85 |
+ return (0); |
86 |
+#endif |
87 |
+ |
88 |
+ val = *(const volatile uint64_t*) pt->ptr; |
89 |
+ |
90 |
+ if (conf->collect_cache) |
91 |
+ { |
92 |
+ if (strcmp(name, "cache_hit") == 0) |
93 |
+ return varnish_submit_derive (conf->instance, "cache", "cache_result", "hit", val); |
94 |
+ else if (strcmp(name, "cache_miss") == 0) |
95 |
+ return varnish_submit_derive (conf->instance, "cache", "cache_result", "miss", val); |
96 |
+ else if (strcmp(name, "cache_hitpass") == 0) |
97 |
+ return varnish_submit_derive (conf->instance, "cache", "cache_result", "hitpass", val); |
98 |
+ } |
99 |
+ |
100 |
+ if (conf->collect_connections) |
101 |
+ { |
102 |
+ if (strcmp(name, "client_conn") == 0) |
103 |
+ return varnish_submit_derive (conf->instance, "connections", "connections", "accepted", val); |
104 |
+ else if (strcmp(name, "client_drop") == 0) |
105 |
+ return varnish_submit_derive (conf->instance, "connections", "connections", "dropped" , val); |
106 |
+ else if (strcmp(name, "client_req") == 0) |
107 |
+ return varnish_submit_derive (conf->instance, "connections", "connections", "received", val); |
108 |
+ } |
109 |
+ |
110 |
+#ifdef HAVE_VARNISH_V3 |
111 |
+ if (conf->collect_dirdns) |
112 |
+ { |
113 |
+ if (strcmp(name, "dir_dns_lookups") == 0) |
114 |
+ return varnish_submit_derive (conf->instance, "dirdns", "cache_operation", "lookups", val); |
115 |
+ else if (strcmp(name, "dir_dns_failed") == 0) |
116 |
+ return varnish_submit_derive (conf->instance, "dirdns", "cache_result", "failed", val); |
117 |
+ else if (strcmp(name, "dir_dns_hit") == 0) |
118 |
+ return varnish_submit_derive (conf->instance, "dirdns", "cache_result", "hits", val); |
119 |
+ else if (strcmp(name, "dir_dns_cache_full") == 0) |
120 |
+ return varnish_submit_derive (conf->instance, "dirdns", "cache_result", "cache_full", val); |
121 |
+ } |
122 |
+#endif |
123 |
+ |
124 |
+ if (conf->collect_esi) |
125 |
+ { |
126 |
+ if (strcmp(name, "esi_errors") == 0) |
127 |
+ return varnish_submit_derive (conf->instance, "esi", "total_operations", "error", val); |
128 |
+ else if (strcmp(name, "esi_parse") == 0) |
129 |
+ return varnish_submit_derive (conf->instance, "esi", "total_operations", "parsed", val); |
130 |
+ else if (strcmp(name, "esi_warnings") == 0) |
131 |
+ return varnish_submit_derive (conf->instance, "esi", "total_operations", "warning", val); |
132 |
+ } |
133 |
+ |
134 |
+ if (conf->collect_backend) |
135 |
+ { |
136 |
+ if (strcmp(name, "backend_conn") == 0) |
137 |
+ return varnish_submit_derive (conf->instance, "backend", "connections", "success", val); |
138 |
+ else if (strcmp(name, "backend_unhealthy") == 0) |
139 |
+ return varnish_submit_derive (conf->instance, "backend", "connections", "not-attempted", val); |
140 |
+ else if (strcmp(name, "backend_busy") == 0) |
141 |
+ return varnish_submit_derive (conf->instance, "backend", "connections", "too-many", val); |
142 |
+ else if (strcmp(name, "backend_fail") == 0) |
143 |
+ return varnish_submit_derive (conf->instance, "backend", "connections", "failures", val); |
144 |
+ else if (strcmp(name, "backend_reuse") == 0) |
145 |
+ return varnish_submit_derive (conf->instance, "backend", "connections", "reuses", val); |
146 |
+ else if (strcmp(name, "backend_toolate") == 0) |
147 |
+ return varnish_submit_derive (conf->instance, "backend", "connections", "was-closed", val); |
148 |
+ else if (strcmp(name, "backend_recycle") == 0) |
149 |
+ return varnish_submit_derive (conf->instance, "backend", "connections", "recycled", val); |
150 |
+ else if (strcmp(name, "backend_unused") == 0) |
151 |
+ return varnish_submit_derive (conf->instance, "backend", "connections", "unused", val); |
152 |
+ else if (strcmp(name, "backend_retry") == 0) |
153 |
+ return varnish_submit_derive (conf->instance, "backend", "connections", "retries", val); |
154 |
+ else if (strcmp(name, "backend_req") == 0) |
155 |
+ return varnish_submit_derive (conf->instance, "backend", "http_requests", "requests", val); |
156 |
+ else if (strcmp(name, "n_backend") == 0) |
157 |
+ return varnish_submit_gauge (conf->instance, "backend", "backends", "n_backends", val); |
158 |
+ } |
159 |
+ |
160 |
+ if (conf->collect_fetch) |
161 |
+ { |
162 |
+ if (strcmp(name, "fetch_head") == 0) |
163 |
+ return varnish_submit_derive (conf->instance, "fetch", "http_requests", "head", val); |
164 |
+ else if (strcmp(name, "fetch_length") == 0) |
165 |
+ return varnish_submit_derive (conf->instance, "fetch", "http_requests", "length", val); |
166 |
+ else if (strcmp(name, "fetch_chunked") == 0) |
167 |
+ return varnish_submit_derive (conf->instance, "fetch", "http_requests", "chunked", val); |
168 |
+ else if (strcmp(name, "fetch_eof") == 0) |
169 |
+ return varnish_submit_derive (conf->instance, "fetch", "http_requests", "eof", val); |
170 |
+ else if (strcmp(name, "fetch_bad") == 0) |
171 |
+ return varnish_submit_derive (conf->instance, "fetch", "http_requests", "bad_headers", val); |
172 |
+ else if (strcmp(name, "fetch_close") == 0) |
173 |
+ return varnish_submit_derive (conf->instance, "fetch", "http_requests", "close", val); |
174 |
+ else if (strcmp(name, "fetch_oldhttp") == 0) |
175 |
+ return varnish_submit_derive (conf->instance, "fetch", "http_requests", "oldhttp", val); |
176 |
+ else if (strcmp(name, "fetch_zero") == 0) |
177 |
+ return varnish_submit_derive (conf->instance, "fetch", "http_requests", "zero", val); |
178 |
+ else if (strcmp(name, "fetch_failed") == 0) |
179 |
+ return varnish_submit_derive (conf->instance, "fetch", "http_requests", "failed", val); |
180 |
+ else if (strcmp(name, "fetch_1xx") == 0) |
181 |
+ return varnish_submit_derive (conf->instance, "fetch", "http_requests", "no_body_1xx", val); |
182 |
+ else if (strcmp(name, "fetch_204") == 0) |
183 |
+ return varnish_submit_derive (conf->instance, "fetch", "http_requests", "no_body_204", val); |
184 |
+ else if (strcmp(name, "fetch_304") == 0) |
185 |
+ return varnish_submit_derive (conf->instance, "fetch", "http_requests", "no_body_304", val); |
186 |
+ } |
187 |
+ |
188 |
+ if (conf->collect_hcb) |
189 |
+ { |
190 |
+ if (strcmp(name, "hcb_nolock") == 0) |
191 |
+ return varnish_submit_derive (conf->instance, "hcb", "cache_operation", "lookup_nolock", val); |
192 |
+ else if (strcmp(name, "hcb_lock") == 0) |
193 |
+ return varnish_submit_derive (conf->instance, "hcb", "cache_operation", "lookup_lock", val); |
194 |
+ else if (strcmp(name, "hcb_insert") == 0) |
195 |
+ return varnish_submit_derive (conf->instance, "hcb", "cache_operation", "insert", val); |
196 |
+ } |
197 |
+ |
198 |
+ if (conf->collect_objects) |
199 |
+ { |
200 |
+ if (strcmp(name, "n_expired") == 0) |
201 |
+ return varnish_submit_derive (conf->instance, "objects", "total_objects", "expired", val); |
202 |
+ else if (strcmp(name, "n_lru_nuked") == 0) |
203 |
+ return varnish_submit_derive (conf->instance, "objects", "total_objects", "lru_nuked", val); |
204 |
+ else if (strcmp(name, "n_lru_saved") == 0) |
205 |
+ return varnish_submit_derive (conf->instance, "objects", "total_objects", "lru_saved", val); |
206 |
+ else if (strcmp(name, "n_lru_moved") == 0) |
207 |
+ return varnish_submit_derive (conf->instance, "objects", "total_objects", "lru_moved", val); |
208 |
+ else if (strcmp(name, "n_deathrow") == 0) |
209 |
+ return varnish_submit_derive (conf->instance, "objects", "total_objects", "deathrow", val); |
210 |
+ else if (strcmp(name, "losthdr") == 0) |
211 |
+ return varnish_submit_derive (conf->instance, "objects", "total_objects", "header_overflow", val); |
212 |
+ else if (strcmp(name, "n_obj_purged") == 0) |
213 |
+ return varnish_submit_derive (conf->instance, "objects", "total_objects", "purged", val); |
214 |
+ else if (strcmp(name, "n_objsendfile") == 0) |
215 |
+ return varnish_submit_derive (conf->instance, "objects", "total_objects", "sent_sendfile", val); |
216 |
+ else if (strcmp(name, "n_objwrite") == 0) |
217 |
+ return varnish_submit_derive (conf->instance, "objects", "total_objects", "sent_write", val); |
218 |
+ else if (strcmp(name, "n_objoverflow") == 0) |
219 |
+ return varnish_submit_derive (conf->instance, "objects", "total_objects", "workspace_overflow", val); |
220 |
+ } |
221 |
+ |
222 |
+#if HAVE_VARNISH_V3 |
223 |
+ if (conf->collect_ban) |
224 |
+ { |
225 |
+ if (strcmp(name, "n_ban") == 0) |
226 |
+ return varnish_submit_derive (conf->instance, "ban", "total_operations", "total", val); |
227 |
+ else if (strcmp(name, "n_ban_add") == 0) |
228 |
+ return varnish_submit_derive (conf->instance, "ban", "total_operations", "added", val); |
229 |
+ else if (strcmp(name, "n_ban_retire") == 0) |
230 |
+ return varnish_submit_derive (conf->instance, "ban", "total_operations", "deleted", val); |
231 |
+ else if (strcmp(name, "n_ban_obj_test") == 0) |
232 |
+ return varnish_submit_derive (conf->instance, "ban", "total_operations", "objects_tested", val); |
233 |
+ else if (strcmp(name, "n_ban_re_test") == 0) |
234 |
+ return varnish_submit_derive (conf->instance, "ban", "total_operations", "regexps_tested", val); |
235 |
+ else if (strcmp(name, "n_ban_dups") == 0) |
236 |
+ return varnish_submit_derive (conf->instance, "ban", "total_operations", "duplicate", val); |
237 |
+ } |
238 |
+#endif |
239 |
+#if HAVE_VARNISH_V4 |
240 |
+ if (conf->collect_ban) |
241 |
+ { |
242 |
+ if (strcmp(name, "bans") == 0) |
243 |
+ return varnish_submit_derive (conf->instance, "ban", "total_operations", "total", val); |
244 |
+ else if (strcmp(name, "bans_added") == 0) |
245 |
+ return varnish_submit_derive (conf->instance, "ban", "total_operations", "added", val); |
246 |
+ else if (strcmp(name, "bans_obj") == 0) |
247 |
+ return varnish_submit_derive (conf->instance, "ban", "total_operations", "obj", val); |
248 |
+ else if (strcmp(name, "bans_req") == 0) |
249 |
+ return varnish_submit_derive (conf->instance, "ban", "total_operations", "req", val); |
250 |
+ else if (strcmp(name, "bans_completed") == 0) |
251 |
+ return varnish_submit_derive (conf->instance, "ban", "total_operations", "completed", val); |
252 |
+ else if (strcmp(name, "bans_deleted") == 0) |
253 |
+ return varnish_submit_derive (conf->instance, "ban", "total_operations", "deleted", val); |
254 |
+ else if (strcmp(name, "bans_tested") == 0) |
255 |
+ return varnish_submit_derive (conf->instance, "ban", "total_operations", "tested", val); |
256 |
+ else if (strcmp(name, "bans_dups") == 0) |
257 |
+ return varnish_submit_derive (conf->instance, "ban", "total_operations", "duplicate", val); |
258 |
+ } |
259 |
+#endif |
260 |
+ |
261 |
+ if (conf->collect_session) |
262 |
+ { |
263 |
+ if (strcmp(name, "sess_closed") == 0) |
264 |
+ return varnish_submit_derive (conf->instance, "session", "total_operations", "closed", val); |
265 |
+ else if (strcmp(name, "sess_pipeline") == 0) |
266 |
+ return varnish_submit_derive (conf->instance, "session", "total_operations", "pipeline", val); |
267 |
+ else if (strcmp(name, "sess_readahead") == 0) |
268 |
+ return varnish_submit_derive (conf->instance, "session", "total_operations", "readahead", val); |
269 |
+ else if (strcmp(name, "sess_conn") == 0) |
270 |
+ return varnish_submit_derive (conf->instance, "session", "total_operations", "accepted", val); |
271 |
+ else if (strcmp(name, "sess_drop") == 0) |
272 |
+ return varnish_submit_derive (conf->instance, "session", "total_operations", "dropped", val); |
273 |
+ else if (strcmp(name, "sess_fail") == 0) |
274 |
+ return varnish_submit_derive (conf->instance, "session", "total_operations", "failed", val); |
275 |
+ else if (strcmp(name, "sess_pipe_overflow") == 0) |
276 |
+ return varnish_submit_derive (conf->instance, "session", "total_operations", "overflow", val); |
277 |
+ else if (strcmp(name, "sess_queued") == 0) |
278 |
+ return varnish_submit_derive (conf->instance, "session", "total_operations", "queued", val); |
279 |
+ else if (strcmp(name, "sess_linger") == 0) |
280 |
+ return varnish_submit_derive (conf->instance, "session", "total_operations", "linger", val); |
281 |
+ else if (strcmp(name, "sess_herd") == 0) |
282 |
+ return varnish_submit_derive (conf->instance, "session", "total_operations", "herd", val); |
283 |
+ } |
284 |
+ |
285 |
+ if (conf->collect_shm) |
286 |
+ { |
287 |
+ if (strcmp(name, "shm_records") == 0) |
288 |
+ return varnish_submit_derive (conf->instance, "shm", "total_operations", "records", val); |
289 |
+ else if (strcmp(name, "shm_writes") == 0) |
290 |
+ return varnish_submit_derive (conf->instance, "shm", "total_operations", "writes", val); |
291 |
+ else if (strcmp(name, "shm_flushes") == 0) |
292 |
+ return varnish_submit_derive (conf->instance, "shm", "total_operations", "flushes", val); |
293 |
+ else if (strcmp(name, "shm_cont") == 0) |
294 |
+ return varnish_submit_derive (conf->instance, "shm", "total_operations", "contention", val); |
295 |
+ else if (strcmp(name, "shm_cycles") == 0) |
296 |
+ return varnish_submit_derive (conf->instance, "shm", "total_operations", "cycles", val); |
297 |
+ } |
298 |
+ |
299 |
+ if (conf->collect_sms) |
300 |
+ { |
301 |
+ if (strcmp(name, "sms_nreq") == 0) |
302 |
+ return varnish_submit_derive (conf->instance, "sms", "total_requests", "allocator", val); |
303 |
+ else if (strcmp(name, "sms_nobj") == 0) |
304 |
+ return varnish_submit_gauge (conf->instance, "sms", "requests", "outstanding", val); |
305 |
+ else if (strcmp(name, "sms_nbytes") == 0) |
306 |
+ return varnish_submit_gauge (conf->instance, "sms", "bytes", "outstanding", val); |
307 |
+ else if (strcmp(name, "sms_balloc") == 0) |
308 |
+ return varnish_submit_derive (conf->instance, "sms", "total_bytes", "allocated", val); |
309 |
+ else if (strcmp(name, "sms_bfree") == 0) |
310 |
+ return varnish_submit_derive (conf->instance, "sms", "total_bytes", "free", val); |
311 |
+ } |
312 |
+ |
313 |
+ if (conf->collect_struct) |
314 |
+ { |
315 |
+ if (strcmp(name, "n_sess_mem") == 0) |
316 |
+ return varnish_submit_gauge (conf->instance, "struct", "current_sessions", "sess_mem", val); |
317 |
+ else if (strcmp(name, "n_sess") == 0) |
318 |
+ return varnish_submit_gauge (conf->instance, "struct", "current_sessions", "sess", val); |
319 |
+ else if (strcmp(name, "n_object") == 0) |
320 |
+ return varnish_submit_gauge (conf->instance, "struct", "objects", "object", val); |
321 |
+ else if (strcmp(name, "n_vampireobject") == 0) |
322 |
+ return varnish_submit_gauge (conf->instance, "struct", "objects", "vampireobject", val); |
323 |
+ else if (strcmp(name, "n_objectcore") == 0) |
324 |
+ return varnish_submit_gauge (conf->instance, "struct", "objects", "objectcore", val); |
325 |
+ else if (strcmp(name, "n_waitinglist") == 0) |
326 |
+ return varnish_submit_gauge (conf->instance, "struct", "objects", "waitinglist", val); |
327 |
+ else if (strcmp(name, "n_objecthead") == 0) |
328 |
+ return varnish_submit_gauge (conf->instance, "struct", "objects", "objecthead", val); |
329 |
+ else if (strcmp(name, "n_smf") == 0) |
330 |
+ return varnish_submit_gauge (conf->instance, "struct", "objects", "smf", val); |
331 |
+ else if (strcmp(name, "n_smf_frag") == 0) |
332 |
+ return varnish_submit_gauge (conf->instance, "struct", "objects", "smf_frag", val); |
333 |
+ else if (strcmp(name, "n_smf_large") == 0) |
334 |
+ return varnish_submit_gauge (conf->instance, "struct", "objects", "smf_large", val); |
335 |
+ else if (strcmp(name, "n_vbe_conn") == 0) |
336 |
+ return varnish_submit_gauge (conf->instance, "struct", "objects", "vbe_conn", val); |
337 |
+ } |
338 |
+ |
339 |
+ if (conf->collect_totals) |
340 |
+ { |
341 |
+ if (strcmp(name, "s_sess") == 0) |
342 |
+ return varnish_submit_derive (conf->instance, "totals", "total_sessions", "sessions", val); |
343 |
+ else if (strcmp(name, "s_req") == 0) |
344 |
+ return varnish_submit_derive (conf->instance, "totals", "total_requests", "requests", val); |
345 |
+ else if (strcmp(name, "s_pipe") == 0) |
346 |
+ return varnish_submit_derive (conf->instance, "totals", "total_operations", "pipe", val); |
347 |
+ else if (strcmp(name, "s_pass") == 0) |
348 |
+ return varnish_submit_derive (conf->instance, "totals", "total_operations", "pass", val); |
349 |
+ else if (strcmp(name, "s_fetch") == 0) |
350 |
+ return varnish_submit_derive (conf->instance, "totals", "total_operations", "fetches", val); |
351 |
+ else if (strcmp(name, "s_synth") == 0) |
352 |
+ return varnish_submit_derive (conf->instance, "totals", "total_bytes", "synth", val); |
353 |
+ else if (strcmp(name, "s_req_hdrbytes") == 0) |
354 |
+ return varnish_submit_derive (conf->instance, "totals", "total_bytes", "req_header", val); |
355 |
+ else if (strcmp(name, "s_req_bodybytes") == 0) |
356 |
+ return varnish_submit_derive (conf->instance, "totals", "total_bytes", "req_body", val); |
357 |
+ else if (strcmp(name, "s_resp_hdrbytes") == 0) |
358 |
+ return varnish_submit_derive (conf->instance, "totals", "total_bytes", "resp_header", val); |
359 |
+ else if (strcmp(name, "s_resp_bodybytes") == 0) |
360 |
+ return varnish_submit_derive (conf->instance, "totals", "total_bytes", "resp_body", val); |
361 |
+ else if (strcmp(name, "s_pipe_hdrbytes") == 0) |
362 |
+ return varnish_submit_derive (conf->instance, "totals", "total_bytes", "pipe_header", val); |
363 |
+ else if (strcmp(name, "s_pipe_in") == 0) |
364 |
+ return varnish_submit_derive (conf->instance, "totals", "total_bytes", "pipe_in", val); |
365 |
+ else if (strcmp(name, "s_pipe_out") == 0) |
366 |
+ return varnish_submit_derive (conf->instance, "totals", "total_bytes", "pipe_out", val); |
367 |
+ else if (strcmp(name, "n_purges") == 0) |
368 |
+ return varnish_submit_derive (conf->instance, "totals", "total_operations", "purges", val); |
369 |
+ else if (strcmp(name, "s_hdrbytes") == 0) |
370 |
+ return varnish_submit_derive (conf->instance, "totals", "total_bytes", "header-bytes", val); |
371 |
+ else if (strcmp(name, "s_bodybytes") == 0) |
372 |
+ return varnish_submit_derive (conf->instance, "totals", "total_bytes", "body-bytes", val); |
373 |
+ else if (strcmp(name, "n_gzip") == 0) |
374 |
+ return varnish_submit_derive (conf->instance, "totals", "total_operations", "gzip", val); |
375 |
+ else if (strcmp(name, "n_gunzip") == 0) |
376 |
+ return varnish_submit_derive (conf->instance, "totals", "total_operations", "gunzip", val); |
377 |
+ } |
378 |
+ |
379 |
+ if (conf->collect_uptime) |
380 |
+ { |
381 |
+ if (strcmp(name, "uptime") == 0) |
382 |
+ return varnish_submit_gauge (conf->instance, "uptime", "uptime", "client_uptime", val); |
383 |
+ } |
384 |
+ |
385 |
+ if (conf->collect_vcl) |
386 |
+ { |
387 |
+ if (strcmp(name, "n_vcl") == 0) |
388 |
+ return varnish_submit_gauge (conf->instance, "vcl", "vcl", "total_vcl", val); |
389 |
+ else if (strcmp(name, "n_vcl_avail") == 0) |
390 |
+ return varnish_submit_gauge (conf->instance, "vcl", "vcl", "avail_vcl", val); |
391 |
+ else if (strcmp(name, "n_vcl_discard") == 0) |
392 |
+ return varnish_submit_gauge (conf->instance, "vcl", "vcl", "discarded_vcl", val); |
393 |
+ else if (strcmp(name, "vmods") == 0) |
394 |
+ return varnish_submit_gauge (conf->instance, "vcl", "objects", "vmod", val); |
395 |
+ } |
396 |
+ |
397 |
+ if (conf->collect_workers) |
398 |
+ { |
399 |
+ if (strcmp(name, "threads") == 0) |
400 |
+ return varnish_submit_gauge (conf->instance, "workers", "threads", "worker", val); |
401 |
+ else if (strcmp(name, "threads_created") == 0) |
402 |
+ return varnish_submit_derive (conf->instance, "workers", "total_threads", "created", val); |
403 |
+ else if (strcmp(name, "threads_failed") == 0) |
404 |
+ return varnish_submit_derive (conf->instance, "workers", "total_threads", "failed", val); |
405 |
+ else if (strcmp(name, "threads_limited") == 0) |
406 |
+ return varnish_submit_derive (conf->instance, "workers", "total_threads", "limited", val); |
407 |
+ else if (strcmp(name, "threads_destroyed") == 0) |
408 |
+ return varnish_submit_derive (conf->instance, "workers", "total_threads", "dropped", val); |
409 |
+ else if (strcmp(name, "thread_queue_len") == 0) |
410 |
+ return varnish_submit_derive (conf->instance, "workers", "queue_length", "threads", val); |
411 |
+ else if (strcmp(name, "n_wrk") == 0) |
412 |
+ return varnish_submit_gauge (conf->instance, "workers", "threads", "worker", val); |
413 |
+ else if (strcmp(name, "n_wrk_create") == 0) |
414 |
+ return varnish_submit_derive (conf->instance, "workers", "total_threads", "created", val); |
415 |
+ else if (strcmp(name, "n_wrk_failed") == 0) |
416 |
+ return varnish_submit_derive (conf->instance, "workers", "total_threads", "failed", val); |
417 |
+ else if (strcmp(name, "n_wrk_max") == 0) |
418 |
+ return varnish_submit_derive (conf->instance, "workers", "total_threads", "limited", val); |
419 |
+ else if (strcmp(name, "n_wrk_drop") == 0) |
420 |
+ return varnish_submit_derive (conf->instance, "workers", "total_threads", "dropped", val); |
421 |
+ else if (strcmp(name, "n_wrk_queue") == 0) |
422 |
+ return varnish_submit_derive (conf->instance, "workers", "total_requests", "queued", val); |
423 |
+ else if (strcmp(name, "n_wrk_overflow") == 0) |
424 |
+ return varnish_submit_derive (conf->instance, "workers", "total_requests", "overflowed", val); |
425 |
+ else if (strcmp(name, "n_wrk_queued") == 0) |
426 |
+ return varnish_submit_derive (conf->instance, "workers", "total_requests", "queued", val); |
427 |
+ else if (strcmp(name, "n_wrk_lqueue") == 0) |
428 |
+ return varnish_submit_derive (conf->instance, "workers", "total_requests", "queue_length", val); |
429 |
+ } |
430 |
+ |
431 |
+#if HAVE_VARNISH_V4 |
432 |
+ if (conf->collect_vsm) |
433 |
+ { |
434 |
+ if (strcmp(name, "vsm_free") == 0) |
435 |
+ return varnish_submit_gauge (conf->instance, "vsm", "bytes", "free", val); |
436 |
+ else if (strcmp(name, "vsm_used") == 0) |
437 |
+ return varnish_submit_gauge (conf->instance, "vsm", "bytes", "used", val); |
438 |
+ else if (strcmp(name, "vsm_cooling") == 0) |
439 |
+ return varnish_submit_gauge (conf->instance, "vsm", "bytes", "cooling", val); |
440 |
+ else if (strcmp(name, "vsm_overflow") == 0) |
441 |
+ return varnish_submit_gauge (conf->instance, "vsm", "bytes", "overflow", val); |
442 |
+ else if (strcmp(name, "vsm_overflowed") == 0) |
443 |
+ return varnish_submit_derive (conf->instance, "vsm", "total_bytes", "overflowed", val); |
444 |
+ } |
445 |
+#endif |
446 |
+ |
447 |
+ return (0); |
448 |
+ |
449 |
+} /* }}} static int varnish_monitor */ |
450 |
+#else /* if HAVE_VARNISH_V2 */ |
451 |
static void varnish_monitor (const user_config_t *conf, /* {{{ */ |
452 |
const c_varnish_stats_t *stats) |
453 |
{ |
454 |
@@ -150,41 +541,20 @@ static void varnish_monitor (const user_ |
455 |
|
456 |
if (conf->collect_connections) |
457 |
{ |
458 |
-#ifndef HAVE_VARNISH_V4 |
459 |
/* Client connections accepted */ |
460 |
varnish_submit_derive (conf->instance, "connections", "connections", "accepted", stats->client_conn); |
461 |
/* Connection dropped, no sess */ |
462 |
varnish_submit_derive (conf->instance, "connections", "connections", "dropped" , stats->client_drop); |
463 |
-#endif |
464 |
/* Client requests received */ |
465 |
varnish_submit_derive (conf->instance, "connections", "connections", "received", stats->client_req); |
466 |
} |
467 |
|
468 |
-#ifdef HAVE_VARNISH_V3 |
469 |
- if (conf->collect_dirdns) |
470 |
- { |
471 |
- /* DNS director lookups */ |
472 |
- varnish_submit_derive (conf->instance, "dirdns", "cache_operation", "lookups", stats->dir_dns_lookups); |
473 |
- /* DNS director failed lookups */ |
474 |
- varnish_submit_derive (conf->instance, "dirdns", "cache_result", "failed", stats->dir_dns_failed); |
475 |
- /* DNS director cached lookups hit */ |
476 |
- varnish_submit_derive (conf->instance, "dirdns", "cache_result", "hits", stats->dir_dns_hit); |
477 |
- /* DNS director full dnscache */ |
478 |
- varnish_submit_derive (conf->instance, "dirdns", "cache_result", "cache_full", stats->dir_dns_cache_full); |
479 |
- } |
480 |
-#endif |
481 |
- |
482 |
if (conf->collect_esi) |
483 |
{ |
484 |
/* ESI parse errors (unlock) */ |
485 |
varnish_submit_derive (conf->instance, "esi", "total_operations", "error", stats->esi_errors); |
486 |
-#if HAVE_VARNISH_V2 |
487 |
/* Objects ESI parsed (unlock) */ |
488 |
varnish_submit_derive (conf->instance, "esi", "total_operations", "parsed", stats->esi_parse); |
489 |
-#else |
490 |
- /* ESI parse warnings (unlock) */ |
491 |
- varnish_submit_derive (conf->instance, "esi", "total_operations", "warning", stats->esi_warnings); |
492 |
-#endif |
493 |
} |
494 |
|
495 |
if (conf->collect_backend) |
496 |
@@ -203,13 +573,8 @@ static void varnish_monitor (const user_ |
497 |
varnish_submit_derive (conf->instance, "backend", "connections", "was-closed" , stats->backend_toolate); |
498 |
/* Backend conn. recycles */ |
499 |
varnish_submit_derive (conf->instance, "backend", "connections", "recycled" , stats->backend_recycle); |
500 |
-#if HAVE_VARNISH_V2 |
501 |
/* Backend conn. unused */ |
502 |
varnish_submit_derive (conf->instance, "backend", "connections", "unused" , stats->backend_unused); |
503 |
-#else |
504 |
- /* Backend conn. retry */ |
505 |
- varnish_submit_derive (conf->instance, "backend", "connections", "retries" , stats->backend_retry); |
506 |
-#endif |
507 |
/* Backend requests mades */ |
508 |
varnish_submit_derive (conf->instance, "backend", "http_requests", "requests" , stats->backend_req); |
509 |
/* N backends */ |
510 |
@@ -236,14 +601,6 @@ static void varnish_monitor (const user_ |
511 |
varnish_submit_derive (conf->instance, "fetch", "http_requests", "zero" , stats->fetch_zero); |
512 |
/* Fetch failed */ |
513 |
varnish_submit_derive (conf->instance, "fetch", "http_requests", "failed" , stats->fetch_failed); |
514 |
-#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4 |
515 |
- /* Fetch no body (1xx) */ |
516 |
- varnish_submit_derive (conf->instance, "fetch", "http_requests", "no_body_1xx", stats->fetch_1xx); |
517 |
- /* Fetch no body (204) */ |
518 |
- varnish_submit_derive (conf->instance, "fetch", "http_requests", "no_body_204", stats->fetch_204); |
519 |
- /* Fetch no body (304) */ |
520 |
- varnish_submit_derive (conf->instance, "fetch", "http_requests", "no_body_304", stats->fetch_304); |
521 |
-#endif |
522 |
} |
523 |
|
524 |
if (conf->collect_hcb) |
525 |
@@ -262,32 +619,22 @@ static void varnish_monitor (const user_ |
526 |
varnish_submit_derive (conf->instance, "objects", "total_objects", "expired", stats->n_expired); |
527 |
/* N LRU nuked objects */ |
528 |
varnish_submit_derive (conf->instance, "objects", "total_objects", "lru_nuked", stats->n_lru_nuked); |
529 |
-#if HAVE_VARNISH_V2 |
530 |
/* N LRU saved objects */ |
531 |
varnish_submit_derive (conf->instance, "objects", "total_objects", "lru_saved", stats->n_lru_saved); |
532 |
-#endif |
533 |
/* N LRU moved objects */ |
534 |
varnish_submit_derive (conf->instance, "objects", "total_objects", "lru_moved", stats->n_lru_moved); |
535 |
-#if HAVE_VARNISH_V2 |
536 |
/* N objects on deathrow */ |
537 |
varnish_submit_derive (conf->instance, "objects", "total_objects", "deathrow", stats->n_deathrow); |
538 |
-#endif |
539 |
/* HTTP header overflows */ |
540 |
varnish_submit_derive (conf->instance, "objects", "total_objects", "header_overflow", stats->losthdr); |
541 |
-#if HAVE_VARNISH_V4 |
542 |
- /* N purged objects */ |
543 |
- varnish_submit_derive (conf->instance, "objects", "total_objects", "purged", stats->n_obj_purged); |
544 |
-#else |
545 |
/* Objects sent with sendfile */ |
546 |
varnish_submit_derive (conf->instance, "objects", "total_objects", "sent_sendfile", stats->n_objsendfile); |
547 |
/* Objects sent with write */ |
548 |
varnish_submit_derive (conf->instance, "objects", "total_objects", "sent_write", stats->n_objwrite); |
549 |
/* Objects overflowing workspace */ |
550 |
varnish_submit_derive (conf->instance, "objects", "total_objects", "workspace_overflow", stats->n_objoverflow); |
551 |
-#endif |
552 |
} |
553 |
|
554 |
-#if HAVE_VARNISH_V2 |
555 |
if (conf->collect_purge) |
556 |
{ |
557 |
/* N total active purges */ |
558 |
@@ -303,45 +650,6 @@ static void varnish_monitor (const user_ |
559 |
/* N duplicate purges removed */ |
560 |
varnish_submit_derive (conf->instance, "purge", "total_operations", "duplicate", stats->n_purge_dups); |
561 |
} |
562 |
-#endif |
563 |
-#if HAVE_VARNISH_V3 |
564 |
- if (conf->collect_ban) |
565 |
- { |
566 |
- /* N total active bans */ |
567 |
- varnish_submit_derive (conf->instance, "ban", "total_operations", "total", stats->n_ban); |
568 |
- /* N new bans added */ |
569 |
- varnish_submit_derive (conf->instance, "ban", "total_operations", "added", stats->n_ban_add); |
570 |
- /* N old bans deleted */ |
571 |
- varnish_submit_derive (conf->instance, "ban", "total_operations", "deleted", stats->n_ban_retire); |
572 |
- /* N objects tested */ |
573 |
- varnish_submit_derive (conf->instance, "ban", "total_operations", "objects_tested", stats->n_ban_obj_test); |
574 |
- /* N regexps tested against */ |
575 |
- varnish_submit_derive (conf->instance, "ban", "total_operations", "regexps_tested", stats->n_ban_re_test); |
576 |
- /* N duplicate bans removed */ |
577 |
- varnish_submit_derive (conf->instance, "ban", "total_operations", "duplicate", stats->n_ban_dups); |
578 |
- } |
579 |
-#endif |
580 |
-#if HAVE_VARNISH_V4 |
581 |
- if (conf->collect_ban) |
582 |
- { |
583 |
- /* N total active bans */ |
584 |
- varnish_submit_derive (conf->instance, "ban", "total_operations", "total", stats->bans); |
585 |
- /* N new bans added */ |
586 |
- varnish_submit_derive (conf->instance, "ban", "total_operations", "added", stats->bans_added); |
587 |
- /* N bans using obj */ |
588 |
- varnish_submit_derive (conf->instance, "ban", "total_operations", "obj", stats->bans_obj); |
589 |
- /* N bans using req */ |
590 |
- varnish_submit_derive (conf->instance, "ban", "total_operations", "req", stats->bans_req); |
591 |
- /* N new bans completed */ |
592 |
- varnish_submit_derive (conf->instance, "ban", "total_operations", "completed", stats->bans_completed); |
593 |
- /* N old bans deleted */ |
594 |
- varnish_submit_derive (conf->instance, "ban", "total_operations", "deleted", stats->bans_deleted); |
595 |
- /* N objects tested */ |
596 |
- varnish_submit_derive (conf->instance, "ban", "total_operations", "tested", stats->bans_tested); |
597 |
- /* N duplicate bans removed */ |
598 |
- varnish_submit_derive (conf->instance, "ban", "total_operations", "duplicate", stats->bans_dups); |
599 |
- } |
600 |
-#endif |
601 |
|
602 |
if (conf->collect_session) |
603 |
{ |
604 |
@@ -351,21 +659,8 @@ static void varnish_monitor (const user_ |
605 |
varnish_submit_derive (conf->instance, "session", "total_operations", "pipeline", stats->sess_pipeline); |
606 |
/* Session Read Ahead */ |
607 |
varnish_submit_derive (conf->instance, "session", "total_operations", "readahead", stats->sess_readahead); |
608 |
-#if HAVE_VARNISH_V4 |
609 |
- /* Sessions accepted */ |
610 |
- varnish_submit_derive (conf->instance, "session", "total_operations", "accepted", stats->sess_conn); |
611 |
- /* Sessions dropped for thread */ |
612 |
- varnish_submit_derive (conf->instance, "session", "total_operations", "dropped", stats->sess_drop); |
613 |
- /* Sessions accept failure */ |
614 |
- varnish_submit_derive (conf->instance, "session", "total_operations", "failed", stats->sess_fail); |
615 |
- /* Sessions pipe overflow */ |
616 |
- varnish_submit_derive (conf->instance, "session", "total_operations", "overflow", stats->sess_pipe_overflow); |
617 |
- /* Sessions queued for thread */ |
618 |
- varnish_submit_derive (conf->instance, "session", "total_operations", "queued", stats->sess_queued); |
619 |
-#else |
620 |
/* Session Linger */ |
621 |
varnish_submit_derive (conf->instance, "session", "total_operations", "linger", stats->sess_linger); |
622 |
-#endif |
623 |
/* Session herd */ |
624 |
varnish_submit_derive (conf->instance, "session", "total_operations", "herd", stats->sess_herd); |
625 |
} |
626 |
@@ -384,7 +679,6 @@ static void varnish_monitor (const user_ |
627 |
varnish_submit_derive (conf->instance, "shm", "total_operations", "cycles" , stats->shm_cycles); |
628 |
} |
629 |
|
630 |
-#if HAVE_VARNISH_V2 |
631 |
if (conf->collect_sm) |
632 |
{ |
633 |
/* allocator requests */ |
634 |
@@ -410,7 +704,6 @@ static void varnish_monitor (const user_ |
635 |
/* SMA bytes free */ |
636 |
varnish_submit_derive (conf->instance, "sma", "total_bytes", "free" , stats->sma_bfree); |
637 |
} |
638 |
-#endif |
639 |
|
640 |
if (conf->collect_sms) |
641 |
{ |
642 |
@@ -428,25 +721,14 @@ static void varnish_monitor (const user_ |
643 |
|
644 |
if (conf->collect_struct) |
645 |
{ |
646 |
-#if !HAVE_VARNISH_V4 |
647 |
/* N struct sess_mem */ |
648 |
varnish_submit_gauge (conf->instance, "struct", "current_sessions", "sess_mem", stats->n_sess_mem); |
649 |
/* N struct sess */ |
650 |
varnish_submit_gauge (conf->instance, "struct", "current_sessions", "sess", stats->n_sess); |
651 |
-#endif |
652 |
/* N struct object */ |
653 |
varnish_submit_gauge (conf->instance, "struct", "objects", "object", stats->n_object); |
654 |
-#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4 |
655 |
- /* N unresurrected objects */ |
656 |
- varnish_submit_gauge (conf->instance, "struct", "objects", "vampireobject", stats->n_vampireobject); |
657 |
- /* N struct objectcore */ |
658 |
- varnish_submit_gauge (conf->instance, "struct", "objects", "objectcore", stats->n_objectcore); |
659 |
- /* N struct waitinglist */ |
660 |
- varnish_submit_gauge (conf->instance, "struct", "objects", "waitinglist", stats->n_waitinglist); |
661 |
-#endif |
662 |
/* N struct objecthead */ |
663 |
varnish_submit_gauge (conf->instance, "struct", "objects", "objecthead", stats->n_objecthead); |
664 |
-#ifdef HAVE_VARNISH_V2 |
665 |
/* N struct smf */ |
666 |
varnish_submit_gauge (conf->instance, "struct", "objects", "smf", stats->n_smf); |
667 |
/* N small free smf */ |
668 |
@@ -455,7 +737,6 @@ static void varnish_monitor (const user_ |
669 |
varnish_submit_gauge (conf->instance, "struct", "objects", "smf_large", stats->n_smf_large); |
670 |
/* N struct vbe_conn */ |
671 |
varnish_submit_gauge (conf->instance, "struct", "objects", "vbe_conn", stats->n_vbe_conn); |
672 |
-#endif |
673 |
} |
674 |
|
675 |
if (conf->collect_totals) |
676 |
@@ -470,47 +751,12 @@ static void varnish_monitor (const user_ |
677 |
varnish_submit_derive (conf->instance, "totals", "total_operations", "pass", stats->s_pass); |
678 |
/* Total fetch */ |
679 |
varnish_submit_derive (conf->instance, "totals", "total_operations", "fetches", stats->s_fetch); |
680 |
-#if HAVE_VARNISH_V4 |
681 |
- /* Total synth */ |
682 |
- varnish_submit_derive (conf->instance, "totals", "total_bytes", "synth", stats->s_synth); |
683 |
- /* Request header bytes */ |
684 |
- varnish_submit_derive (conf->instance, "totals", "total_bytes", "req_header", stats->s_req_hdrbytes); |
685 |
- /* Request body byte */ |
686 |
- varnish_submit_derive (conf->instance, "totals", "total_bytes", "req_body", stats->s_req_bodybytes); |
687 |
- /* Response header bytes */ |
688 |
- varnish_submit_derive (conf->instance, "totals", "total_bytes", "resp_header", stats->s_resp_hdrbytes); |
689 |
- /* Response body byte */ |
690 |
- varnish_submit_derive (conf->instance, "totals", "total_bytes", "resp_body", stats->s_resp_bodybytes); |
691 |
- /* Pipe request header bytes */ |
692 |
- varnish_submit_derive (conf->instance, "totals", "total_bytes", "pipe_header", stats->s_pipe_hdrbytes); |
693 |
- /* Piped bytes from client */ |
694 |
- varnish_submit_derive (conf->instance, "totals", "total_bytes", "pipe_in", stats->s_pipe_in); |
695 |
- /* Piped bytes to client */ |
696 |
- varnish_submit_derive (conf->instance, "totals", "total_bytes", "pipe_out", stats->s_pipe_out); |
697 |
- /* Number of purge operations */ |
698 |
- varnish_submit_derive (conf->instance, "totals", "total_operations", "purges", stats->n_purges); |
699 |
-#else |
700 |
/* Total header bytes */ |
701 |
varnish_submit_derive (conf->instance, "totals", "total_bytes", "header-bytes", stats->s_hdrbytes); |
702 |
/* Total body byte */ |
703 |
varnish_submit_derive (conf->instance, "totals", "total_bytes", "body-bytes", stats->s_bodybytes); |
704 |
-#endif |
705 |
-#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4 |
706 |
- /* Gzip operations */ |
707 |
- varnish_submit_derive (conf->instance, "totals", "total_operations", "gzip", stats->n_gzip); |
708 |
- /* Gunzip operations */ |
709 |
- varnish_submit_derive (conf->instance, "totals", "total_operations", "gunzip", stats->n_gunzip); |
710 |
-#endif |
711 |
} |
712 |
|
713 |
-#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4 |
714 |
- if (conf->collect_uptime) |
715 |
- { |
716 |
- /* Client uptime */ |
717 |
- varnish_submit_gauge (conf->instance, "uptime", "uptime", "client_uptime", stats->uptime); |
718 |
- } |
719 |
-#endif |
720 |
- |
721 |
if (conf->collect_vcl) |
722 |
{ |
723 |
/* N vcl total */ |
724 |
@@ -519,28 +765,10 @@ static void varnish_monitor (const user_ |
725 |
varnish_submit_gauge (conf->instance, "vcl", "vcl", "avail_vcl", stats->n_vcl_avail); |
726 |
/* N vcl discarded */ |
727 |
varnish_submit_gauge (conf->instance, "vcl", "vcl", "discarded_vcl", stats->n_vcl_discard); |
728 |
-#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4 |
729 |
- /* Loaded VMODs */ |
730 |
- varnish_submit_gauge (conf->instance, "vcl", "objects", "vmod", stats->vmods); |
731 |
-#endif |
732 |
} |
733 |
|
734 |
if (conf->collect_workers) |
735 |
{ |
736 |
-#ifdef HAVE_VARNISH_V4 |
737 |
- /* total number of threads */ |
738 |
- varnish_submit_gauge (conf->instance, "workers", "threads", "worker", stats->threads); |
739 |
- /* threads created */ |
740 |
- varnish_submit_derive (conf->instance, "workers", "total_threads", "created", stats->threads_created); |
741 |
- /* thread creation failed */ |
742 |
- varnish_submit_derive (conf->instance, "workers", "total_threads", "failed", stats->threads_failed); |
743 |
- /* threads hit max */ |
744 |
- varnish_submit_derive (conf->instance, "workers", "total_threads", "limited", stats->threads_limited); |
745 |
- /* threads destroyed */ |
746 |
- varnish_submit_derive (conf->instance, "workers", "total_threads", "dropped", stats->threads_destroyed); |
747 |
- /* length of session queue */ |
748 |
- varnish_submit_derive (conf->instance, "workers", "queue_length", "threads", stats->thread_queue_len); |
749 |
-#else |
750 |
/* worker threads */ |
751 |
varnish_submit_gauge (conf->instance, "workers", "threads", "worker", stats->n_wrk); |
752 |
/* worker threads created */ |
753 |
@@ -551,37 +779,14 @@ static void varnish_monitor (const user_ |
754 |
varnish_submit_derive (conf->instance, "workers", "total_threads", "limited", stats->n_wrk_max); |
755 |
/* dropped work requests */ |
756 |
varnish_submit_derive (conf->instance, "workers", "total_threads", "dropped", stats->n_wrk_drop); |
757 |
-#ifdef HAVE_VARNISH_V2 |
758 |
/* queued work requests */ |
759 |
varnish_submit_derive (conf->instance, "workers", "total_requests", "queued", stats->n_wrk_queue); |
760 |
/* overflowed work requests */ |
761 |
varnish_submit_derive (conf->instance, "workers", "total_requests", "overflowed", stats->n_wrk_overflow); |
762 |
-#else /* HAVE_VARNISH_V3 */ |
763 |
- /* queued work requests */ |
764 |
- varnish_submit_derive (conf->instance, "workers", "total_requests", "queued", stats->n_wrk_queued); |
765 |
- /* work request queue length */ |
766 |
- varnish_submit_derive (conf->instance, "workers", "total_requests", "queue_length", stats->n_wrk_lqueue); |
767 |
-#endif |
768 |
-#endif |
769 |
- } |
770 |
- |
771 |
-#if HAVE_VARNISH_V4 |
772 |
- if (conf->collect_vsm) |
773 |
- { |
774 |
- /* Free VSM space */ |
775 |
- varnish_submit_gauge (conf->instance, "vsm", "bytes", "free", stats->vsm_free); |
776 |
- /* Used VSM space */ |
777 |
- varnish_submit_gauge (conf->instance, "vsm", "bytes", "used", stats->vsm_used); |
778 |
- /* Cooling VSM space */ |
779 |
- varnish_submit_gauge (conf->instance, "vsm", "bytes", "cooling", stats->vsm_cooling); |
780 |
- /* Overflow VSM space */ |
781 |
- varnish_submit_gauge (conf->instance, "vsm", "bytes", "overflow", stats->vsm_overflow); |
782 |
- /* Total overflowed VSM space */ |
783 |
- varnish_submit_derive (conf->instance, "vsm", "total_bytes", "overflowed", stats->vsm_overflowed); |
784 |
} |
785 |
-#endif |
786 |
|
787 |
} /* }}} void varnish_monitor */ |
788 |
+#endif |
789 |
|
790 |
#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4 |
791 |
static int varnish_read (user_data_t *ud) /* {{{ */ |
792 |
@@ -632,8 +837,12 @@ static int varnish_read (user_data_t *ud |
793 |
stats = VSC_Main(vd, NULL); |
794 |
#endif |
795 |
|
796 |
- varnish_monitor (conf, stats); |
797 |
- VSM_Close (vd); |
798 |
+#if HAVE_VARNISH_V3 |
799 |
+ VSC_Iter (vd, varnish_monitor, conf); |
800 |
+#else /* if HAVE_VARNISH_V4 */ |
801 |
+ VSC_Iter (vd, NULL, varnish_monitor, conf); |
802 |
+#endif |
803 |
+ VSM_Delete (vd); |
804 |
|
805 |
return (0); |
806 |
} /* }}} */ |