aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2016-04-27 14:26:04 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2016-04-27 15:02:18 +0300
commit94973146c58df26b20e17e2e5b1274216ca88969 (patch)
tree17538cc2991af0acec5bebfe6a826ef67cd9fc95 /src
parent319c154c46214fdc5d8f8b498ae5a23bc8d03072 (diff)
downloadvarnish-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.c8
-rw-r--r--src/varnish-mib.840
-rw-r--r--src/varnish_mib.mib2c39
-rw-r--r--src/vcli.c4
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
@@ -61,3 +61,9 @@ create_entry(netsnmp_tdata *table_data, long idx,
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
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,3 +1,3 @@
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.\"
@@ -15,3 +15,3 @@
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
@@ -29,3 +29,12 @@ loaded into
29as shown above (actual path can of course differ, depending on how 29as shown above (actual path can of course differ, depending on how
30the package was configured). 30the package was configured). Varnish version \fB4.0\fR and \fB4.1\fR
31are supported.
32.PP
33When 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
35located in \fB/var/lib/varnish/\fIHOSTNAME\fR and has mode \fB640\fR.
36Its owner is determined by the \fB\-j\fR (\fB\-\-jail\fR)
37\fBvarnishd\fR option. There are two ways to ensure it is readable:
38either make sure \fBsnmpd\fR and \fBvarnishd\fR run with the same user
39group, or use \fBsetfacl\fR(1) to tune access to that file.
31.PP 40.PP
@@ -36,4 +45,4 @@ administrative interface. For these to work, the module must have
36read access to Varnish secret file. In other words, the secret file 45read access to Varnish secret file. In other words, the secret file
37must be readable either by the user \fBsnmpd\fR runs as, or by one 46must be readable either by the user \fBsnmpd\fR runs as, or by its
38of this user's groups. 47group.
39.SH CONFIGURATION OPTIONS 48.SH CONFIGURATION OPTIONS
@@ -95,2 +104,13 @@ the backend before delivering it to the client.
95.TP 104.TP
105.B clientRequests400
106Client requests received, subject to 400 errors.
107.TP
108.B clientRequests411
109Client requests received, subject to 411 errors. This variable is
110available only in Varnish version \fR4.0\fR.
111.TP
112.B clientRequests413
113Client requests received, subject to 413 errors. This variable is
114available only in Varnish version \fR4.0\fR.
115.TP
96.B clientBan 116.B clientBan
@@ -130,3 +150,4 @@ unless the backend closes it.
130.B backendConnUnused 150.B backendConnUnused
131Number of unused backend connections. 151Number of unused backend connections. This variable is available only
152in Varnish version \fR4.0\fR.
132.TP 153.TP
@@ -239,3 +260,3 @@ Number of sessions closed.
239.B sessPipeline 260.B sessPipeline
240Session pipeline. 261Session pipeline. This variable is available only in Varnish version \fR4.0\fR.
241.TP 262.TP
@@ -254,3 +275,4 @@ Number of session accept failures.
254.B sessPipeOverflow 275.B sessPipeOverflow
255Number of session pipe overflows. 276Number of session pipe overflows. This variable is available only in
277Varnish version \fR4.0\fR.
256.SS Branch \(dqthreads\(dq 278.SS Branch \(dqthreads\(dq
@@ -359,3 +381,3 @@ Report bugs to <gray@gnu.org>.
359.SH COPYRIGHT 381.SH COPYRIGHT
360Copyright \(co 2014 Sergey Poznyakoff 382Copyright \(co 2014-2016 Sergey Poznyakoff
361.br 383.br
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,3 +1,3 @@
1# This file is part of varnish-mib -*- c -*- 1# This file is part of varnish-mib -*- c -*-
2# Copyright (C) 2014-2015 Sergey Poznyakoff 2# Copyright (C) 2014-2016 Sergey Poznyakoff
3# 3#
@@ -26,5 +26,3 @@
26@startperl@ 26@startperl@
27$vars{'varnish_translate'} = sub { 27$vars{'varnish_translate_table'} = {
28 my $name = shift;
29 my %trans = (
30 uptime => [ 'MAIN', 'uptime' ], 28 uptime => [ 'MAIN', 'uptime' ],
@@ -104,5 +102,8 @@ $vars{'varnish_translate'} = sub {
104 102
105 ); 103};
104
105$vars{'varnish_translate'} = sub {
106 my $name = shift;
106 107
107 my $r = $trans{$name}; 108 my $r = $vars{'varnish_translate_table'}->{$name};
108 if (!defined($r)) { 109 if (!defined($r)) {
@@ -119,2 +120,9 @@ $vars{'varnish_translate'} = sub {
119 } 120 }
121 if ($vars{'varnish_type'} eq 'MAIN') {
122 $vars{'varnish_if'} = "#if HAVE_STRUCT_VSC_C_MAIN_" . uc($vars{'varnish_member'});
123 $vars{'varnish_endif'} = '#endif';
124 } else {
125 delete $vars{'varnish_if'};
126 delete $vars{'varnish_endif'}
127 }
120 return 0; 128 return 0;
@@ -226,2 +234,6 @@ varnish_get_vsm_data()
226@foreach $i scalar@ 234@foreach $i scalar@
235 @startperl@
236 &{$vars{'varnish_translate'}}($vars{'i'});
237 @endperl@
238$varnish_if
227static int 239static int
@@ -236,6 +248,2 @@ handle_$i(netsnmp_mib_handler *handler,
236 248
237 @startperl@
238 &{$vars{'varnish_translate'}}($vars{'i'});
239 @endperl@
240
241 if (!varnish_get_vsm_data()) 249 if (!varnish_get_vsm_data())
@@ -361,2 +369,3 @@ handle_$i(netsnmp_mib_handler *handler,
361} 369}
370$varnish_endif
362@end@ 371@end@
@@ -545,3 +554,8 @@ init_$modulename(void)
545 @foreach $i scalar@ 554 @foreach $i scalar@
555 @startperl@
556 &{$vars{'varnish_translate'}}($vars{'i'});
557 @endperl@
558$varnish_if
546 const oid ${i}_oid[] = { $i.commaoid }; 559 const oid ${i}_oid[] = { $i.commaoid };
560$varnish_endif
547 @end@ 561 @end@
@@ -569,2 +583,6 @@ init_$modulename(void)
569 @foreach $i scalar@ 583 @foreach $i scalar@
584 @startperl@
585 &{$vars{'varnish_translate'}}($vars{'i'});
586 @endperl@
587$varnish_if
570 netsnmp_register_scalar( 588 netsnmp_register_scalar(
@@ -579,2 +597,3 @@ init_$modulename(void)
579 )); 597 ));
598$varnish_endif
580 @end@ 599 @end@
diff --git a/src/vcli.c b/src/vcli.c
index 736d9b3..c204cf3 100644
--- a/src/vcli.c
+++ b/src/vcli.c
@@ -441,3 +441,3 @@ vcli_connect(struct VSM_data *vd, struct vcli_conn *conn)
441 } 441 }
442 DEBUGMSGTL(("varnish_mib:vcli", "-T '%s'\n", vt.b)); 442 DEBUGMSGTL(("varnish_mib:vcli", "-T '%s'\n", (char*) vt.b));
443 443
@@ -491,3 +491,3 @@ vcli_connect(struct VSM_data *vd, struct vcli_conn *conn)
491 } 491 }
492 DEBUGMSGTL(("varnish_mib:vcli", "-S '%s'\n", vt.b)); 492 DEBUGMSGTL(("varnish_mib:vcli", "-S '%s'\n", (char*) vt.b));
493 s = strdup(vt.b); 493 s = strdup(vt.b);

Return to:

Send suggestions and report system problems to the System administrator.