.\" This file is part of Varnish-mib -*- nroff -*-
.\" Copyright (C) 2014-2016 Sergey Poznyakoff
.\"
.\" Varnish-mib is free software; you can redistribute it and/or modify
.\" it under the terms of the GNU General Public License as published by
.\" 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 .
.TH VARNISH-MIB 8 "April 27, 2016" "varnish-mib"
.SH NAME
varnish\-mib \- net-snmp module for obtaining Varnish Cache statistics
.SH SYNOPSIS
In \fBsnmpd.conf\fR(5):
.PP
.B dlmod varnish_mib /usr/lib/snmp/varnish\-mib.so
.SH DESCRIPTION
Dynamically loadable object module for
.B net-snmp
that provides access to Varnish Cache statistics. The module is
loaded into
.BR snmpd (8)
as shown above (actual path can of course differ, depending on how
the package was configured). Varnish version \fB4.0\fR and \fB4.1\fR
are supported.
.PP
When using with \fBVarnish\fR version \fB4.1\fR, make sure the
\fB_.vsm\fR file is readable for \fBsnmpd\fR. This file is normally
located in \fB/var/lib/varnish/\fIHOSTNAME\fR and has mode \fB640\fR.
Its owner is determined by the \fB\-j\fR (\fB\-\-jail\fR)
\fBvarnishd\fR option. There are two ways to ensure it is readable:
either make sure \fBsnmpd\fR and \fBvarnishd\fR run with the same user
group, or use \fBsetfacl\fR(1) to tune access to that file.
.PP
The module obtains most of the data using Varnish API. Information
about available bans (\fBbanTable\fR subtree) as well as the mechanism
for setting bans (\fBclientBan\fR OID) are implemented via \fBvarnishd\fR
administrative interface. For these to work, the module must have
read access to Varnish secret file. In other words, the secret file
must be readable either by the user \fBsnmpd\fR runs as, or by its
group.
.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.
.PP
The following configuration statements are available:
.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.
.TP
\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 DEBUGGING
The module defines the following debugging tokens:
.TP
.B varnish_ban
Enables general debugging information.
.TP
.B varnish_mib:vcli
Varnish
.B CLI
interaction.
.SH OIDS
The following OIDs are defined:
.SS Branch \(dqclient\(dq
.TP
.B clientAcceptedConnections
Number of accepted connections.
.TP
.B clientRequestsReceived
Number of received HTTP requests.
.TP
.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 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 clientCacheMisses
Number of misses. A cache miss indicates the object was fetched from
the backend before delivering it to the client.
.TP
.B clientRequests400
Client requests received, subject to 400 errors.
.TP
.B clientRequests411
Client requests received, subject to 411 errors. This variable is
available only in Varnish version \fR4.0\fR.
.TP
.B clientRequests413
Client requests received, subject to 413 errors. This variable is
available only in Varnish version \fR4.0\fR.
.TP
.B clientBan
A write-only OID. When set, invalidates the cache using the supplied
value as argument to ban. When read, returns an empty string. E.g.,
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 backendConnNotAttempted
Number of backend connections not attempted, because of the unhealthy
status of the backend.
.TP
.B backendConnToMany
Number of backend connections failed because there were too many
connections open.
.TP
.B backendConnFailures
Number of failed backend connections.
.TP
.B backendConnReuses
Number of reused backend connections. This counter is increased
whenever Varnish reuses a recycled connection.
.TP
.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 backendConnUnused
Number of unused backend connections. This variable is available only
in Varnish version \fR4.0\fR.
.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
Total number of sessions served since the startup.
.TP
.B totalRequests
Total number of requests received since the startup.
.TP
.B totalPipe
Total number of requests piped to the backend.
.TP
.B totalPass
Total number of requests passed to the backend.
.TP
.B totalFetch
Total number of fetches.
.TP
.B totalRequestHeaderBytes
Total request header bytes received.
.TP
.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.
.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
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. This variable is available only in Varnish version \fR4.0\fR.
.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. This variable is available only in
Varnish version \fR4.0\fR.
.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 in the \fBsnmpd.conf\fR file
(see the \fBvarnishBanTableTimeout\fR statement above).
.SS Branch \(dqagent\(dq
The \fBagent\fR branch is reserved for OIDs for
implementation-specific management. It is not used currently.
.SH "SEE ALSO"
.BR snmpd.conf (5),
.BR snmpd (8),
.BR varnish (7),
.BR varnishstat (1).
.SH AUTHORS
Sergey Poznyakoff
.SH "BUG REPORTS"
Report bugs to .
.SH COPYRIGHT
Copyright \(co 2014-2016 Sergey Poznyakoff
.br
.na
License GPLv3+: GNU GPL version 3 or later
.br
.ad
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
.\" Local variables:
.\" eval: (add-hook 'write-file-hooks 'time-stamp)
.\" time-stamp-start: ".TH [A-Z_][A-Z0-9_.-]* [0-9] \""
.\" time-stamp-format: "%:B %:d, %:y"
.\" time-stamp-end: "\""
.\" time-stamp-line-limit: 20
.\" end: