summaryrefslogtreecommitdiffabout
path: root/src
authorSergey Poznyakoff <gray@gnu.org.ua>2014-11-27 13:02:26 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2014-11-27 23:38:00 (GMT)
commit443bc6290a6a90b2c74612d7d68945e375af0ec3 (patch) (side-by-side diff)
tree9ce32a260699786b745fbc22e69a62973e8a556e /src
parent4090bd6ff268036b5fd1fdb0fe6d344fd25b5198 (diff)
downloadvarnish-mib-443bc6290a6a90b2c74612d7d68945e375af0ec3.tar.gz
varnish-mib-443bc6290a6a90b2c74612d7d68945e375af0ec3.tar.bz2
Implement backend statistics table.
* src/betab.c: New file. * src/Makefile.am (varnish_mib_la_SOURCES): Add betab.c * src/VARNISH-MIB.txt: Add backendTable oids * src/varnish_mib.mib2c: Implement totalPipeHeaderBytes, totalPipeIn, totalPipeOut, backendRequests and backendTable. * src/varnish-mib.8: Document changes.
Diffstat (limited to 'src') (more/less context) (ignore whitespace changes)
-rw-r--r--src/Makefile.am5
-rw-r--r--src/VARNISH-MIB.txt210
-rw-r--r--src/betab.c259
-rw-r--r--src/varnish-mib.863
-rw-r--r--src/varnish_mib.mib2c46
5 files changed, 575 insertions, 8 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 4643fde..a10abd1 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -20,6 +20,7 @@ dlmod_LTLIBRARIES = varnish-mib.la
varnish_mib_la_SOURCES = \
auth.c\
ban.c\
+ betab.c\
sha256.c\
sha256.h\
varnish_mib.c\
@@ -37,7 +38,7 @@ varnish_mib.c varnish_mib.h: varnish_mib.mib2c VARNISH-MIB.txt
mib2c -c $< -f $@ varnish
#NET_SNMP_INCLUDES = `$(NET_SNMP_CONFIG) --cflags`
-NET_SNMP_INCLUDES =
+#NET_SNMP_INCLUDES =
NET_SNMP_LIBS = `$(NET_SNMP_CONFIG) --libs`
NET_SNMP_EXLIBS = `$(NET_SNMP_CONFIG) --external-libs`
NET_SNMP_MIBDIRS = `net-snmp-config --mibdirs`
@@ -51,7 +52,7 @@ AM_LDFLAGS = \
$(NET_SNMP_LIBS)\
$(NET_SNMP_EXLIBS)
-AM_CPPFLAGS=-I. ${VARNISHAPI_CFLAGS} -I$NET_SNMP_INCLUDES
+AM_CPPFLAGS=-I. ${VARNISHAPI_CFLAGS}
mibdir=@MIBDIR@
mib_DATA = varnish_mib.mib2c
diff --git a/src/VARNISH-MIB.txt b/src/VARNISH-MIB.txt
index fe91735..bb6075d 100644
--- a/src/VARNISH-MIB.txt
+++ b/src/VARNISH-MIB.txt
@@ -14,18 +14,20 @@ IMPORTS
FROM SNMPv2-SMI
DateAndTime
FROM SNMPv2-TC
+ InetAddressIPv4, InetAddressIPv6, InetPortNumber,
+ FROM INET-ADDRESS-MIB
OBJECT-GROUP, MODULE-COMPLIANCE
FROM SNMPv2-CONF;
varnishMIB MODULE-IDENTITY
- LAST-UPDATED "201411261613Z"
+ LAST-UPDATED "201411280136Z"
ORGANIZATION "Shared Autonomous sYstems"
CONTACT-INFO "Morten Hermanrud <mhe@say.no>
Sergey Poznyakoff <gray@gnu.org>
"
DESCRIPTION
"This MIB module defines objects for Varnish reverse web proxy."
- REVISION "201411261044Z"
+ REVISION "201411280136Z"
DESCRIPTION
"Second revision."
::= { varnish 0 }
@@ -192,6 +194,168 @@ backendConnRetry OBJECT-TYPE
DESCRIPTION
"Backend connections retried."
::= { connections 8 }
+
+backendRequests OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Total backend requests made."
+ ::= { backend 2 }
+
+backendTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF VarnishBackendEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "A table of configured backends and their statistics"
+ ::= { backend 3 }
+
+varnishBackendEntry OBJECT-TYPE
+ SYNTAX VarnishBackendEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "An entry (conceptual row) describing a backend."
+ INDEX { vbeIndex }
+ ::= { backendTable 1 }
+
+VarnishBackendIdentString ::= TEXTUAL-CONVENTION
+ DISPLAY-HINT "256t"
+ STATUS current
+ DESCRIPTION "An identifier of a Varnish backend."
+ SYNTAX OCTET STRING (SIZE (0..256))
+
+varnishBackendEntry ::= SEQUENCE {
+ vbeIndex Integer32,
+ vbeIdent VarnishBackendIdentString,
+ vbeIPv4 InetAddressIPv4,
+ vbeIPv6 InetAddressIPv6,
+ vbePort InetPortNumber,
+ vbeHappyProbes Counter64,
+ vbeVcls Counter64,
+ vbeRequestHeaderBytes Counter64,
+ vbeRequestBodyBytes Counter64,
+ vbeResponseHeaderBytes Counter64,
+ vbeResponseBodyBytes Counter64,
+ vbePipeHeaderBytes Counter64,
+ vbePipeIn Counter64,
+ vbePipeOut Counter64
+}
+
+vbeIndex OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "A number uniquely identifying each backend."
+ ::= { varnishBackendEntry 1 }
+
+vbeIdent OBJECT-TYPE
+ SYNTAX VarnishBackendIdentString
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Textual identifier of the backend."
+ ::= { varnishBackendEntry 2 }
+
+vbeIPv4 OBJECT-TYPE
+ SYNTAX InetAddressIPv4
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "IPv4 address of the backend. Empty if the backend has no
+ IPv4 address."
+ ::= { varnishBackendEntry 3 }
+
+vbeIPv6 OBJECT-TYPE
+ SYNTAX InetAddressIPv6
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "IPv6 address of the backend. Empty if the backend has no
+ IPv6 address."
+ ::= { varnishBackendEntry 4 }
+
+vbePort OBJECT-TYPE
+ SYNTAX InetPortNumber
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Port number."
+ ::= { varnishBackendEntry 5 }
+
+vbeHappyProbes OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Number of successful health probes."
+ ::= { varnishBackendEntry 6 }
+
+vbeVcls OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Number of VCL references."
+ ::= { varnishBackendEntry 7 }
+
+vbeRequestHeaderBytes OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Total number of request header bytes sent to that backend."
+ ::= { varnishBackendEntry 8 }
+
+vbeRequestBodyBytes OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Total number of request body bytes sent to that backend."
+ ::= { varnishBackendEntry 9 }
+
+vbeResponseHeaderBytes OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Total number of response header bytes received from that backend."
+ ::= { varnishBackendEntry 10 }
+
+vbeResponseBodyBytes OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Total number of response body bytes received from that backend."
+ ::= { varnishBackendEntry 11 }
+
+vbePipeHeaderBytes OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Total number of header bytes piped to that backend."
+ ::= { varnishBackendEntry 12 }
+
+vbePipeIn OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Total number of bytes piped to that backend."
+ ::= { varnishBackendEntry 13 }
+
+vbePipeOut OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Total number of bytes piped from that backend."
+ ::= { varnishBackendEntry 14 }
totalSessions OBJECT-TYPE
SYNTAX Counter64
@@ -265,6 +429,30 @@ totalResponseBodyBytes OBJECT-TYPE
"Total response body bytes."
::= { total 9 }
+totalPipeHeaderBytes OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Total request header bytes received for piped sessions."
+ ::= { total 10 }
+
+totalPipeIn OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Total number of bytes forwarded from clients in pipe sessions."
+ ::= { total 11 }
+
+totalPipeOut OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Total number of bytes forwarded to clients in pipe sessions."
+ ::= { total 12 }
+
uptime OBJECT-TYPE
SYNTAX TimeTicks
MAX-ACCESS read-only
@@ -630,6 +818,20 @@ varnishGroup OBJECT-GROUP
backendConnRecycled,
backendConnUnused,
backendConnRetry,
+ backendRequests,
+ varnishBackendEntry,
+ vbeIPv4,
+ vbeIPv6,
+ vbePort,
+ vbeHappyProbes,
+ vbeVcls,
+ vbeRequestHeaderBytes,
+ vbeRequestBodyBytes,
+ vbeResponseHeaderBytes,
+ vbeResponseBodyBytes,
+ vbePipeHeaderBytes,
+ vbePipeIn,
+ vbePipeOut,
totalSessions,
totalRequests,
totalPipe,
@@ -639,11 +841,13 @@ varnishGroup OBJECT-GROUP
clientRequests411,
clientRequests413,
clientRequests417,
- backendConnRetry,
totalRequestHeaderBytes,
totalRequestBodyBytes,
totalResponseHeaderBytes,
totalResponseBodyBytes,
+ totalPipeHeaderBytes,
+ totalPipeIn,
+ totalPipeOut,
uptime,
sessAccepted,
sessQueued,
diff --git a/src/betab.c b/src/betab.c
new file mode 100644
index 0000000..3e10a9a
--- a/dev/null
+++ b/src/betab.c
@@ -0,0 +1,259 @@
+/* This file is part of varnish-mib
+ Copyright (C) 2014 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
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ Varnish-mib is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with varnish-mib. If not, see <http://www.gnu.org/licenses/>.
+*/
+#include "varnish_mib.h"
+#include <arpa/inet.h>
+
+unsigned backendTable_timeout = 5;
+
+void
+varnish_backend_table_timeout_parser(const char *token, char *line)
+{
+ varnish_mib_timeout_parser(token, line, &backendTable_timeout);
+}
+
+/*
+ * create a new row in the table
+ */
+static struct backendTable_entry *
+create_entry(netsnmp_tdata *table_data, long idx,
+ struct backendTable_entry *ent)
+{
+ struct backendTable_entry *entry;
+ netsnmp_tdata_row *row;
+
+ entry = SNMP_MALLOC_TYPEDEF(struct backendTable_entry);
+ if (!entry)
+ return NULL;
+
+ row = netsnmp_tdata_create_row();
+ if (!row) {
+ SNMP_FREE(entry);
+ return NULL;
+ }
+ row->data = entry;
+ *entry = *ent;
+
+ entry->vbeIndex = idx;
+ netsnmp_tdata_row_add_index(row, ASN_INTEGER,
+ &entry->vbeIndex,
+ sizeof(entry->vbeIndex));
+ if (table_data)
+ netsnmp_tdata_add_row(table_data, row);
+ return entry;
+}
+
+#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)
+
+struct betab_priv {
+ int err;
+ long idx;
+ struct backendTable_entry ent;
+ netsnmp_tdata *table;
+};
+
+struct betab_trans {
+ const char *name;
+ size_t off;
+};
+
+static struct betab_trans betab_trans[] = {
+ { "vcls",
+ offsetof(struct backendTable_entry, vbeVcls) },
+ { "happy",
+ offsetof(struct backendTable_entry, vbeHappyProbes) },
+ { "bereq_hdrbytes",
+ offsetof(struct backendTable_entry, vbeRequestHeaderBytes) },
+ { "bereq_bodybytes",
+ offsetof(struct backendTable_entry, vbeRequestBodyBytes) },
+ { "beresp_hdrbytes",
+ offsetof(struct backendTable_entry, vbeResponseHeaderBytes) },
+ { "beresp_bodybytes",
+ offsetof(struct backendTable_entry, vbeResponseBodyBytes) },
+ { "pipe_hdrbytes",
+ offsetof(struct backendTable_entry, vbePipeHeaderBytes) },
+ { "pipe_in",
+ offsetof(struct backendTable_entry, vbePipeIn) },
+ { "pipe_out",
+ offsetof(struct backendTable_entry, vbePipeOut) },
+ { NULL }
+};
+
+static int
+identcmp(struct betab_priv *bp, const char *ident)
+{
+ size_t len;
+ size_t i;
+
+ if (bp->idx == -1)
+ return 1;
+ for (i = 0; i < bp->ent.vbeIdent_len; i++, ident++)
+ if (bp->ent.vbeIdent[i] != *ident)
+ return 1;
+ if (*ident == '(' || *ident == 0)
+ return 0;
+ return 1;
+}
+
+static void
+uint32_to_bytes (unsigned char *bytes, uint32_t u)
+{
+ int i;
+
+ for (i = 0; i < 4; i++)
+ {
+ bytes[i] = u & 0xff;
+ u >>= 8;
+ }
+}
+
+static void
+scanbuf(const char *s, struct backendTable_entry *ent)
+{
+ char ipv4buf[16];
+ char ipv6buf[81];
+ unsigned long port;
+ char *p;
+ union {
+ struct in_addr in;
+ struct in6_addr in6;
+ } v;
+
+ if (*s != '(')
+ return;
+ ++s;
+ p = ipv4buf;
+ while (p < ipv4buf + sizeof(ipv4buf) && *s && *s != ',')
+ *p++ = *s++;
+ if (*s != ',')
+ return;
+ *p = 0;
+
+ ++s;
+ p = ipv6buf;
+ while (p < ipv6buf + sizeof(ipv6buf) && *s && *s != ',')
+ *p++ = *s++;
+ *p = 0;
+
+ ++s;
+ port = strtoul(s, &p, 10);
+ if (*p != ')' || port > USHRT_MAX)
+ return;
+
+ if (ipv4buf[0] && inet_pton(AF_INET, ipv4buf, &v)) {
+ ent->vbeIPv4_len = 4;
+ uint32_to_bytes(ent->vbeIPv4, v.in.s_addr);
+ }
+
+ if (ipv6buf[0] && inet_pton(AF_INET6, ipv6buf, &v)) {
+ ent->vbeIPv6_len = 16;
+ memcpy(ent->vbeIPv6, &v, ent->vbeIPv6_len);
+ }
+ ent->vbePort = port;
+}
+
+/* Process a single statistics point. See comment below. */
+static int
+create_entry_cb(void *priv, const struct VSC_point *const pt)
+{
+ struct betab_priv *bp = priv;
+ struct betab_trans *tp;
+
+ if (bp->err || !pt || strcmp(VSC_POINT_TYPE(pt), "VBE") ||
+ strcmp(VSC_POINT_FMT(pt), "uint64_t"))
+ return 0;
+ if (identcmp(bp, VSC_POINT_IDENT(pt))) {
+ const char *full_id;
+
+ if (bp->idx != -1
+ && !create_entry(bp->table, bp->idx, &bp->ent)) {
+ snmp_log(LOG_ERR, "out of memory\n");
+ bp->err = SNMP_ERR_GENERR;
+ return 0;
+ }
+
+ memset(&bp->ent, 0, sizeof(bp->ent));
+ bp->ent.vbeIndex = ++bp->idx;
+
+ full_id = VSC_POINT_IDENT(pt);
+ bp->ent.vbeIdent_len = strcspn(full_id, "(");
+ bp->ent.vbeIdent = malloc(bp->ent.vbeIdent_len);
+ if (!bp->ent.vbeIdent) {
+ snmp_log(LOG_ERR, "out of memory\n");
+ bp->err = SNMP_ERR_GENERR;
+ return 0;
+ }
+ memcpy(bp->ent.vbeIdent, full_id, bp->ent.vbeIdent_len);
+ full_id += bp->ent.vbeIdent_len;
+ scanbuf(full_id, &bp->ent);
+ }
+
+ for (tp = betab_trans; tp->name; tp++) {
+ if (strcmp(VSC_POINT_NAME(pt), tp->name) == 0) {
+ U64 *u = (U64*)((char*)&bp->ent + tp->off);
+ uint64_t n = *(const volatile uint64_t*)pt->ptr;
+ u->high = n >> 32;
+ u->low = n & 0xffffffff;
+ break;
+ }
+ }
+ return 0;
+}
+
+/* Varnish API does not provide access to struct VSC_C_vbe, so the only
+ way to backend statistics is to iterate over all statistics data, selecting
+ the entries marked as VBE. That's what this function does.
+ */
+int
+backendTable_load(netsnmp_cache *cache, void *vmagic)
+{
+ struct VSM_data *vd = varnish_get_vsm_data();
+ struct betab_priv bp;
+
+ bp.idx = -1;
+ bp.err = 0;
+ bp.table = (netsnmp_tdata *) vmagic;
+ memset(&bp.ent, 0, sizeof(bp.ent));
+
+ DEBUGMSGTL(("varnish_ban", "loading backend table"));
+ VSC_Iter(vd, NULL, create_entry_cb, &bp);
+ /* FIXME: perhaps handle bp.err separately */
+ if (bp.idx != -1) {
+ DEBUGMSGTL(("varnish_ban", "loaded %lu backend entries",
+ bp.idx + 1));
+ if (!create_entry(bp.table, bp.idx, &bp.ent))
+ snmp_log(LOG_ERR, "out of memory\n");
+ }
+ return 0;
+}
+
+void
+backendTable_free(netsnmp_cache *cache, void *vmagic)
+{
+ netsnmp_tdata *table = (netsnmp_tdata *) vmagic;
+ netsnmp_tdata_row *row;
+
+ DEBUGMSGTL(("varnish_ban", "freeing backend table"));
+ while ((row = netsnmp_tdata_row_first(table))) {
+ struct backendTable_entry *entry = row->data;
+ free(entry->vbeIdent);
+ SNMP_FREE(entry);
+ netsnmp_tdata_remove_and_delete_row(table, row);
+ }
+}
diff --git a/src/varnish-mib.8 b/src/varnish-mib.8
index e45ed0d..c2d37cd 100644
--- a/src/varnish-mib.8
+++ b/src/varnish-mib.8
@@ -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 27, 2014" "varnish-mib"
+.TH VARNISH-MIB 8 "November 28, 2014" "varnish-mib"
.SH NAME
varnish\-mib \- net-snmp module for obtaining Varnish Cache statistics
.SH SYNOPSIS
@@ -61,6 +61,9 @@ It can also be set remotely by assigning new value to the
\fBvarnishCLIPortTimeout\fR \fINUMBER\fR
Sets timeout for I/O operations with Varnish administrative port.
Default is 5 seconds.
+.TP
+\fBvarnishBackendTableTimeout\fR \fINUMBER\fR
+Update interval for \fBbackendTable\fR. Default is 5 seconds.
.SH OIDS
The following OIDs are defined:
.SS Branch \(dqclient\(dq
@@ -122,6 +125,55 @@ Number of unused backend connections.
.TP
.B backendConnRetry
Backend connections retried.
+.TP
+.B backendRequests
+Total backend requests made.
+.TP
+.B backendTable
+This branch provides a conceptual table of backends with the
+corresponding statistics. It is indexed by \fBvbeIndex\fR. Each row
+has the following elements:
+.RS
+.TP
+.B vbeIdent
+A string uniqiely identifying the backend.
+.TP
+.B vbeIPv4
+IPv4 address of the backend. Empty if the backend has no IPv4 address.
+.TP
+.B vbeIPv6
+IPv6 address of the backend. Empty if the backend has no IPv6 address.
+.TP
+.B vbePort
+Port number.
+.TP
+.B vbeHappyProbes
+Number of successful health probes.
+.TP
+.B vbeVcls
+Number of VCL references.
+.TP
+.B vbeRequestHeaderBytes
+Total number of request header bytes sent to that backend.
+.TP
+.B vbeRequestBodyBytes
+Total number of request body bytes sent to that backend.
+.TP
+.B vbeResponseHeaderBytes
+Total number of response header bytes received from that backend.
+.TP
+.B vbeResponseBodyBytes
+Total number of response body bytes received from that backend.
+.TP
+.B vbePipeHeaderBytes
+Total number of header bytes piped to that backend.
+.TP
+.B vbePipeIn
+Total number of bytes piped to that backend.
+.TP
+.B vbePipeOut
+Total number of bytes piped from that backend.
+.RE
.SS Branch \(dqtotal\(dq
.TP
.B totalSessions
@@ -150,6 +202,15 @@ Total header bytes sent out in responses.
.TP
.B totalResponseBodyBytes
Total body bytes sent out in responses.
+.TP
+.B totalPipeHeaderBytes
+Total request header bytes received for piped sessions.
+.TP
+.B totalPipeIn
+Total number of bytes forwarded from clients in pipe sessions.
+.TP
+.B totalPipeOut
+Total number of bytes forwarded to clients in pipe sessions.
.SS Branch \(dqmaster\(dq
.TP
.B uptime
diff --git a/src/varnish_mib.mib2c b/src/varnish_mib.mib2c
index 819ef1c..c120b0e 100644
--- a/src/varnish_mib.mib2c
+++ b/src/varnish_mib.mib2c
@@ -51,6 +51,7 @@ $vars{'varnish_translate'} = sub {
backendConnRecycled => [ 'MAIN', 'backend_recycle' ],
backendConnUnused => [ 'MAIN', 'backend_toolate' ],
backendConnRetry => [ 'MAIN', 'backend_retry' ],
+ backendRequests => [ 'MAIN', 'backend_req' ],
totalSessions => [ 'MAIN', 's_sess' ],
totalRequests => [ 'MAIN', 's_req' ],
@@ -61,7 +62,10 @@ $vars{'varnish_translate'} = sub {
totalRequestBodyBytes => [ 'MAIN', 's_req_bodybytes' ],
totalResponseHeaderBytes => [ 'MAIN', 's_resp_hdrbytes' ],
totalResponseBodyBytes => [ 'MAIN', 's_resp_bodybytes' ],
-
+ totalPipeHeaderBytes => [ 'MAIN', 's_pipe_hdrbytes' ],
+ totalPipeIn => [ 'MAIN', 's_pipe_in' ],
+ totalPipeOut => [ 'MAIN', 's_pipe_out' ],
+
sessAccepted => [ 'MAIN', 'sess_conn'],
sessQueued => [ 'MAIN', 'sess_queued'],
sessDropped => [ 'MAIN', 'sess_dropped'],
@@ -120,6 +124,17 @@ $vars{'varnish_translate'} = sub {
return 0;
};
+%field_dim_tab = (
+ vbeIPv4 => 4,
+ vbeIPv6 => 16
+);
+
+$vars{'set_field_dim'} = sub {
+ my $v = shift;
+ $vars{field_dim} = $field_dim_tab{$v};
+ return 0;
+};
+
$vars{'modulename'} = $vars{'name'};
$vars{'modulename'} =~ s#.*/##;
$vars{'modulename'} =~ s/\.c$//;
@@ -130,6 +145,7 @@ $vars{'modulename'} =~ s/\.c$//;
@open ${modulename}.h@
/* THIS FILE IS GENERATED AUTOMATICALLY. PLEASE DO NOT EDIT. */
#include <config.h>
+#include <stddef.h>
#include <stdlib.h>
#include <stdint.h>
@@ -169,7 +185,6 @@ int varnish_ban(netsnmp_agent_request_info *reqinfo,
int varnish_mib_timeout_parser(const char *token, char *line,
unsigned *retval);
-extern unsigned banTable_timeout;
void varnish_ban_table_timeout_parser(const char *token, char *line);
void varnish_vcli_timeout_parser(const char *token, char *line);
@@ -177,6 +192,8 @@ int varnish_ban_table_timeout_set(netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests,
struct VSM_data *vd);
+void varnish_backend_table_timeout_parser(const char *token, char *line);
+
@open ${name}@
/* THIS FILE IS GENERATED AUTOMATICALLY. PLEASE DO NOT EDIT. */
@@ -381,7 +398,14 @@ struct ${i}_entry {
/* Index values */
@foreach $idx index@
@if $idx.needlength@
+ @startperl@
+ &{$vars{'set_field_dim'}}($vars{'idx'});
+ @endperl@
+ @if $field_dim > 0@
+ $idx.decl $idx[$field_dim];
+ @else@
$idx.decl *$idx;
+ @end@
size_t ${idx}_len;
@else@
$idx.decl $idx;
@@ -392,7 +416,14 @@ struct ${i}_entry {
@foreach $c nonindex@
@if $c.readable@
@if $c.needlength@
+ @startperl@
+ &{$vars{'set_field_dim'}}($vars{'c'});
+ @endperl@
+ @if $field_dim > 0@
+ $c.decl ${c}[$field_dim];
+ @else@
$c.decl *$c;
+ @end@
size_t ${c}_len;
@else@
$c.decl $c;
@@ -401,6 +432,7 @@ struct ${i}_entry {
@end@
};
+extern unsigned ${i}_timeout;
int ${i}_load(netsnmp_cache *cache, void *vmagic);
void ${i}_free(netsnmp_cache *cache, void *vmagic);
@pop@
@@ -437,6 +469,10 @@ handle_table_${i}(
snmp_set_var_typed_value(request->requestvb, $c.type,
table_entry->$c,
table_entry->${c}_len);
+ @elsif $c.type eq 'ASN_COUNTER64'@@
+ snmp_set_var_typed_value(requests->requestvb, $c.type,
+ &table_entry->$c,
+ sizeof(table_entry->$c));
@else@
snmp_set_var_typed_integer(request->requestvb, $c.type,
table_entry->$c);
@@ -531,6 +567,12 @@ init_$modulename(void)
"varnishBanTableTimeout SECONDS"))
snmp_log(LOG_ERR,"can't register config handler\n");
+ if (!register_config_handler("snmpd", "varnishBackendTableTimeout",
+ varnish_backend_table_timeout_parser,
+ NULL,
+ "varnishBackendTableTimeout SECONDS"))
+ snmp_log(LOG_ERR,"can't register config handler\n");
+
if (!register_config_handler("snmpd", "varnishCLIPortTimeout",
varnish_vcli_timeout_parser,
NULL,

Return to:

Send suggestions and report system problems to the System administrator.