From ee352ea3182b86d7906e9cd0fefdd878a6f0fa49 Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Wed, 26 Nov 2014 17:03:41 +0200 Subject: 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. --- src/VARNISH-MIB.txt | 167 ++++++++++++++++++++------------------ src/ban.c | 43 ++++++++++ src/varnish-mib.8 | 217 ++++++++++++++++++++++++++++++++++++++++++++------ src/varnish_mib.mib2c | 38 ++++++++- 4 files changed, 364 insertions(+), 101 deletions(-) (limited to 'src') 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 @@ -9,7 +9,8 @@ VARNISH-MIB DEFINITIONS ::= BEGIN -- ************************************************************* IMPORTS - MODULE-IDENTITY, OBJECT-TYPE, enterprises, Counter64, TimeTicks + MODULE-IDENTITY, OBJECT-TYPE, enterprises, Counter64, TimeTicks, + Unsigned32 FROM SNMPv2-SMI DateAndTime FROM SNMPv2-TC @@ -17,14 +18,16 @@ IMPORTS 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 + Sergey Poznyakoff + " 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 } @@ -35,13 +38,14 @@ 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 @@ -49,7 +53,7 @@ clientRequestsReceived OBJECT-TYPE MAX-ACCESS read-only STATUS current DESCRIPTION - "Client requests received" + "Client requests received." ::= { client 2 } clientCacheHits OBJECT-TYPE @@ -57,7 +61,7 @@ clientCacheHits OBJECT-TYPE MAX-ACCESS read-only STATUS current DESCRIPTION - "Cache hits" + "Cache hits." ::= { client 3 } clientCacheHitsPass OBJECT-TYPE @@ -65,7 +69,7 @@ clientCacheHitsPass OBJECT-TYPE MAX-ACCESS read-only STATUS current DESCRIPTION - "Cache hits for pass" + "Cache hits for pass." ::= { client 4 } clientCacheMisses OBJECT-TYPE @@ -73,13 +77,13 @@ clientCacheMisses OBJECT-TYPE 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 @@ -96,7 +100,7 @@ clientRequests400 OBJECT-TYPE 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 @@ -104,16 +108,15 @@ clientRequests411 OBJECT-TYPE 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 @@ -121,7 +124,7 @@ clientRequests417 OBJECT-TYPE 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 } @@ -131,7 +134,7 @@ backendConnSuccess OBJECT-TYPE MAX-ACCESS read-only STATUS current DESCRIPTION - "Backend connections success" + "Backend connections success." ::= { connections 1 } backendConnNotAttempted OBJECT-TYPE @@ -139,7 +142,7 @@ backendConnNotAttempted OBJECT-TYPE MAX-ACCESS read-only STATUS current DESCRIPTION - "Backend connections not attempted" + "Backend connections not attempted." ::= { connections 2 } backendConnToMany OBJECT-TYPE @@ -147,7 +150,7 @@ backendConnToMany OBJECT-TYPE MAX-ACCESS read-only STATUS current DESCRIPTION - "Backend connections too many" + "Backend connections too many." ::= { connections 3 } backendConnFailures OBJECT-TYPE @@ -155,7 +158,7 @@ backendConnFailures OBJECT-TYPE MAX-ACCESS read-only STATUS current DESCRIPTION - "Backend connections failures" + "Backend connections failures." ::= { connections 4 } backendConnReuses OBJECT-TYPE @@ -163,7 +166,7 @@ backendConnReuses OBJECT-TYPE MAX-ACCESS read-only STATUS current DESCRIPTION - "Backend connections reuses" + "Backend connections reuses." ::= { connections 5 } backendConnRecycled OBJECT-TYPE @@ -171,7 +174,7 @@ backendConnRecycled OBJECT-TYPE MAX-ACCESS read-only STATUS current DESCRIPTION - "Backend connections recycles" + "Backend connections recycles." ::= { connections 6 } backendConnUnused OBJECT-TYPE @@ -179,7 +182,7 @@ backendConnUnused OBJECT-TYPE MAX-ACCESS read-only STATUS current DESCRIPTION - "Backend connections unused" + "Backend connections unused." ::= { connections 7 } backendConnRetry OBJECT-TYPE @@ -187,7 +190,7 @@ backendConnRetry OBJECT-TYPE MAX-ACCESS read-only STATUS current DESCRIPTION - "Backend connections retried" + "Backend connections retried." ::= { connections 8 } totalSessions OBJECT-TYPE @@ -195,7 +198,7 @@ totalSessions OBJECT-TYPE MAX-ACCESS read-only STATUS current DESCRIPTION - "Total Sessions" + "Total Sessions." ::= { total 1 } totalRequests OBJECT-TYPE @@ -203,7 +206,7 @@ totalRequests OBJECT-TYPE MAX-ACCESS read-only STATUS current DESCRIPTION - "Total Requests" + "Total Requests." ::= { total 2 } totalPipe OBJECT-TYPE @@ -211,7 +214,7 @@ totalPipe OBJECT-TYPE MAX-ACCESS read-only STATUS current DESCRIPTION - "Total pipe" + "Total pipe." ::= { total 3 } totalPass OBJECT-TYPE @@ -219,7 +222,7 @@ totalPass OBJECT-TYPE MAX-ACCESS read-only STATUS current DESCRIPTION - "Total pass" + "Total pass." ::= { total 4 } totalFetch OBJECT-TYPE @@ -227,7 +230,7 @@ totalFetch OBJECT-TYPE MAX-ACCESS read-only STATUS current DESCRIPTION - "Total fetch" + "Total fetch." ::= { total 5 } totalRequestHeaderBytes OBJECT-TYPE @@ -235,7 +238,7 @@ totalRequestHeaderBytes OBJECT-TYPE MAX-ACCESS read-only STATUS current DESCRIPTION - "Total request header bytes" + "Total request header bytes." ::= { total 6 } totalRequestBodyBytes OBJECT-TYPE @@ -243,7 +246,7 @@ totalRequestBodyBytes OBJECT-TYPE MAX-ACCESS read-only STATUS current DESCRIPTION - "Total request body bytes" + "Total request body bytes." ::= { total 7 } totalResponseHeaderBytes OBJECT-TYPE @@ -251,7 +254,7 @@ totalResponseHeaderBytes OBJECT-TYPE MAX-ACCESS read-only STATUS current DESCRIPTION - "Total response body bytes" + "Total response body bytes." ::= { total 8 } totalResponseBodyBytes OBJECT-TYPE @@ -259,7 +262,7 @@ totalResponseBodyBytes OBJECT-TYPE MAX-ACCESS read-only STATUS current DESCRIPTION - "Total response body bytes" + "Total response body bytes." ::= { total 9 } uptime OBJECT-TYPE @@ -267,7 +270,7 @@ uptime OBJECT-TYPE MAX-ACCESS read-only STATUS current DESCRIPTION - "Master daemon uptime" + "Master daemon uptime." ::= { master 1 } sessAccepted OBJECT-TYPE @@ -275,7 +278,7 @@ sessAccepted OBJECT-TYPE MAX-ACCESS read-only STATUS current DESCRIPTION - "Number of sessions succesfully accepted" + "Number of sessions succesfully accepted." ::= { session 1 } sessQueued OBJECT-TYPE @@ -283,7 +286,7 @@ sessQueued OBJECT-TYPE 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 @@ -291,7 +294,7 @@ sessDropped OBJECT-TYPE 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 @@ -299,7 +302,7 @@ sessClosed OBJECT-TYPE MAX-ACCESS read-only STATUS current DESCRIPTION - "Number of sessions closed" + "Number of sessions closed." ::= { session 4 } sessPipeline OBJECT-TYPE @@ -307,7 +310,7 @@ sessPipeline OBJECT-TYPE MAX-ACCESS read-only STATUS current DESCRIPTION - "Session pipeline" + "Session pipeline." ::= { session 5 } sessReadAhead OBJECT-TYPE @@ -315,7 +318,7 @@ sessReadAhead OBJECT-TYPE MAX-ACCESS read-only STATUS current DESCRIPTION - "Session read-ahead" + "Session read-ahead." ::= { session 6 } sessHerd OBJECT-TYPE @@ -323,7 +326,7 @@ sessHerd OBJECT-TYPE MAX-ACCESS read-only STATUS current DESCRIPTION - "Session herd" + "Session herd." ::= { session 7 } sessDrop OBJECT-TYPE @@ -331,7 +334,7 @@ sessDrop OBJECT-TYPE MAX-ACCESS read-only STATUS current DESCRIPTION - "Number of sessions dropped for thread" + "Number of sessions dropped for thread." ::= { session 8 } sessFail OBJECT-TYPE @@ -339,7 +342,7 @@ sessFail OBJECT-TYPE MAX-ACCESS read-only STATUS current DESCRIPTION - "Number of session accept failures" + "Number of session accept failures." ::= { session 9 } sessPipeOverflow OBJECT-TYPE @@ -347,7 +350,7 @@ sessPipeOverflow OBJECT-TYPE MAX-ACCESS read-only STATUS current DESCRIPTION - "Number of session pipe overflows" + "Number of session pipe overflows." ::= { session 10 } threadsPools OBJECT-TYPE @@ -355,7 +358,7 @@ threadsPools OBJECT-TYPE MAX-ACCESS read-only STATUS current DESCRIPTION - "Number of thread pools" + "Number of thread pools." ::= { threads 1 } threadsTotal OBJECT-TYPE @@ -363,7 +366,7 @@ threadsTotal OBJECT-TYPE MAX-ACCESS read-only STATUS current DESCRIPTION - "Number of thread pools" + "Number of thread pools." ::= { threads 2 } threadsLimitHits OBJECT-TYPE @@ -372,7 +375,7 @@ threadsLimitHits OBJECT-TYPE 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 @@ -380,7 +383,7 @@ threadsCreated OBJECT-TYPE 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 @@ -388,7 +391,7 @@ threadsDestroyed OBJECT-TYPE 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 @@ -396,7 +399,7 @@ threadsFailed OBJECT-TYPE 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 @@ -404,7 +407,7 @@ threadsQueueLength OBJECT-TYPE 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 @@ -412,7 +415,7 @@ bansTotal OBJECT-TYPE MAX-ACCESS read-only STATUS current DESCRIPTION - "Total number of bans" + "Total number of bans." ::= { bans 1 } bansCompleted OBJECT-TYPE @@ -420,7 +423,7 @@ bansCompleted OBJECT-TYPE MAX-ACCESS read-only STATUS current DESCRIPTION - "Count of completed bans" + "Count of completed bans." ::= { bans 2 } bansObj OBJECT-TYPE @@ -428,7 +431,7 @@ bansObj OBJECT-TYPE MAX-ACCESS read-only STATUS current DESCRIPTION - "Number of bans using obj.*" + "Number of bans using obj.*." ::= { bans 3 } bansReq OBJECT-TYPE @@ -436,7 +439,7 @@ bansReq OBJECT-TYPE MAX-ACCESS read-only STATUS current DESCRIPTION - "Number of bans using req.*" + "Number of bans using req.*." ::= { bans 4 } bansAdded OBJECT-TYPE @@ -444,7 +447,7 @@ bansAdded OBJECT-TYPE MAX-ACCESS read-only STATUS current DESCRIPTION - "Number of bans added" + "Number of bans added." ::= { bans 5 } bansDeleted OBJECT-TYPE @@ -452,7 +455,7 @@ bansDeleted OBJECT-TYPE MAX-ACCESS read-only STATUS current DESCRIPTION - "Number of bans deleted" + "Number of bans deleted." ::= { bans 6 } bansTested OBJECT-TYPE @@ -460,7 +463,7 @@ bansTested OBJECT-TYPE 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 @@ -468,7 +471,7 @@ bansObjectsKilled OBJECT-TYPE MAX-ACCESS read-only STATUS current DESCRIPTION - "Number of objects killed by bans (lookup)" + "Number of objects killed by bans (lookup)." ::= { bans 8 } @@ -477,7 +480,7 @@ bansLurkerTested OBJECT-TYPE 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 @@ -485,7 +488,7 @@ bansTestTested OBJECT-TYPE 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 @@ -493,7 +496,7 @@ bansLurkerTestTested OBJECT-TYPE 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 @@ -501,7 +504,7 @@ bansLurkerObjKilled OBJECT-TYPE 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 @@ -509,7 +512,7 @@ bansDups OBJECT-TYPE 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 @@ -517,7 +520,7 @@ bansLurkerContention OBJECT-TYPE 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 @@ -525,7 +528,7 @@ bansPersistedBytes OBJECT-TYPE 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 @@ -533,7 +536,7 @@ bansPersistedFragmentation OBJECT-TYPE 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 @@ -541,7 +544,7 @@ banTable OBJECT-TYPE MAX-ACCESS not-accessible STATUS current DESCRIPTION - "The (conceptual) table listing available bans" + "The (conceptual) table listing available bans." ::= { bans 18 } varnishBanEntry OBJECT-TYPE @@ -549,7 +552,7 @@ varnishBanEntry OBJECT-TYPE 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 } @@ -565,7 +568,7 @@ banIndex OBJECT-TYPE MAX-ACCESS not-accessible STATUS current DESCRIPTION - "A number uniquely identifying each ban" + "A number uniquely identifying each ban." ::= { varnishBanEntry 1 } banTime OBJECT-TYPE @@ -573,7 +576,7 @@ banTime OBJECT-TYPE MAX-ACCESS read-only STATUS current DESCRIPTION - "Time when the ban was created" + "Time when the ban was created." ::= { varnishBanEntry 2 } banRefCount OBJECT-TYPE @@ -581,7 +584,7 @@ banRefCount OBJECT-TYPE MAX-ACCESS read-only STATUS current DESCRIPTION - "Number of references to this ban" + "Number of references to this ban." ::= { varnishBanEntry 3 } banExpression OBJECT-TYPE @@ -589,9 +592,18 @@ banExpression OBJECT-TYPE 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 -- @@ -617,6 +629,7 @@ varnishGroup OBJECT-GROUP backendConnReuses, backendConnRecycled, backendConnUnused, + backendConnRetry, totalSessions, totalRequests, totalPipe, @@ -658,7 +671,7 @@ varnishGroup OBJECT-GROUP } STATUS current - DESCRIPTION "Group of Varnish objects" + DESCRIPTION "Group of Varnish objects." ::= { varnishGroups 1 } -- @@ -667,7 +680,7 @@ varnishGroup OBJECT-GROUP varnishStandardComplianceV1 MODULE-COMPLIANCE STATUS current DESCRIPTION - "Compliance for an Varnish agent" + "Compliance for a Varnish agent." MODULE MANDATORY-GROUPS { varnishGroup } @@ -681,6 +694,6 @@ END -- 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 @@ -17,6 +17,7 @@ #include "varnish_mib.h" #include +#include static int send_ban_cmd(vcli_conn_t *conn, const char *expr) @@ -63,6 +64,48 @@ varnish_ban(netsnmp_agent_request_info *reqinfo, 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 */ 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 @@ -13,7 +13,7 @@ .\" .\" You should have received a copy of the GNU General Public License .\" along with Varnish-mib. If not, see . -.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 @@ -23,80 +23,251 @@ In \fBsnmpd.conf\fR(5): .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), 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 @@ -97,7 +97,11 @@ $vars{'varnish_translate'} = sub { 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}; @@ -163,6 +167,12 @@ int varnish_ban(netsnmp_agent_request_info *reqinfo, 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. */ @@ -252,6 +262,26 @@ handle_$i(netsnmp_mib_handler *handler, snmp_set_var_typed_value(requests->requestvb, $i.type, s, strlen(s)); } + @elsif $varnish_type eq 'PROG'@ + { + void *valptr; + size_t valsize; + + if ($varnish_member(&valptr, &valsize)) + return SNMP_ERR_NOSUCHNAME; + snmp_set_var_typed_value(requests->requestvb, $i.type, + valptr, valsize); + @if $varnish_get_free@ + free(valptr); + @end@ + @elsif $varnish_type eq 'VAR'@ + @if $i.type eq 'ASN_OCTET_STR'@ + snmp_set_var_typed_value(requests->requestvb, $i.type, + $varnish_member, strlen($varnish_member)); + @else@ + snmp_set_var_typed_value(requests->requestvb, $i.type, + &$varnish_member, sizeof($varnish_member)); + @end@ @else@ @printf "unrecognized type %s for %s" $varnish_type $i@ @end@ @@ -492,6 +522,12 @@ init_$modulename(void) DEBUGMSGTL(("$modulename", "Initializing\n")); + if (!register_config_handler("snmpd", "varnishBanTableTimeout", + varnish_ban_table_timeout_parser, + NULL, + "varnishBanTableTimeout SECONDS")) + snmp_log(LOG_ERR,"can't register config handler\n"); + @foreach $i scalar@ netsnmp_register_scalar( netsnmp_create_handler_registration("$i", handle_$i, -- cgit v1.2.1