aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2014-11-26 17:03:41 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2014-11-26 17:07:29 +0200
commitee352ea3182b86d7906e9cd0fefdd878a6f0fa49 (patch)
tree5ee5e647fab831a840777e07fc8ac4f9e41f271a
parent50813ca9aa276c72e6f766a5ecd23c1170273528 (diff)
downloadvarnish-mib-ee352ea3182b86d7906e9cd0fefdd878a6f0fa49.tar.gz
varnish-mib-ee352ea3182b86d7906e9cd0fefdd878a6f0fa49.tar.bz2
Implement control over the banTable update interval (timeout)
* configure.ac: Version 0.90.90 * NEWS: Likewise. * src/VARNISH-MIB.txt: New oid "agent.banTableTimeout" * src/ban.c: Implement setting the banTable timeout. * src/varnish_mib.mib2c: Register new configuration statement varnishBanTableTimeout; handle agent.banTableTimeout OID. * src/varnish-mib.8: Update.
-rw-r--r--NEWS4
-rw-r--r--configure.ac2
-rw-r--r--src/VARNISH-MIB.txt167
-rw-r--r--src/ban.c43
-rw-r--r--src/varnish-mib.8217
-rw-r--r--src/varnish_mib.mib2c38
6 files changed, 367 insertions, 104 deletions
diff --git a/NEWS b/NEWS
index 493f2b4..5a25842 100644
--- a/NEWS
+++ b/NEWS
@@ -1,13 +1,13 @@
-Varnish-mib NEWS -- history of user-visible changes. 2014-11-13
+Varnish-mib NEWS -- history of user-visible changes. 2014-11-26
Copyright (C) 2014 Sergey Poznyakoff
See the end of file for copying conditions.
Please send Vmod-binlog bug reports to <gray@gnu.org>
-Version 0.1, (git)
+Version 0.9.90, (git)
Initial release.
* Copyright information:
diff --git a/configure.ac b/configure.ac
index 6bce35c..451ecac 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12,13 +12,13 @@
# 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/>.
AC_PREREQ(2.69)
-AC_INIT([varnish-mib], 0.1, [gray@gnu.org])
+AC_INIT([varnish-mib], 0.9.90, [gray@gnu.org])
AC_CONFIG_SRCDIR(src/varnish_mib.mib2c)
AM_CONFIG_HEADER(config.h)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_SYSTEM
diff --git a/src/VARNISH-MIB.txt b/src/VARNISH-MIB.txt
index 47e39c8..fe91735 100644
--- a/src/VARNISH-MIB.txt
+++ b/src/VARNISH-MIB.txt
@@ -6,83 +6,87 @@ VARNISH-MIB DEFINITIONS ::= BEGIN
-- Varnish reverse proxy MIB
-- by Shared Autonomous sYstems
--
-- *************************************************************
IMPORTS
- MODULE-IDENTITY, OBJECT-TYPE, enterprises, Counter64, TimeTicks
+ MODULE-IDENTITY, OBJECT-TYPE, enterprises, Counter64, TimeTicks,
+ Unsigned32
FROM SNMPv2-SMI
DateAndTime
FROM SNMPv2-TC
OBJECT-GROUP, MODULE-COMPLIANCE
FROM SNMPv2-CONF;
varnishMIB MODULE-IDENTITY
- LAST-UPDATED "201411260759Z"
+ LAST-UPDATED "201411261613Z"
ORGANIZATION "Shared Autonomous sYstems"
- CONTACT-INFO "mhe@say.no"
+ CONTACT-INFO "Morten Hermanrud <mhe@say.no>
+ Sergey Poznyakoff <gray@gnu.org>
+ "
DESCRIPTION
"This MIB module defines objects for Varnish reverse web proxy."
- REVISION "201411260759Z"
+ REVISION "201411261044Z"
DESCRIPTION
- "Initial version."
+ "Second revision."
::= { varnish 0 }
varnish OBJECT IDENTIFIER ::= { enterprises 33043 6 1 }
client OBJECT IDENTIFIER ::= { varnish 1 }
backend OBJECT IDENTIFIER ::= { varnish 2 }
total OBJECT IDENTIFIER ::= { varnish 3 }
master OBJECT IDENTIFIER ::= { varnish 4 }
session OBJECT IDENTIFIER ::= { varnish 5 }
threads OBJECT IDENTIFIER ::= { varnish 6 }
bans OBJECT IDENTIFIER ::= { varnish 7 }
+agent OBJECT IDENTIFIER ::= { varnish 8 }
clientAcceptedConnections OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Client connections accepted"
+ "Client connections accepted."
::= { client 1 }
clientRequestsReceived OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Client requests received"
+ "Client requests received."
::= { client 2 }
clientCacheHits OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Cache hits"
+ "Cache hits."
::= { client 3 }
clientCacheHitsPass OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Cache hits for pass"
+ "Cache hits for pass."
::= { client 4 }
clientCacheMisses OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Cache misses"
+ "Cache misses."
::= { client 5 }
VarnishBanString ::= TEXTUAL-CONVENTION
DISPLAY-HINT "1024t"
STATUS current
- DESCRIPTION ""
+ DESCRIPTION "A string containing Varnish ban expression."
SYNTAX OCTET STRING (SIZE (0..1024))
clientBan OBJECT-TYPE
SYNTAX VarnishBanString
MAX-ACCESS read-write
STATUS current
@@ -93,466 +97,465 @@ clientBan OBJECT-TYPE
clientRequests400 OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Client requests received, subject to 400 errors"
+ "Client requests received, subject to 400 errors."
::= { client 7 }
clientRequests411 OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Client requests received, subject to 411 errors"
+ "Client requests received, subject to 411 errors."
::= { client 8 }
-
clientRequests413 OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Client requests received, subject to 413 errors"
+ "Client requests received, subject to 413 errors."
::= { client 9 }
clientRequests417 OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Client requests received, subject to 417 errors"
+ "Client requests received, subject to 417 errors."
::= { client 10 }
connections OBJECT IDENTIFIER ::= { backend 1 }
backendConnSuccess OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Backend connections success"
+ "Backend connections success."
::= { connections 1 }
backendConnNotAttempted OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Backend connections not attempted"
+ "Backend connections not attempted."
::= { connections 2 }
backendConnToMany OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Backend connections too many"
+ "Backend connections too many."
::= { connections 3 }
backendConnFailures OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Backend connections failures"
+ "Backend connections failures."
::= { connections 4 }
backendConnReuses OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Backend connections reuses"
+ "Backend connections reuses."
::= { connections 5 }
backendConnRecycled OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Backend connections recycles"
+ "Backend connections recycles."
::= { connections 6 }
backendConnUnused OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Backend connections unused"
+ "Backend connections unused."
::= { connections 7 }
backendConnRetry OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Backend connections retried"
+ "Backend connections retried."
::= { connections 8 }
totalSessions OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Total Sessions"
+ "Total Sessions."
::= { total 1 }
totalRequests OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Total Requests"
+ "Total Requests."
::= { total 2 }
totalPipe OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Total pipe"
+ "Total pipe."
::= { total 3 }
totalPass OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Total pass"
+ "Total pass."
::= { total 4 }
totalFetch OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Total fetch"
+ "Total fetch."
::= { total 5 }
totalRequestHeaderBytes OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Total request header bytes"
+ "Total request header bytes."
::= { total 6 }
totalRequestBodyBytes OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Total request body bytes"
+ "Total request body bytes."
::= { total 7 }
totalResponseHeaderBytes OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Total response body bytes"
+ "Total response body bytes."
::= { total 8 }
totalResponseBodyBytes OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Total response body bytes"
+ "Total response body bytes."
::= { total 9 }
uptime OBJECT-TYPE
SYNTAX TimeTicks
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Master daemon uptime"
+ "Master daemon uptime."
::= { master 1 }
sessAccepted OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Number of sessions succesfully accepted"
+ "Number of sessions succesfully accepted."
::= { session 1 }
sessQueued OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Number of times session was queued waiting for a thread"
+ "Number of times session was queued waiting for a thread."
::= { session 2 }
sessDropped OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Number of sessions dropped because session queue was full"
+ "Number of sessions dropped because session queue was full."
::= { session 3 }
sessClosed OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Number of sessions closed"
+ "Number of sessions closed."
::= { session 4 }
sessPipeline OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Session pipeline"
+ "Session pipeline."
::= { session 5 }
sessReadAhead OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Session read-ahead"
+ "Session read-ahead."
::= { session 6 }
sessHerd OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Session herd"
+ "Session herd."
::= { session 7 }
sessDrop OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Number of sessions dropped for thread"
+ "Number of sessions dropped for thread."
::= { session 8 }
sessFail OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Number of session accept failures"
+ "Number of session accept failures."
::= { session 9 }
sessPipeOverflow OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Number of session pipe overflows"
+ "Number of session pipe overflows."
::= { session 10 }
threadsPools OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Number of thread pools"
+ "Number of thread pools."
::= { threads 1 }
threadsTotal OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Number of thread pools"
+ "Number of thread pools."
::= { threads 2 }
threadsLimitHits OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Number of times more threads were needed, but limit was
- reached in a thread pool"
+ reached in a thread pool."
::= { threads 3 }
threadsCreated OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Total number of threads created in all pools"
+ "Total number of threads created in all pools."
::= { threads 4 }
threadsDestroyed OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Total number of threads destroyed in all pools"
+ "Total number of threads destroyed in all pools."
::= { threads 5 }
threadsFailed OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Number of times creating a thread failed"
+ "Number of times creating a thread failed."
::= { threads 6 }
threadsQueueLength OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Length of session queue waiting for threads"
+ "Length of session queue waiting for threads."
::= { threads 7 }
bansTotal OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Total number of bans"
+ "Total number of bans."
::= { bans 1 }
bansCompleted OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Count of completed bans"
+ "Count of completed bans."
::= { bans 2 }
bansObj OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Number of bans using obj.*"
+ "Number of bans using obj.*."
::= { bans 3 }
bansReq OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Number of bans using req.*"
+ "Number of bans using req.*."
::= { bans 4 }
bansAdded OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Number of bans added"
+ "Number of bans added."
::= { bans 5 }
bansDeleted OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Number of bans deleted"
+ "Number of bans deleted."
::= { bans 6 }
bansTested OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Number of bans tested against objects (lookup)"
+ "Number of bans tested against objects (lookup)."
::= { bans 7 }
bansObjectsKilled OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Number of objects killed by bans (lookup)"
+ "Number of objects killed by bans (lookup)."
::= { bans 8 }
bansLurkerTested OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Number of bans tested against objects (lurker)"
+ "Number of bans tested against objects (lurker)."
::= { bans 9 }
bansTestTested OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Number of ban tests tested against objects (lookup)"
+ "Number of ban tests tested against objects (lookup)."
::= { bans 10 }
bansLurkerTestTested OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Number of ban tests tested against objects (lurker)"
+ "Number of ban tests tested against objects (lurker)."
::= { bans 11 }
bansLurkerObjKilled OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Number of objects killed by bans (lurker)"
+ "Number of objects killed by bans (lurker)."
::= { bans 12 }
bansDups OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Number of ans superseded by other bans"
+ "Number of ans superseded by other bans."
::= { bans 13 }
bansLurkerContention OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Number of times lurker gave way for lookup"
+ "Number of times lurker gave way for lookup."
::= { bans 14 }
bansPersistedBytes OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Number of bytes used by the persisted ban lists"
+ "Number of bytes used by the persisted ban lists."
::= { bans 15 }
bansPersistedFragmentation OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Extra bytes in persisted ban lists due to fragmentation"
+ "Extra bytes in persisted ban lists due to fragmentation."
::= { bans 17 }
banTable OBJECT-TYPE
SYNTAX SEQUENCE OF VarnishBanEntry
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION
- "The (conceptual) table listing available bans"
+ "The (conceptual) table listing available bans."
::= { bans 18 }
varnishBanEntry OBJECT-TYPE
SYNTAX VarnishBanEntry
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION
- "An entry (conceptual row) representing a ban"
+ "An entry (conceptual row) representing a ban."
INDEX { banIndex }
::= { banTable 1 }
VarnishBanEntry ::= SEQUENCE {
banIndex Integer32,
banTime DateAndTime,
@@ -562,39 +565,48 @@ VarnishBanEntry ::= SEQUENCE {
banIndex OBJECT-TYPE
SYNTAX Integer32
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION
- "A number uniquely identifying each ban"
+ "A number uniquely identifying each ban."
::= { varnishBanEntry 1 }
banTime OBJECT-TYPE
SYNTAX DateAndTime
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Time when the ban was created"
+ "Time when the ban was created."
::= { varnishBanEntry 2 }
banRefCount OBJECT-TYPE
SYNTAX Counter32
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "Number of references to this ban"
+ "Number of references to this ban."
::= { varnishBanEntry 3 }
banExpression OBJECT-TYPE
SYNTAX VarnishBanString
MAX-ACCESS read-only
STATUS current
DESCRIPTION
- "VCL expression of the ban"
+ "VCL expression of the ban."
::= { varnishBanEntry 4 }
-
+
+banTableTimeout OBJECT-TYPE
+ SYNTAX Unsigned32
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "If banTable content is cached, this variable keeps
+ the time in seconds after which the table is reloaded.
+ Setting it changes that value."
+ ::= { agent 1 }
--
-- Groups and Compliance
--
varnishConfs OBJECT IDENTIFIER ::= { varnish 100 }
varnishGroups OBJECT IDENTIFIER ::= { varnishConfs 1 }
varnishCompl OBJECT IDENTIFIER ::= { varnishConfs 2 }
@@ -614,12 +626,13 @@ varnishGroup OBJECT-GROUP
backendConnNotAttempted,
backendConnToMany,
backendConnFailures,
backendConnReuses,
backendConnRecycled,
backendConnUnused,
+ backendConnRetry,
totalSessions,
totalRequests,
totalPipe,
totalPass,
totalFetch,
clientRequests400,
@@ -655,22 +668,22 @@ varnishGroup OBJECT-GROUP
banTime,
banRefCount,
banExpression
}
STATUS current
- DESCRIPTION "Group of Varnish objects"
+ DESCRIPTION "Group of Varnish objects."
::= { varnishGroups 1 }
--
-- Compliance
--
varnishStandardComplianceV1 MODULE-COMPLIANCE
STATUS current
DESCRIPTION
- "Compliance for an Varnish agent"
+ "Compliance for a Varnish agent."
MODULE
MANDATORY-GROUPS { varnishGroup }
::= { varnishCompl 1 }
@@ -678,9 +691,9 @@ END
-- Local variables:
-- eval: (add-hook 'write-file-hooks 'time-stamp)
-- time-stamp-start: "\\(LAST-UPDATED\\|REVISION\\) *\""
-- time-stamp-end: "\""
-- time-stamp-format: "%:y%02m%02d%02H%02MZ"
--- time-stamp-line-limit: 25
+-- time-stamp-line-limit: 32
-- time-stamp-count: 2
-- end:
diff --git a/src/ban.c b/src/ban.c
index a3941ab..4648f59 100644
--- a/src/ban.c
+++ b/src/ban.c
@@ -14,12 +14,13 @@
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 <ctype.h>
+#include <limits.h>
static int
send_ban_cmd(vcli_conn_t *conn, const char *expr)
{
if (vcli_asprintf(conn, "ban %s\n", expr) || vcli_write(conn))
return 1;
@@ -60,12 +61,54 @@ varnish_ban(netsnmp_agent_request_info *reqinfo,
free(expr);
return rc ? SNMP_ERR_GENERR : SNMP_ERR_NOERROR;
}
unsigned banTable_timeout = 60;
+void
+varnish_ban_table_timeout_parser(const char *token, char *line)
+{
+ char *p;
+ unsigned long n = strtoul(line, &p, 10);
+
+ if (*p) {
+ if (isspace(*p)) {
+ while (*p && isspace(*p))
+ ++p;
+ if (*p) {
+ config_perror("too many arguments");
+ return;
+ }
+ } else {
+ config_perror("invalid timeout value");
+ return;
+ }
+ }
+
+ if (n > UINT_MAX) {
+ config_perror("timeout value out of allowed range");
+ return;
+ }
+
+ banTable_timeout = n;
+}
+
+int
+varnish_ban_table_timeout_set(netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests,
+ struct VSM_data *vd)
+{
+ if (*requests->requestvb->val.integer < 0 ||
+ *requests->requestvb->val.integer > UINT_MAX)
+ return SNMP_ERR_BADVALUE;
+ DEBUGMSGTL(("varnish_ban", "setting banTable timeould %ld\n",
+ *requests->requestvb->val.integer));
+ banTable_timeout = *requests->requestvb->val.integer;
+ return SNMP_ERR_NOERROR;
+}
+
/*
* create a new row in the table
*/
static struct banTable_entry *
create_entry(netsnmp_tdata *table_data, long idx, struct banTable_entry *ent)
{
diff --git a/src/varnish-mib.8 b/src/varnish-mib.8
index 52d4411..af82000 100644
--- a/src/varnish-mib.8
+++ b/src/varnish-mib.8
@@ -10,96 +10,267 @@
.\" 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/>.
-.TH VARNISH-MIB 8 "November 15, 2014" "varnish-mib"
+.TH VARNISH-MIB 8 "November 26, 2014" "varnish-mib"
.SH NAME
varnish\-mib \- net\-snmp module for obtaining Varnish Cache statistics
.SH SYNOPSIS
In \fBsnmpd.conf\fR(5):
.br
.B dlmod varnish_mib /usr/lib/snmp/varnish-mib.so
.SH DESCRIPTION
Dynamically loadable object module for
.B net-snmp
-.BR snmpd (8),
that provides access to Varnish Cache statistics. The module is
loaded into
-.B snmpd
+.BR snmpd (8)
as shown above (actual path can of course differ, depending on how
the package was configured).
-.PP
+.SH CONFIGURATION OPTIONS
+Configuration statements specific to
+.B varnish\-mib
+must appear in the
+.B snmpd.conf
+file below the
+.B dlmod
+statement that loads the module.
+.TP
+\fBvarnishBanTableTimeout\fR \fINUMBER\fR
+To create \fBbanTable\fR (see below), \fBvarnish_mib\fR connects to
+\fBvarnish\fR administration port and issues the \fBban.list\fR
+command. To minimize the performance impact, the information obtained
+is cached for a predefined amount of time (60 seconds by default).
+This amount (in seconds) is configured by \fBvarnishBanTableTimeout\fR
+statement.
+
+It can also be set remotely by assigning new value to the
+\fBbanTableTimeout\fR oid.
+.SH OIDS
The following OIDs are defined:
+.SS Branch \(dqclient\(dq
.TP
-.B VARNISH-MIB::clientAcceptedConnections.0
+.B clientAcceptedConnections
Number of accepted connections.
.TP
-.B VARNISH-MIB::clientRequestsReceived.0
+.B clientRequestsReceived
Number of received HTTP requests.
.TP
-.B VARNISH-MIB::clientCacheHits.0
+.B clientCacheHits
Number of cache hits. A cache hit indicates that an object has been
delivered to a client without fetching it from a backend server.
.TP
-.B VARNISH-MIB::clientCacheHitsPass.0
+.B clientCacheHitsPass
Number of hits for pass. A cache hit for pass indicates that Varnish
passes the request to the backend and this decision itself has been cached.
.TP
-.B VARNISH-MIB::clientCacheMisses.0
+.B clientCacheMisses
Number of misses. A cache miss indicates the object was fetched from
the backend before delivering it to the client.
.TP
-.B VARNISH-MIB::backendConnSuccess.0
+.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.,
+to invalidate caches of all \fBpng\fR images:
+
+.EE
+snmpset \fBhostname\fR VARNISH-MIB::clientBan.0 s 'req.url ~ \(dq.png$\(dq'
+.EX
+.SS Branch \(dqbackend\(dq
+.TP
+.B backendConnSuccess
Number of successful connections to the backend.
.TP
-.B VARNISH-MIB::backendConnNotAttempted.0
+.B backendConnNotAttempted
Number of backend connections not attempted, because of the unhealthy
status of the backend.
.TP
-.B VARNISH-MIB::backendConnToMany.0
+.B backendConnToMany
Number of backend connections failed because there were too many
connections open.
.TP
-.B VARNISH-MIB::backendConnFailures.0
+.B backendConnFailures
Number of failed backend connections.
.TP
-.B VARNISH-MIB::backendConnReuses.0
+.B backendConnReuses
Number of reused backend connections. This counter is increased
whenever Varnish reuses a recycled connection.
.TP
-.B VARNISH-MIB::backendConnRecycled.0
+.B backendConnRecycled
Number of backend connection recycles. This counter is increased
whenever Varnish has keep-alive connection that is put back into
the pool of connections. It has not yet been used, but it might be,
unless the backend closes it.
.TP
-.B VARNISH-MIB::backendConnUnused.0
+.B backendConnUnused
Number of unused backend connections.
.TP
-.B VARNISH-MIB::totalSessions.0
+.B backendConnRetry
+Backend connections retried.
+.SS Branch \(dqtotal\(dq
+.TP
+.B totalSessions
Total number of sessions served since the startup.
.TP
-.B VARNISH-MIB::totalRequests.0
+.B totalRequests
Total number of requests received since the startup.
.TP
-.B VARNISH-MIB::totalPipe.0
+.B totalPipe
Total number of requests piped to the backend.
.TP
-.B VARNISH-MIB::totalPass.0
+.B totalPass
Total number of requests passed to the backend.
.TP
-.B VARNISH-MIB::totalFetch.0
+.B totalFetch
Total number of fetches.
.TP
-.B VARNISH-MIB::totalHeaderBytes.0
+.B totalRequestHeaderBytes
Total request header bytes received.
.TP
-.B VARNISH-MIB::totalBodyBytes.0
+.B totalRequestBodyBytes
Total request body bytes received.
+.TP
+.B totalResponseHeaderBytes
+Total header bytes sent out in responses.
+.TP
+.B totalResponseBodyBytes
+Total body bytes sent out in responses.
+.SS Branch \(dqmaster\(dq
+.TP
+.B uptime
+Master daemon uptime, in hundredths of a second.
+.SS Branch \(dqsession\(dq
+.TP
+.B sessAccepted
+Number of sessions succesfully accepted.
+.TP
+.B sessQueued
+Number of times session was queued waiting for a thread.
+.TP
+.B sessDropped
+Number of sessions dropped because session queue was full.
+.TP
+.B sessClosed
+Number of sessions closed.
+.TP
+.B sessPipeline
+Session pipeline.
+.TP
+.B sessReadAhead
+Session read-ahead.
+.TP
+.B sessHerd
+Session herd.
+.TP
+.B sessDrop
+Number of sessions dropped for thread.
+.TP
+.B sessFail
+Number of session accept failures.
+.TP
+.B sessPipeOverflow
+Number of session pipe overflows.
+.SS Branch \(dqthreads\(dq
+.TP
+.B threadsPools
+Number of thread pools.
+.TP
+.B threadsTotal
+Number of thread pools.
+.TP
+.B threadsLimitHits
+Number of times more threads were needed, but limit was reached in a
+thread pool.
+.TP
+.B threadsCreated
+Total number of threads created in all pools.
+.TP
+.B threadsDestroyed
+Total number of threads destroyed in all pools.
+.TP
+.B threadsFailed
+Number of times creating a thread failed.
+.SS Branch \(dqbans\(dq
+.TP
+.B bansTotal
+Total number of bans.
+.TP
+.B bansCompleted
+Count of completed bans.
+.TP
+.B bansObj
+Number of bans using \fBobj.*\fR.
+.TP
+.B bansReq
+Number of bans using \fBreq.*\fR.
+.TP
+.B bansAdded
+Number of bans added.
+.TP
+.B bansDeleted
+Number of bans deleted.
+.TP
+.B bansTested
+Number of bans tested against objects (lookup).
+.TP
+.B bansObjectsKilled
+Number of objects killed by bans (lookup).
+.TP
+.B bansLurkerTested
+Number of bans tested against objects (lurker).
+.TP
+.B bansTestTested
+Number of ban tests tested against objects (lookup).
+.TP
+.B bansLurkerTestTested
+Number of ban tests tested against objects (lurker).
+.TP
+.B bansLurkerObjKilled
+Number of objects killed by bans (lurker).
+.TP
+.B bansDups
+Number of ans superseded by other bans.
+.TP
+.B bansLurkerContention
+Number of times lurker gave way for lookup.
+.TP
+.B bansPersistedBytes
+Number of bytes used by the persisted ban lists.
+.TP
+.B bansPersistedFragmentation
+Extra bytes in persisted ban lists due to fragmentation.
+.TP
+.B banTable
+A table of configured varnish bans. It is indexed by the
+\fBbanIndex\fR OID. Each row has the following elements:
+.RS
+.TP
+.B banTime
+Time when the ban was set.
+.TP
+.B banRefCount
+Number of references to that ban. This equals to the number of objects
+in the varnish cache affected by that ban.
+.TP
+.B banExpression
+VCL expression of the ban.
+.RE
+
+Notice that for performance reasons, the ban table is cached, so the
+total number of rows in the \fBbanTable\fR may diverge from the value
+of \fBbansTotal\fR variable. The default update interval is 60
+seconds. It can be configured either in the \fBsnmpd.conf\fR file
+(see the \fBvarnishBanTableTimeout\fR statement above), or via
+the \fBbanTableTimeout\fR variable.
+.SS Branch \(dqagent\(dq
+.TP
+.B banTableTimeout
+Update interval for the \fBbanTable\fR cache. If set, it takes effect
+immediately.
.SH "SEE ALSO"
.BR snmpd.conf (5),
.BR snmpd (8),
.BR varnish (7),
.BR varnishstat (1).
.SH AUTHORS
diff --git a/src/varnish_mib.mib2c b/src/varnish_mib.mib2c
index 34f0f16..b20074c 100644
--- a/src/varnish_mib.mib2c
+++ b/src/varnish_mib.mib2c
@@ -94,13 +94,17 @@ $vars{'varnish_translate'} = sub {
bansLurkerTestTested => [ 'MAIN', 'bans_lurker_tests_tested' ],
bansLurkerObjKilled => [ 'MAIN', 'bans_lurker_obj_killed' ],
bansDups => [ 'MAIN', 'bans_dups' ],
bansLurkerContention => [ 'MAIN', 'bans_lurker_contention' ],
bansPersistedBytes => [ 'MAIN', 'bans_persisted_bytes' ],
bansPersistedFragmentation => [ 'MAIN', 'bans_persisted_fragmentation' ],
-
+
+ banTableTimeout => [ 'VAR', 'banTable_timeout',
+ { varnish_set_action => 'varnish_ban_table_timeout_set'
+ } ],
+
);
my $r = $trans{$name};
if (!defined($r)) {
print STDERR "no translation for $name!\n";
exit(1);
@@ -160,12 +164,18 @@ int varnish_auth_response(const char *file, const char *challenge,
int varnish_ban(netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests,
struct VSM_data *vd);
extern unsigned banTable_timeout;
+void varnish_ban_table_timeout_parser(const char *token, char *line);
+
+int varnish_ban_table_timeout_set(netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests,
+ struct VSM_data *vd);
+int varnish_ban_table_timeout_get(void **valptr, size_t *valsize);
@open ${name}@
/* THIS FILE IS GENERATED AUTOMATICALLY. PLEASE DO NOT EDIT. */
#include "varnish_mib.h"
@@ -249,12 +259,32 @@ handle_$i(netsnmp_mib_handler *handler,