diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-04-27 14:26:04 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-04-27 15:02:18 +0300 |
commit | 94973146c58df26b20e17e2e5b1274216ca88969 (patch) | |
tree | 17538cc2991af0acec5bebfe6a826ef67cd9fc95 /src | |
parent | 319c154c46214fdc5d8f8b498ae5a23bc8d03072 (diff) | |
download | varnish-mib-94973146c58df26b20e17e2e5b1274216ca88969.tar.gz varnish-mib-94973146c58df26b20e17e2e5b1274216ca88969.tar.bz2 |
Support for Varnish 4.1
* NEWS: Update.
* bootstrap: Rewrite as a Perl script; create m4/varnish_mib.m4
from src/varnish_mib.mib2c
* configure.ac: Version 1.1.90
Use AC_CHECK_VSC_C_MAIN_MEMBERS
Define VARNISHAPI_MAJOR, VARNISHAPI_MINOR and
VARNISHAPI_PATCH for use in preprocessor directives.
* src/betab.c [VARNISHAPI_MINOR] (VSC_POINT_FMT): Define
depending on Varnish API minor version.
* src/varnish_mib.mib2c (varnish_translate_table): New variable.
It is used both by varnish_translate in this module, and by
bootstrap to produce a list of macros checking for members of
struct VSC_C_main.
Output preprocessor conditionals in right places.
* src/vcli.c (vcli_connect): Fix cc warnings.
* src/varnish-mib.8: Update.
Diffstat (limited to 'src')
-rw-r--r-- | src/betab.c | 8 | ||||
-rw-r--r-- | src/varnish-mib.8 | 40 | ||||
-rw-r--r-- | src/varnish_mib.mib2c | 39 | ||||
-rw-r--r-- | src/vcli.c | 4 |
4 files changed, 69 insertions, 22 deletions
diff --git a/src/betab.c b/src/betab.c index b583958..49e02f7 100644 --- a/src/betab.c +++ b/src/betab.c | |||
@@ -56,13 +56,19 @@ create_entry(netsnmp_tdata *table_data, long idx, | |||
56 | return entry; | 56 | return entry; |
57 | } | 57 | } |
58 | 58 | ||
59 | #define VSC_POINT_TYPE(p) ((p)->section->fantom->type) | 59 | #define VSC_POINT_TYPE(p) ((p)->section->fantom->type) |
60 | #define VSC_POINT_IDENT(p) ((p)->section->fantom->ident) | 60 | #define VSC_POINT_IDENT(p) ((p)->section->fantom->ident) |
61 | #define VSC_POINT_NAME(p) ((p)->desc->name) | 61 | #define VSC_POINT_NAME(p) ((p)->desc->name) |
62 | #define VSC_POINT_FMT(p) ((p)->desc->fmt) | 62 | #if VARNISHAPI_MINOR == 0 |
63 | # define VSC_POINT_FMT(p) ((p)->desc->fmt) | ||
64 | #elif VARNISHAPI_MINOR == 1 | ||
65 | # define VSC_POINT_FMT(p) ((p)->desc->ctype) | ||
66 | #else | ||
67 | # error "unsupported Varnish API minor number" | ||
68 | #endif | ||
63 | 69 | ||
64 | struct betab_priv { | 70 | struct betab_priv { |
65 | int err; | 71 | int err; |
66 | long idx; | 72 | long idx; |
67 | struct backendTable_entry ent; | 73 | struct backendTable_entry ent; |
68 | netsnmp_tdata *table; | 74 | netsnmp_tdata *table; |
diff --git a/src/varnish-mib.8 b/src/varnish-mib.8 index 4559b0c..0c54e6f 100644 --- a/src/varnish-mib.8 +++ b/src/varnish-mib.8 | |||
@@ -1,8 +1,8 @@ | |||
1 | .\" This file is part of Varnish-mib -*- nroff -*- | 1 | .\" This file is part of Varnish-mib -*- nroff -*- |
2 | .\" Copyright (C) 2014-2015 Sergey Poznyakoff | 2 | .\" Copyright (C) 2014-2016 Sergey Poznyakoff |
3 | .\" | 3 | .\" |
4 | .\" Varnish-mib is free software; you can redistribute it and/or modify | 4 | .\" Varnish-mib is free software; you can redistribute it and/or modify |
5 | .\" it under the terms of the GNU General Public License as published by | 5 | .\" it under the terms of the GNU General Public License as published by |
6 | .\" the Free Software Foundation; either version 3, or (at your option) | 6 | .\" the Free Software Foundation; either version 3, or (at your option) |
7 | .\" any later version. | 7 | .\" any later version. |
8 | .\" | 8 | .\" |
@@ -10,13 +10,13 @@ | |||
10 | .\" but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | .\" but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | .\" GNU General Public License for more details. | 12 | .\" GNU General Public License for more details. |
13 | .\" | 13 | .\" |
14 | .\" You should have received a copy of the GNU General Public License | 14 | .\" You should have received a copy of the GNU General Public License |
15 | .\" along with Varnish-mib. If not, see <http://www.gnu.org/licenses/>. | 15 | .\" along with Varnish-mib. If not, see <http://www.gnu.org/licenses/>. |
16 | .TH VARNISH-MIB 8 "November 28, 2014" "varnish-mib" | 16 | .TH VARNISH-MIB 8 "April 27, 2016" "varnish-mib" |
17 | .SH NAME | 17 | .SH NAME |
18 | varnish\-mib \- net-snmp module for obtaining Varnish Cache statistics | 18 | varnish\-mib \- net-snmp module for obtaining Varnish Cache statistics |
19 | .SH SYNOPSIS | 19 | .SH SYNOPSIS |
20 | In \fBsnmpd.conf\fR(5): | 20 | In \fBsnmpd.conf\fR(5): |
21 | .PP | 21 | .PP |
22 | .B dlmod varnish_mib /usr/lib/snmp/varnish\-mib.so | 22 | .B dlmod varnish_mib /usr/lib/snmp/varnish\-mib.so |
@@ -24,21 +24,30 @@ In \fBsnmpd.conf\fR(5): | |||
24 | Dynamically loadable object module for | 24 | Dynamically loadable object module for |
25 | .B net-snmp | 25 | .B net-snmp |
26 | that provides access to Varnish Cache statistics. The module is | 26 | that provides access to Varnish Cache statistics. The module is |
27 | loaded into | 27 | loaded into |
28 | .BR snmpd (8) | 28 | .BR snmpd (8) |
29 | as shown above (actual path can of course differ, depending on how | 29 | as shown above (actual path can of course differ, depending on how |
30 | the package was configured). | 30 | the package was configured). Varnish version \fB4.0\fR and \fB4.1\fR |
31 | are supported. | ||
32 | .PP | ||
33 | When using with \fBVarnish\fR version \fB4.1\fR, make sure the | ||
34 | \fB_.vsm\fR file is readable for \fBsnmpd\fR. This file is normally | ||
35 | located in \fB/var/lib/varnish/\fIHOSTNAME\fR and has mode \fB640\fR. | ||
36 | Its owner is determined by the \fB\-j\fR (\fB\-\-jail\fR) | ||
37 | \fBvarnishd\fR option. There are two ways to ensure it is readable: | ||
38 | either make sure \fBsnmpd\fR and \fBvarnishd\fR run with the same user | ||
39 | group, or use \fBsetfacl\fR(1) to tune access to that file. | ||
31 | .PP | 40 | .PP |
32 | The module obtains most of the data using Varnish API. Information | 41 | The module obtains most of the data using Varnish API. Information |
33 | about available bans (\fBbanTable\fR subtree) as well as the mechanism | 42 | about available bans (\fBbanTable\fR subtree) as well as the mechanism |
34 | for setting bans (\fBclientBan\fR OID) are implemented via \fBvarnishd\fR | 43 | for setting bans (\fBclientBan\fR OID) are implemented via \fBvarnishd\fR |
35 | administrative interface. For these to work, the module must have | 44 | administrative interface. For these to work, the module must have |
36 | read access to Varnish secret file. In other words, the secret file | 45 | read access to Varnish secret file. In other words, the secret file |
37 | must be readable either by the user \fBsnmpd\fR runs as, or by one | 46 | must be readable either by the user \fBsnmpd\fR runs as, or by its |
38 | of this user's groups. | 47 | group. |
39 | .SH CONFIGURATION OPTIONS | 48 | .SH CONFIGURATION OPTIONS |
40 | Configuration statements specific to | 49 | Configuration statements specific to |
41 | .B varnish\-mib | 50 | .B varnish\-mib |
42 | must appear in the | 51 | must appear in the |
43 | .B snmpd.conf | 52 | .B snmpd.conf |
44 | file below the | 53 | file below the |
@@ -90,12 +99,23 @@ Number of hits for pass. A cache hit for pass indicates that Varnish | |||
90 | passes the request to the backend and this decision itself has been cached. | 99 | passes the request to the backend and this decision itself has been cached. |
91 | .TP | 100 | .TP |
92 | .B clientCacheMisses | 101 | .B clientCacheMisses |
93 | Number of misses. A cache miss indicates the object was fetched from | 102 | Number of misses. A cache miss indicates the object was fetched from |
94 | the backend before delivering it to the client. | 103 | the backend before delivering it to the client. |
95 | .TP | 104 | .TP |
105 | .B clientRequests400 | ||
106 | Client requests received, subject to 400 errors. | ||
107 | .TP | ||
108 | .B clientRequests411 | ||
109 | Client requests received, subject to 411 errors. This variable is | ||
110 | available only in Varnish version \fR4.0\fR. | ||
111 | .TP | ||
112 | .B clientRequests413 | ||
113 | Client requests received, subject to 413 errors. This variable is | ||
114 | available only in Varnish version \fR4.0\fR. | ||
115 | .TP | ||
96 | .B clientBan | 116 | .B clientBan |
97 | A write-only OID. When set, invalidates the cache using the supplied | 117 | A write-only OID. When set, invalidates the cache using the supplied |
98 | value as argument to ban. When read, returns an empty string. E.g., | 118 | value as argument to ban. When read, returns an empty string. E.g., |
99 | to invalidate caches of all \fBpng\fR images: | 119 | to invalidate caches of all \fBpng\fR images: |
100 | 120 | ||
101 | .EE | 121 | .EE |
@@ -125,13 +145,14 @@ whenever Varnish reuses a recycled connection. | |||
125 | Number of backend connection recycles. This counter is increased | 145 | Number of backend connection recycles. This counter is increased |
126 | whenever Varnish has keep-alive connection that is put back into | 146 | whenever Varnish has keep-alive connection that is put back into |
127 | the pool of connections. It has not yet been used, but it might be, | 147 | the pool of connections. It has not yet been used, but it might be, |
128 | unless the backend closes it. | 148 | unless the backend closes it. |
129 | .TP | 149 | .TP |
130 | .B backendConnUnused | 150 | .B backendConnUnused |
131 | Number of unused backend connections. | 151 | Number of unused backend connections. This variable is available only |
152 | in Varnish version \fR4.0\fR. | ||
132 | .TP | 153 | .TP |
133 | .B backendConnRetry | 154 | .B backendConnRetry |
134 | Backend connections retried. | 155 | Backend connections retried. |
135 | .TP | 156 | .TP |
136 | .B backendRequests | 157 | .B backendRequests |
137 | Total backend requests made. | 158 | Total backend requests made. |
@@ -234,13 +255,13 @@ Number of times session was queued waiting for a thread. | |||
234 | Number of sessions dropped because session queue was full. | 255 | Number of sessions dropped because session queue was full. |
235 | .TP | 256 | .TP |
236 | .B sessClosed | 257 | .B sessClosed |
237 | Number of sessions closed. | 258 | Number of sessions closed. |
238 | .TP | 259 | .TP |
239 | .B sessPipeline | 260 | .B sessPipeline |
240 | Session pipeline. | 261 | Session pipeline. This variable is available only in Varnish version \fR4.0\fR. |
241 | .TP | 262 | .TP |
242 | .B sessReadAhead | 263 | .B sessReadAhead |
243 | Session read-ahead. | 264 | Session read-ahead. |
244 | .TP | 265 | .TP |
245 | .B sessHerd | 266 | .B sessHerd |
246 | Session herd. | 267 | Session herd. |
@@ -249,13 +270,14 @@ Session herd. | |||
249 | Number of sessions dropped for thread. | 270 | Number of sessions dropped for thread. |
250 | .TP | 271 | .TP |
251 | .B sessFail | 272 | .B sessFail |
252 | Number of session accept failures. | 273 | Number of session accept failures. |
253 | .TP | 274 | .TP |
254 | .B sessPipeOverflow | 275 | .B sessPipeOverflow |
255 | Number of session pipe overflows. | 276 | Number of session pipe overflows. This variable is available only in |
277 | Varnish version \fR4.0\fR. | ||
256 | .SS Branch \(dqthreads\(dq | 278 | .SS Branch \(dqthreads\(dq |
257 | .TP | 279 | .TP |
258 | .B threadsPools | 280 | .B threadsPools |
259 | Number of thread pools. | 281 | Number of thread pools. |
260 | .TP | 282 | .TP |
261 | .B threadsTotal | 283 | .B threadsTotal |
@@ -354,13 +376,13 @@ implementation-specific management. It is not used currently. | |||
354 | .BR varnishstat (1). | 376 | .BR varnishstat (1). |
355 | .SH AUTHORS | 377 | .SH AUTHORS |
356 | Sergey Poznyakoff | 378 | Sergey Poznyakoff |
357 | .SH "BUG REPORTS" | 379 | .SH "BUG REPORTS" |
358 | Report bugs to <gray@gnu.org>. | 380 | Report bugs to <gray@gnu.org>. |
359 | .SH COPYRIGHT | 381 | .SH COPYRIGHT |
360 | Copyright \(co 2014 Sergey Poznyakoff | 382 | Copyright \(co 2014-2016 Sergey Poznyakoff |
361 | .br | 383 | .br |
362 | .na | 384 | .na |
363 | License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> | 385 | License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> |
364 | .br | 386 | .br |
365 | .ad | 387 | .ad |
366 | This is free software: you are free to change and redistribute it. | 388 | This is free software: you are free to change and redistribute it. |
diff --git a/src/varnish_mib.mib2c b/src/varnish_mib.mib2c index a5367e0..9d49ce9 100644 --- a/src/varnish_mib.mib2c +++ b/src/varnish_mib.mib2c | |||
@@ -1,8 +1,8 @@ | |||
1 | # This file is part of varnish-mib -*- c -*- |