diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2014-11-26 17:03:41 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2014-11-26 17:07:29 +0200 |
commit | ee352ea3182b86d7906e9cd0fefdd878a6f0fa49 (patch) | |
tree | 5ee5e647fab831a840777e07fc8ac4f9e41f271a /src | |
parent | 50813ca9aa276c72e6f766a5ecd23c1170273528 (diff) | |
download | varnish-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.
Diffstat (limited to 'src')
-rw-r--r-- | src/VARNISH-MIB.txt | 167 | ||||
-rw-r--r-- | src/ban.c | 43 | ||||
-rw-r--r-- | src/varnish-mib.8 | 217 | ||||
-rw-r--r-- | src/varnish_mib.mib2c | 38 |
4 files changed, 364 insertions, 101 deletions
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 @@ -11,3 +11,4 @@ VARNISH-MIB DEFINITIONS ::= BEGIN IMPORTS - MODULE-IDENTITY, OBJECT-TYPE, enterprises, Counter64, TimeTicks + MODULE-IDENTITY, OBJECT-TYPE, enterprises, Counter64, TimeTicks, + Unsigned32 FROM SNMPv2-SMI @@ -19,10 +20,12 @@ IMPORTS 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 } @@ -37,2 +40,3 @@ threads OBJECT IDENTIFIER ::= { varnish 6 } bans OBJECT IDENTIFIER ::= { varnish 7 } +agent OBJECT IDENTIFIER ::= { varnish 8 } @@ -43,3 +47,3 @@ clientAcceptedConnections OBJECT-TYPE DESCRIPTION - "Client connections accepted" + "Client connections accepted." ::= { client 1 } @@ -51,3 +55,3 @@ clientRequestsReceived OBJECT-TYPE DESCRIPTION - "Client requests received" + "Client requests received." ::= { client 2 } @@ -59,3 +63,3 @@ clientCacheHits OBJECT-TYPE DESCRIPTION - "Cache hits" + "Cache hits." ::= { client 3 } @@ -67,3 +71,3 @@ clientCacheHitsPass OBJECT-TYPE DESCRIPTION - "Cache hits for pass" + "Cache hits for pass." ::= { client 4 } @@ -75,3 +79,3 @@ clientCacheMisses OBJECT-TYPE DESCRIPTION - "Cache misses" + "Cache misses." ::= { client 5 } @@ -81,3 +85,3 @@ VarnishBanString ::= TEXTUAL-CONVENTION STATUS current - DESCRIPTION "" + DESCRIPTION "A string containing Varnish ban expression." SYNTAX OCTET STRING (SIZE (0..1024)) @@ -98,3 +102,3 @@ clientRequests400 OBJECT-TYPE DESCRIPTION - "Client requests received, subject to 400 errors" + "Client requests received, subject to 400 errors." ::= { client 7 } @@ -106,6 +110,5 @@ clientRequests411 OBJECT-TYPE DESCRIPTION - "Client requests received, subject to 411 errors" + "Client requests received, subject to 411 errors." ::= { client 8 } - clientRequests413 OBJECT-TYPE @@ -115,3 +118,3 @@ clientRequests413 OBJECT-TYPE DESCRIPTION - "Client requests received, subject to 413 errors" + "Client requests received, subject to 413 errors." ::= { client 9 } @@ -123,3 +126,3 @@ clientRequests417 OBJECT-TYPE DESCRIPTION - "Client requests received, subject to 417 errors" + "Client requests received, subject to 417 errors." ::= { client 10 } @@ -133,3 +136,3 @@ backendConnSuccess OBJECT-TYPE DESCRIPTION - "Backend connections success" + "Backend connections success." ::= { connections 1 } @@ -141,3 +144,3 @@ backendConnNotAttempted OBJECT-TYPE DESCRIPTION - "Backend connections not attempted" + "Backend connections not attempted." ::= { connections 2 } @@ -149,3 +152,3 @@ backendConnToMany OBJECT-TYPE DESCRIPTION - "Backend connections too many" + "Backend connections too many." ::= { connections 3 } @@ -157,3 +160,3 @@ backendConnFailures OBJECT-TYPE DESCRIPTION - "Backend connections failures" + "Backend connections failures." ::= { connections 4 } @@ -165,3 +168,3 @@ backendConnReuses OBJECT-TYPE DESCRIPTION - "Backend connections reuses" + "Backend connections reuses." ::= { connections 5 } @@ -173,3 +176,3 @@ backendConnRecycled OBJECT-TYPE DESCRIPTION - "Backend connections recycles" + "Backend connections recycles." ::= { connections 6 } @@ -181,3 +184,3 @@ backendConnUnused OBJECT-TYPE DESCRIPTION - "Backend connections unused" + "Backend connections unused." ::= { connections 7 } @@ -189,3 +192,3 @@ backendConnRetry OBJECT-TYPE DESCRIPTION - "Backend connections retried" + "Backend connections retried." ::= { connections 8 } @@ -197,3 +200,3 @@ totalSessions OBJECT-TYPE DESCRIPTION - "Total Sessions" + "Total Sessions." ::= { total 1 } @@ -205,3 +208,3 @@ totalRequests OBJECT-TYPE DESCRIPTION - "Total Requests" + "Total Requests." ::= { total 2 } @@ -213,3 +216,3 @@ totalPipe OBJECT-TYPE DESCRIPTION - "Total pipe" + "Total pipe." ::= { total 3 } @@ -221,3 +224,3 @@ totalPass OBJECT-TYPE DESCRIPTION - "Total pass" + "Total pass." ::= { total 4 } @@ -229,3 +232,3 @@ totalFetch OBJECT-TYPE DESCRIPTION - "Total fetch" + "Total fetch." ::= { total 5 } @@ -237,3 +240,3 @@ totalRequestHeaderBytes OBJECT-TYPE DESCRIPTION - "Total request header bytes" + "Total request header bytes." ::= { total 6 } @@ -245,3 +248,3 @@ totalRequestBodyBytes OBJECT-TYPE DESCRIPTION - "Total request body bytes" + "Total request body bytes." ::= { total 7 } @@ -253,3 +256,3 @@ totalResponseHeaderBytes OBJECT-TYPE DESCRIPTION - "Total response body bytes" + "Total response body bytes." ::= { total 8 } @@ -261,3 +264,3 @@ totalResponseBodyBytes OBJECT-TYPE DESCRIPTION - "Total response body bytes" + "Total response body bytes." ::= { total 9 } @@ -269,3 +272,3 @@ uptime OBJECT-TYPE DESCRIPTION - "Master daemon uptime" + "Master daemon uptime." ::= { master 1 } @@ -277,3 +280,3 @@ sessAccepted OBJECT-TYPE DESCRIPTION - "Number of sessions succesfully accepted" + "Number of sessions succesfully accepted." ::= { session 1 } @@ -285,3 +288,3 @@ sessQueued OBJECT-TYPE DESCRIPTION - "Number of times session was queued waiting for a thread" + "Number of times session was queued waiting for a thread." ::= { session 2 } @@ -293,3 +296,3 @@ sessDropped OBJECT-TYPE DESCRIPTION - "Number of sessions dropped because session queue was full" + "Number of sessions dropped because session queue was full." ::= { session 3 } @@ -301,3 +304,3 @@ sessClosed OBJECT-TYPE DESCRIPTION - "Number of sessions closed" + "Number of sessions closed." ::= { session 4 } @@ -309,3 +312,3 @@ sessPipeline OBJECT-TYPE DESCRIPTION - "Session pipeline" + "Session pipeline." ::= { session 5 } @@ -317,3 +320,3 @@ sessReadAhead OBJECT-TYPE DESCRIPTION - "Session read-ahead" + "Session read-ahead." ::= { session 6 } @@ -325,3 +328,3 @@ sessHerd OBJECT-TYPE DESCRIPTION - "Session herd" + "Session herd." ::= { session 7 } @@ -333,3 +336,3 @@ sessDrop OBJECT-TYPE DESCRIPTION - "Number of sessions dropped for thread" + "Number of sessions dropped for thread." ::= { session 8 } @@ -341,3 +344,3 @@ sessFail OBJECT-TYPE DESCRIPTION - "Number of session accept failures" + "Number of session accept failures." ::= { session 9 } @@ -349,3 +352,3 @@ sessPipeOverflow OBJECT-TYPE DESCRIPTION - "Number of session pipe overflows" + "Number of session pipe overflows." ::= { session 10 } @@ -357,3 +360,3 @@ threadsPools OBJECT-TYPE DESCRIPTION - "Number of thread pools" + "Number of thread pools." ::= { threads 1 } @@ -365,3 +368,3 @@ threadsTotal OBJECT-TYPE DESCRIPTION - "Number of thread pools" + "Number of thread pools." ::= { threads 2 } @@ -374,3 +377,3 @@ threadsLimitHits OBJECT-TYPE "Number of times more threads were needed, but limit was - reached in a thread pool" + reached in a thread pool." ::= { threads 3 } @@ -382,3 +385,3 @@ threadsCreated OBJECT-TYPE DESCRIPTION - "Total number of threads created in all pools" + "Total number of threads created in all pools." ::= { threads 4 } @@ -390,3 +393,3 @@ threadsDestroyed OBJECT-TYPE DESCRIPTION - "Total number of threads destroyed in all pools" + "Total number of threads destroyed in all pools." ::= { threads 5 } @@ -398,3 +401,3 @@ threadsFailed OBJECT-TYPE DESCRIPTION - "Number of times creating a thread failed" + "Number of times creating a thread failed." ::= { threads 6 } @@ -406,3 +409,3 @@ threadsQueueLength OBJECT-TYPE DESCRIPTION - "Length of session queue waiting for threads" + "Length of session queue waiting for threads." ::= { threads 7 } @@ -414,3 +417,3 @@ bansTotal OBJECT-TYPE DESCRIPTION - "Total number of bans" + "Total number of bans." ::= { bans 1 } @@ -422,3 +425,3 @@ bansCompleted OBJECT-TYPE DESCRIPTION - "Count of completed bans" + "Count of completed bans." ::= { bans 2 } @@ -430,3 +433,3 @@ bansObj OBJECT-TYPE DESCRIPTION - "Number of bans using obj.*" + "Number of bans using obj.*." ::= { bans 3 } @@ -438,3 +441,3 @@ bansReq OBJECT-TYPE DESCRIPTION - "Number of bans using req.*" + "Number of bans using req.*." ::= { bans 4 } @@ -446,3 +449,3 @@ bansAdded OBJECT-TYPE DESCRIPTION - "Number of bans added" + "Number of bans added." ::= { bans 5 } @@ -454,3 +457,3 @@ bansDeleted OBJECT-TYPE DESCRIPTION - "Number of bans deleted" + "Number of bans deleted." ::= { bans 6 } @@ -462,3 +465,3 @@ bansTested OBJECT-TYPE DESCRIPTION - "Number of bans tested against objects (lookup)" + "Number of bans tested against objects (lookup)." ::= { bans 7 } @@ -470,3 +473,3 @@ bansObjectsKilled OBJECT-TYPE DESCRIPTION - "Number of objects killed by bans (lookup)" + "Number of objects killed by bans (lookup)." ::= { bans 8 } @@ -479,3 +482,3 @@ bansLurkerTested OBJECT-TYPE DESCRIPTION - "Number of bans tested against objects (lurker)" + "Number of bans tested against objects (lurker)." ::= { bans 9 } @@ -487,3 +490,3 @@ bansTestTested OBJECT-TYPE DESCRIPTION - "Number of ban tests tested against objects (lookup)" + "Number of ban tests tested against objects (lookup)." ::= { bans 10 } @@ -495,3 +498,3 @@ bansLurkerTestTested OBJECT-TYPE DESCRIPTION - "Number of ban tests tested against objects (lurker)" + "Number of ban tests tested against objects (lurker)." ::= { bans 11 } @@ -503,3 +506,3 @@ bansLurkerObjKilled OBJECT-TYPE DESCRIPTION - "Number of objects killed by bans (lurker)" + "Number of objects killed by bans (lurker)." ::= { bans 12 } @@ -511,3 +514,3 @@ bansDups OBJECT-TYPE DESCRIPTION - "Number of ans superseded by other bans" + "Number of ans superseded by other bans." ::= { bans 13 } @@ -519,3 +522,3 @@ bansLurkerContention OBJECT-TYPE DESCRIPTION - "Number of times lurker gave way for lookup" + "Number of times lurker gave way for lookup." ::= { bans 14 } @@ -527,3 +530,3 @@ bansPersistedBytes OBJECT-TYPE DESCRIPTION - "Number of bytes used by the persisted ban lists" + "Number of bytes used by the persisted ban lists." ::= { bans 15 } @@ -535,3 +538,3 @@ bansPersistedFragmentation OBJECT-TYPE DESCRIPTION - "Extra bytes in persisted ban lists due to fragmentation" + "Extra bytes in persisted ban lists due to fragmentation." ::= { bans 17 } @@ -543,3 +546,3 @@ banTable OBJECT-TYPE DESCRIPTION - "The (conceptual) table listing available bans" + "The (conceptual) table listing available bans." ::= { bans 18 } @@ -551,3 +554,3 @@ varnishBanEntry OBJECT-TYPE DESCRIPTION - "An entry (conceptual row) representing a ban" + "An entry (conceptual row) representing a ban." INDEX { banIndex } @@ -567,3 +570,3 @@ banIndex OBJECT-TYPE DESCRIPTION - "A number uniquely identifying each ban" + "A number uniquely identifying each ban." ::= { varnishBanEntry 1 } @@ -575,3 +578,3 @@ banTime OBJECT-TYPE DESCRIPTION - "Time when the ban was created" + "Time when the ban was created." ::= { varnishBanEntry 2 } @@ -583,3 +586,3 @@ banRefCount OBJECT-TYPE DESCRIPTION - "Number of references to this ban" + "Number of references to this ban." ::= { varnishBanEntry 3 } @@ -591,5 +594,14 @@ banExpression OBJECT-TYPE 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 } -- @@ -619,2 +631,3 @@ varnishGroup OBJECT-GROUP backendConnUnused, + backendConnRetry, totalSessions, @@ -660,3 +673,3 @@ varnishGroup OBJECT-GROUP STATUS current - DESCRIPTION "Group of Varnish objects" + DESCRIPTION "Group of Varnish objects." ::= { varnishGroups 1 } @@ -669,3 +682,3 @@ varnishStandardComplianceV1 MODULE-COMPLIANCE DESCRIPTION - "Compliance for an Varnish agent" + "Compliance for a Varnish agent." @@ -683,3 +696,3 @@ END -- time-stamp-format: "%:y%02m%02d%02H%02MZ" --- time-stamp-line-limit: 25 +-- time-stamp-line-limit: 32 -- time-stamp-count: 2 @@ -19,2 +19,3 @@ #include <ctype.h> +#include <limits.h> @@ -65,2 +66,44 @@ 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; +} + /* 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 @@ -15,3 +15,3 @@ .\" 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 @@ -25,18 +25,37 @@ 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 @@ -44,3 +63,3 @@ 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 @@ -48,3 +67,3 @@ 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 @@ -52,6 +71,16 @@ 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 @@ -59,3 +88,3 @@ status of the backend. .TP -.B VARNISH-MIB::backendConnToMany.0 +.B backendConnToMany Number of backend connections failed because there were too many @@ -63,6 +92,6 @@ 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 @@ -70,3 +99,3 @@ whenever Varnish reuses a recycled connection. .TP -.B VARNISH-MIB::backendConnRecycled.0 +.B backendConnRecycled Number of backend connection recycles. This counter is increased @@ -76,25 +105,167 @@ 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" 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 @@ -99,3 +99,7 @@ $vars{'varnish_translate'} = sub { bansPersistedFragmentation => [ 'MAIN', 'bans_persisted_fragmentation' ], - + + banTableTimeout => [ 'VAR', 'banTable_timeout', + { varnish_set_action => 'varnish_ban_table_timeout_set' + } ], + ); @@ -165,2 +169,8 @@ int varnish_ban(netsnmp_agent_request_info *reqinfo, 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); @@ -254,2 +264,22 @@ handle_$i(netsnmp_mib_handler *handler, } + @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@ @@ -494,2 +524,8 @@ init_$modulename(void) + 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@ |