summaryrefslogtreecommitdiffabout
path: root/src
Side-by-side diff
Diffstat (limited to 'src') (more/less context) (ignore whitespace changes)
-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
@@ -59,7 +59,13 @@ create_entry(netsnmp_tdata *table_data, long idx,
#define VSC_POINT_TYPE(p) ((p)->section->fantom->type)
#define VSC_POINT_IDENT(p) ((p)->section->fantom->ident)
#define VSC_POINT_NAME(p) ((p)->desc->name)
-#define VSC_POINT_FMT(p) ((p)->desc->fmt)
+#if VARNISHAPI_MINOR == 0
+# define VSC_POINT_FMT(p) ((p)->desc->fmt)
+#elif VARNISHAPI_MINOR == 1
+# define VSC_POINT_FMT(p) ((p)->desc->ctype)
+#else
+# error "unsupported Varnish API minor number"
+#endif
struct betab_priv {
int err;
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,5 +1,5 @@
.\" This file is part of Varnish-mib -*- nroff -*-
-.\" Copyright (C) 2014-2015 Sergey Poznyakoff
+.\" Copyright (C) 2014-2016 Sergey Poznyakoff
.\"
.\" Varnish-mib is free software; you can redistribute it and/or modify
.\" it under the terms of the GNU General Public License as published by
@@ -13,7 +13,7 @@
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with Varnish-mib. If not, see <http://www.gnu.org/licenses/>.
-.TH VARNISH-MIB 8 "November 28, 2014" "varnish-mib"
+.TH VARNISH-MIB 8 "April 27, 2016" "varnish-mib"
.SH NAME
varnish\-mib \- net-snmp module for obtaining Varnish Cache statistics
.SH SYNOPSIS
@@ -27,15 +27,24 @@ that provides access to Varnish Cache statistics. The module is
loaded into
.BR snmpd (8)
as shown above (actual path can of course differ, depending on how
-the package was configured).
+the package was configured). Varnish version \fB4.0\fR and \fB4.1\fR
+are supported.
+.PP
+When using with \fBVarnish\fR version \fB4.1\fR, make sure the
+\fB_.vsm\fR file is readable for \fBsnmpd\fR. This file is normally
+located in \fB/var/lib/varnish/\fIHOSTNAME\fR and has mode \fB640\fR.
+Its owner is determined by the \fB\-j\fR (\fB\-\-jail\fR)
+\fBvarnishd\fR option. There are two ways to ensure it is readable:
+either make sure \fBsnmpd\fR and \fBvarnishd\fR run with the same user
+group, or use \fBsetfacl\fR(1) to tune access to that file.
.PP
The module obtains most of the data using Varnish API. Information
about available bans (\fBbanTable\fR subtree) as well as the mechanism
for setting bans (\fBclientBan\fR OID) are implemented via \fBvarnishd\fR
administrative interface. For these to work, the module must have
read access to Varnish secret file. In other words, the secret file
-must be readable either by the user \fBsnmpd\fR runs as, or by one
-of this user's groups.
+must be readable either by the user \fBsnmpd\fR runs as, or by its
+group.
.SH CONFIGURATION OPTIONS
Configuration statements specific to
.B varnish\-mib
@@ -93,6 +102,17 @@ passes the request to the backend and this decision itself has been cached.
Number of misses. A cache miss indicates the object was fetched from
the backend before delivering it to the client.
.TP
+.B clientRequests400
+Client requests received, subject to 400 errors.
+.TP
+.B clientRequests411
+Client requests received, subject to 411 errors. This variable is
+available only in Varnish version \fR4.0\fR.
+.TP
+.B clientRequests413
+Client requests received, subject to 413 errors. This variable is
+available only in Varnish version \fR4.0\fR.
+.TP
.B clientBan
A write-only OID. When set, invalidates the cache using the supplied
value as argument to ban. When read, returns an empty string. E.g.,
@@ -128,7 +148,8 @@ the pool of connections. It has not yet been used, but it might be,
unless the backend closes it.
.TP
.B backendConnUnused
-Number of unused backend connections.
+Number of unused backend connections. This variable is available only
+in Varnish version \fR4.0\fR.
.TP
.B backendConnRetry
Backend connections retried.
@@ -237,7 +258,7 @@ Number of sessions dropped because session queue was full.
Number of sessions closed.
.TP
.B sessPipeline
-Session pipeline.
+Session pipeline. This variable is available only in Varnish version \fR4.0\fR.
.TP
.B sessReadAhead
Session read-ahead.
@@ -252,7 +273,8 @@ Number of sessions dropped for thread.
Number of session accept failures.
.TP
.B sessPipeOverflow
-Number of session pipe overflows.
+Number of session pipe overflows. This variable is available only in
+Varnish version \fR4.0\fR.
.SS Branch \(dqthreads\(dq
.TP
.B threadsPools
@@ -357,7 +379,7 @@ Sergey Poznyakoff
.SH "BUG REPORTS"
Report bugs to <gray@gnu.org>.
.SH COPYRIGHT
-Copyright \(co 2014 Sergey Poznyakoff
+Copyright \(co 2014-2016 Sergey Poznyakoff
.br
.na
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
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,5 +1,5 @@
# This file is part of varnish-mib -*- c -*-
-# Copyright (C) 2014-2015 Sergey Poznyakoff
+# Copyright (C) 2014-2016 Sergey Poznyakoff
#
# Varnish-mib is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -24,9 +24,7 @@
*/
@enddefine@
@startperl@
-$vars{'varnish_translate'} = sub {
- my $name = shift;
- my %trans = (
+$vars{'varnish_translate_table'} = {
uptime => [ 'MAIN', 'uptime' ],
clientAcceptedConnections => [ 'MAIN', 'sess_conn' ],
clientRequestsReceived => [ 'MAIN', 'client_req' ],
@@ -102,9 +100,12 @@ $vars{'varnish_translate'} = sub {
bansPersistedBytes => [ 'MAIN', 'bans_persisted_bytes' ],
bansPersistedFragmentation => [ 'MAIN', 'bans_persisted_fragmentation' ],
- );
+};
+
+$vars{'varnish_translate'} = sub {
+ my $name = shift;
- my $r = $trans{$name};
+ my $r = $vars{'varnish_translate_table'}->{$name};
if (!defined($r)) {
print STDERR "no translation for $name!\n";
exit(1);
@@ -117,6 +118,13 @@ $vars{'varnish_translate'} = sub {
} else {
delete $vars{$setkw};
}
+ if ($vars{'varnish_type'} eq 'MAIN') {
+ $vars{'varnish_if'} = "#if HAVE_STRUCT_VSC_C_MAIN_" . uc($vars{'varnish_member'});
+ $vars{'varnish_endif'} = '#endif';
+ } else {
+ delete $vars{'varnish_if'};
+ delete $vars{'varnish_endif'}
+ }
return 0;
};
@@ -224,6 +232,10 @@ varnish_get_vsm_data()
*/
@foreach $i scalar@
+ @startperl@
+ &{$vars{'varnish_translate'}}($vars{'i'});
+ @endperl@
+$varnish_if
static int
handle_$i(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
@@ -234,10 +246,6 @@ handle_$i(netsnmp_mib_handler *handler,
int ret;
@end@
- @startperl@
- &{$vars{'varnish_translate'}}($vars{'i'});
- @endperl@
-
if (!varnish_get_vsm_data())
return SNMP_ERR_NOSUCHNAME;
@@ -359,6 +367,7 @@ handle_$i(netsnmp_mib_handler *handler,
return SNMP_ERR_NOERROR;
}
+$varnish_endif
@end@
@foreach $i table@
@@ -543,7 +552,12 @@ void
init_$modulename(void)
{
@foreach $i scalar@
+ @startperl@
+ &{$vars{'varnish_translate'}}($vars{'i'});
+ @endperl@
+$varnish_if
const oid ${i}_oid[] = { $i.commaoid };
+$varnish_endif
@end@
DEBUGMSGTL(("$modulename", "Initializing\n"));
@@ -567,6 +581,10 @@ init_$modulename(void)
snmp_log(LOG_ERR,"can't register config handler\n");
@foreach $i scalar@
+ @startperl@
+ &{$vars{'varnish_translate'}}($vars{'i'});
+ @endperl@
+$varnish_if
netsnmp_register_scalar(
netsnmp_create_handler_registration("$i", handle_$i,
${i}_oid, OID_LENGTH(${i}_oid),
@@ -577,6 +595,7 @@ init_$modulename(void)
HANDLER_CAN_RWRITE
@end@
));
+$varnish_endif
@end@
@foreach $i table@
initialize_table_$i();
diff --git a/src/vcli.c b/src/vcli.c
index 736d9b3..c204cf3 100644
--- a/src/vcli.c
+++ b/src/vcli.c
@@ -439,7 +439,7 @@ vcli_connect(struct VSM_data *vd, struct vcli_conn *conn)
snmp_log(LOG_ERR, "no -T arg in shared memory\n");
return SNMP_ERR_GENERR;
}
- DEBUGMSGTL(("varnish_mib:vcli", "-T '%s'\n", vt.b));
+ DEBUGMSGTL(("varnish_mib:vcli", "-T '%s'\n", (char*) vt.b));
s = strdup(vt.b);
if (!s) {
@@ -489,7 +489,7 @@ vcli_connect(struct VSM_data *vd, struct vcli_conn *conn)
snmp_log(LOG_ERR, "no -S arg in shared memory\n");
return SNMP_ERR_GENERR;
}
- DEBUGMSGTL(("varnish_mib:vcli", "-S '%s'\n", vt.b));
+ DEBUGMSGTL(("varnish_mib:vcli", "-S '%s'\n", (char*) vt.b));
s = strdup(vt.b);
if (!s) {
snmp_log(LOG_ERR, "out of memory\n");

Return to:

Send suggestions and report system problems to the System administrator.