varnish−mib − Net-SNMP module for Varnish Cache monitoring
dlmod varnish_mib /usr/lib/snmp/varnish−mib.so
Dynamically loadable object module for net-snmp that provides access to Varnish Cache statistics. The module is loaded into snmpd(8) as shown above (actual path can of course differ, depending on how the package was configured). This version is written for Varnish 5.2.1.
The values in the OID branches client, total, master, session, threads, and objects are obtained from Varnish API.
The OID branches backend, bans, and vcl are obtained using varnishd administrative interface (similar to varnishadm(8)).
To retrieve this information, the module must have enough permissions to scan the Varnish management directory and read files located in it. This directory is normally named /var/lib/varnish/HOSTNAME/_.vsm_mgt, where HOSTNAME stands for the server’s hostname. Unless snmpd(8) is run as root, special measures should be undertaken in order to grant access rights. For example, if the daemon runs as user snmp, running the following two commands after starting varnishd will do the trick:
setfacl -m u:snmp:rx /var/lib/varnish/$(hostname)/_.vsm_mgt setfacl -m u:snmp:r /var/lib/varnish/$(hostname)/_.vsm_mgt/*
Configuration statements specific to varnish−mib must appear in the snmpd.conf file, after the dlmod statement that loads the module.
configuration statements are available:
To create banTable (see below), varnish_mib connects to varnish administration port and issues the ban.list 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 varnishBanTableTimeout statement.
Update interval for backendTable. Default is 5 seconds.
Sets timeout for I/O operations with Varnish administrative port. Default is 5 seconds.
two statements are not normally needed, but are provided for
Sets the address of Varnish administrative interface socket.
Sets the pathname of the Varnish secret file.
defines the following debugging tokens:
Produces general debugging information.
Outputs verbose report about loading th ban table.
Displays additional information regarding varnish CLI interaction.
Enables full transcript of varnish CLI session.
Outputs verbose information about loading the backend information.
The following OIDs are defined in the VARNISH-MIB.txt file:
Number of accepted connections.
Number of received HTTP requests.
Number of cache hits. A cache hit indicates that an object has been delivered to a client without fetching it from a backend server.
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.
Number of misses. A cache miss indicates the object was fetched from the backend before delivering it to the client.
Client requests received, subject to 400 errors.
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 png images:
snmpset hostname VARNISH−MIB::clientBan.0 s ’req.url ~ "\.png$"’
Number of successful connections to the backend.
Number of backend connections not attempted, because of the unhealthy status of the backend.
Number of backend connections failed because there were too many connections open.
Number of failed backend connections.
Number of reused backend connections. This counter is increased whenever Varnish reuses a recycled connection.
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.
Backend connections retried.
Total backend requests made.
This branch provides a
conceptual table of backends with the corresponding
statistics. It is indexed by vbeIndex. Each row has
the following elements:
A string uniqiely identifying the backend.
IPv4 address of the backend. Empty if the backend has no IPv4 address.
IPv6 address of the backend. Empty if the backend has no IPv6 address.
Number of successful health probes.
Number of VCL references.
Total number of request header bytes sent to that backend.
Total number of request body bytes sent to that backend.
Total number of response header bytes received from that backend.
Total number of response body bytes received from that backend.
Total number of header bytes piped to that backend.
Total number of bytes piped to that backend.
Total number of bytes piped from that backend.
Total number of sessions served since the startup.
Total number of requests received since the startup.
Total number of requests piped to the backend.
Total number of requests passed to the backend.
Total number of fetches.
Total request header bytes received.
Total request body bytes received.
Total header bytes sent out in responses.
Total body bytes sent out in responses.
Total request header bytes received for piped sessions.
Total number of bytes forwarded from clients in pipe sessions.
Total number of bytes forwarded to clients in pipe sessions.
Master daemon uptime, in hundredths of a second.
Number of sessions succesfully accepted.
Number of times session was queued waiting for a thread.
Number of sessions dropped because session queue was full.
Number of sessions closed.
This OID was used in Varnish 4.1, but disappeared from version 5.0.
Number of sessions dropped for thread.
Number of session accept failures.
This OID was used in Varnish 4.1, but disappeared in version 5.0.
Number of thread pools.
Number of thread pools.
Number of times more threads were needed, but limit was reached in a thread pool.
Total number of threads created in all pools.
Total number of threads destroyed in all pools.
Number of times creating a thread failed.
Total number of bans.
Count of completed bans.
Number of bans using obj.*.
Number of bans using req.*.
Number of bans added.
Number of bans deleted.
Number of bans tested against objects (lookup).
Number of objects killed by bans (lookup).
Number of bans tested against objects (lurker).
Number of ban tests tested against objects (lookup).
Number of ban tests tested against objects (lurker).
Number of objects killed by bans (lurker).
Number of ans superseded by other bans.
Number of times lurker gave way for lookup.
Number of bytes used by the persisted ban lists.
Extra bytes in persisted ban lists due to fragmentation.
A table of configured varnish
bans. It is indexed by the banIndex OID. Each row has
the following elements:
Time when the ban was set.
Number of references to that ban. This equals to the number of objects in the varnish cache affected by that ban.
VCL expression of the ban.
Notice that for performance reasons, the ban table is cached, so the total number of rows in the banTable may diverge from the value of bansTotal variable. The default update interval is 60 seconds. It can be configured in the snmpd.conf file (see the varnishBanTableTimeout statement above).
Approximate number of HTTP objects (headers + body, if present) in the cache.
Number of unresurrected objects.
Approximate number of object metadata elements in the cache. Each object needs an objectcore, extra objectcores are for hit-for-miss, hit-for-pass and busy objects.
Approximate number of different hash entries in the cache.
Number of objects that expired from cache because of old age.
How many objects have been forcefully evicted from storage to make room for a new object.
Number of move operations done on the LRU list.
Number of purge operations executed.
Number of gzip operations.
Number of gunzip operations.
Number of loaded VCLs in total.
Number of VCLs available.
Number of discarded VCLs.
Number of VCL failures.
The agent branch is reserved for implementation-specific management. It is not used currently.
OIDs were used in Varnish 4. They are no longer available in
Client requests received, subject to 411 errors. This variable is available only in Varnish version 4.0.
Client requests received, subject to 413 errors. This variable is available only in Varnish version 4.0.
Number of unused backend connections. This variable is available only in Varnish version 4.0.
The OIDs clientRequestsReceived and totalRequests return the same value.
Report bugs to <firstname.lastname@example.org>.
© 2014-2018 Sergey Poznyakoff
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
Manpage server at Ulysses.gnu.org.ua.
Powered by mansrv 1.0