diff options
author | Sergey Poznyakoff <gray@nxc.no> | 2018-02-05 20:56:59 +0100 |
---|---|---|
committer | Sergey Poznyakoff <gray@nxc.no> | 2018-02-05 20:56:59 +0100 |
commit | f7677f32b90eea37e54b39a3e26e5437924a2ada (patch) | |
tree | 4112eecd0acecd664e613fd1b66dd177b7ab87ba | |
parent | 027e83b6f5dc6a63ed9c69e534c0b994041df14f (diff) | |
download | varnish-mib-f7677f32b90eea37e54b39a3e26e5437924a2ada.tar.gz varnish-mib-f7677f32b90eea37e54b39a3e26e5437924a2ada.tar.bz2 |
Version 2.0
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | NEWS | 90 | ||||
-rw-r--r-- | README | 34 | ||||
-rw-r--r-- | configure.ac | 12 | ||||
-rw-r--r-- | lib/VarnishMib/HashTable.pm | 16 | ||||
-rw-r--r-- | lib/VarnishMib/MIBTable.pm | 16 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/VARNISH-MIB.txt | 6 | ||||
-rw-r--r-- | src/auth.c | 2 | ||||
-rw-r--r-- | src/backend.h | 3 | ||||
-rw-r--r-- | src/ban.c | 2 | ||||
-rw-r--r-- | src/belex.l | 17 | ||||
-rw-r--r-- | src/modconf.c | 17 | ||||
-rw-r--r-- | src/varnish-mib.8 | 85 | ||||
-rw-r--r-- | src/vcli.c | 2 |
15 files changed, 254 insertions, 52 deletions
diff --git a/Makefile.am b/Makefile.am index 30060d5..cea3646 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,26 +1,26 @@ # This file is part of varnish-mib -*- automake -*- -# Copyright (C) 2014-2015 Sergey Poznyakoff +# Copyright (C) 2014-2018 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 <http://www.gnu.org/licenses/>. ACLOCAL_AMFLAGS = -I m4 SUBDIRS = src EXTRA_DIST=\ git2chg.awk\ lib/prereq.pl\ lib/VarnishMib/HashTable.pm\ lib/VarnishMib/MIBTable.pm .PHONY: ChangeLog ChangeLog: $(AM_V_GEN)if test -d .git; then \ @@ -1,43 +1,127 @@ -Varnish-mib NEWS -- history of user-visible changes. 2016-04-27 -Copyright (C) 2014-2016 Sergey Poznyakoff +Varnish-mib NEWS -- history of user-visible changes. 2018-02-05 See the end of file for copying conditions. Please send Varnish-mib bug reports to <gray@gnu.org> +Version 2.0, 2018-02-05 + +This version is written for Varnish 5.2.0. It will definitely not +compile with Varnish 5.2.1 and later. You'll have to use version 3.0 +for that. + +Most important changes: + +New OIDs: + +** VarnishMIB::objects branch + + objectsCount + + Approximate number of HTTP objects (headers + body, + if present) in the cache. + [Varnish variable MAIN.n_object] + + objectsVampire + Number of unresurrected objects. + [MAIN.n_vampireobject] + + objectsCore + 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. + [MAIN.n_objectcore] + + objectsHead + Approximate number of different hash entries in the cache. + [MAIN.n_objecthead] + + objectsExpired + Number of objects that expired from cache because of old age. + [MAIN.n_expired] + + objectsLRUNuked + How many objects have been forcefully evicted from + storage to make room for a new object. + [MAIN.n_lru_nuked] + + objectsLRUMoved + Number of move operations done on the LRU list. + [MAIN.n_lru_moved] + + objectsPurges + Number of purge operations executed. + [MAIN.n_purges] + + objectsObjPurged + Number of purged objects. + [MAIN.n_obj_purged] + + objectsGzip + Number of gzip operations. + [MAIN.n_gzip] + + objectsGunzip + Number of gunzip operations. + [MAIN.n_gunzip] + +** VarnishMIB::vcl branch + + vclTotal + Number of loaded VCLs in total. + [MAIN.n_vcl] + + vclAvail + Number of VCLs available. + [MAIN.n_vcl_avail] + + vclDiscard + Number of discarded VCLs. + [MAIN.n_vcl_discard] + + vclFail + Number of VCL failures. + [MAIN.vcl_fail] + +* Removed OIDs + +Several OIDs have been withdrawn due to changes in the Varnish API. +These are: clientRequests411, clientRequests413, and backendConnUnused. + + Version 1.1.90 (Git) * Support for Varnish 4.1 Version 1.1, 2015-02-25 * Don't exit if unable to open Varnish memory file Version 1.0, 2014-11-28 Initial release. * Copyright information: -Copyright (C) 2014-2016 Sergey Poznyakoff +Copyright (C) 2014-2018 Sergey Poznyakoff Permission is granted to anyone to make or distribute verbatim copies of this document as received, in any medium, provided that the copyright notice and this permission notice are preserved, thus giving the recipient permission to redistribute in turn. Permission is granted to distribute modified versions of this document, or of portions of it, under the above conditions, provided also that they carry prominent notices stating who last changed them. Local variables: mode: outline paragraph-separate: "[ ]*$" eval: (add-hook 'write-file-hooks 'time-stamp) time-stamp-start: "changes. " time-stamp-format: "%:y-%02m-%02d" time-stamp-end: "\n" end: @@ -1,67 +1,91 @@ Varnish-mib README -Copyright (C) 2014-2015 Sergey Poznyakoff See the end of file for copying conditions. * Introduction This file contains brief information about configuring, testing and using Varnish-mib. It is *not* intended as a replacement for the documentation, and is provided as a brief reference only. For a detailed documentation, please see the varnish-mib(8) manpage. +If you are building varnish-mib from Git repository, jump to +the section GIT SOURCES, below. + * Overview Varnish-mib is a dynamically loadable object module for net-snmp snmpd, that provides access to Varnish Cache statistics. It uses MIBs from varnishsnmp project (http://varnishsnmp.sourceforge.net). +This and other versions of Varnish-mib is available for download from +<http://download.gnu.org.ua/release/varnish-mib>. The following table +describes the relation between the release number and the version +of Varnish API version it is written for: + + 1.0 and up to 2.0 Varnish 4.0 and 4.1 + 2.0 (this release) Varnish 5.2.0 + 3.0 Varnish 5.2.1 + * Installation -In order to compile the package you need to have Net-snmp and Varnish -installed. Only Varnish 4.x is supported. The installation sequence -is as usual: +In order to compile the package you need to have Net-SNMP and Varnish +installed. The installation sequence is as usual: ./configure [options] make make install (the last step normally requires root privileges). For generic options to configure, please see the file INSTALL. Package-specific options are: ** --with-dlmoddir=DIR Install varnish_mod.so in DIR. By default it is installed in $PREFIX/lib/snmp, where $PREFIX stands for the installation prefix. ** --with-mibdir=DIR Install MIBs (the file VARNISH-MIB.txt in DIR. By default it is installed in $prefix/share/snmp. +* GIT SOURCES + +If you cloned the sources from GIT, you will need the following +additional tools in order to bootstrap the package: + + + Perl + + mib2c + + Perl module Inline::C + + Flex + +Make sure to check out the branch corresponding to the version of +Varnish you are using. Run ./bootstrap. Then, proceed as discussed +above. + * Bug reporting Send bug reports and suggestions to <gray@gnu.org> * Copyright information: -Copyright (C) 2014 Sergey Poznyakoff +Copyright (C) 2014-2018 Sergey Poznyakoff Permission is granted to anyone to make or distribute verbatim copies of this document as received, in any medium, provided that the copyright notice and this permission notice are preserved, thus giving the recipient permission to redistribute in turn. Permission is granted to distribute modified versions of this document, or of portions of it, under the above conditions, provided also that they carry prominent notices stating who last changed them. Local Variables: mode: outline paragraph-separate: "[ ]*$" version-control: never End: diff --git a/configure.ac b/configure.ac index 84544b2..917bab5 100644 --- a/configure.ac +++ b/configure.ac @@ -1,82 +1,82 @@ # This file is part of Varnish-mib -*- autoconf -*- # Copyright (C) 2014-2018 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 <http://www.gnu.org/licenses/>. AC_PREREQ(2.69) -AC_INIT([varnish-mib], 1.1.90, [gray@gnu.org]) +AC_INIT([varnish-mib], 2.0, [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 AC_LANG(C) AM_INIT_AUTOMAKE([gnu tar-ustar silent-rules]) AM_SILENT_RULES([yes]) AC_GNU_SOURCE AC_PROG_CC AC_PROG_CC_STDC if test "x$ac_cv_prog_cc_c99" = xno; then AC_MSG_ERROR([could not find a C99 compatible compiler]) fi AC_PROG_CPP AM_PROG_LEX AC_PROG_INSTALL AC_PROG_LIBTOOL AC_PROG_MAKE_SET # Check for pkg-config PKG_PROG_PKG_CONFIG # Checks for Varnish PKG_CHECK_MODULES([VARNISHAPI], [varnishapi >= 5.0]) -varnishapi_version() { - AC_DEFINE_UNQUOTED([VARNISHAPI_MAJOR],[$1],[Varnish API major version number]) - AC_DEFINE_UNQUOTED([VARNISHAPI_MINOR],[$2],[Varnish API minor version number]) - AC_DEFINE_UNQUOTED([VARNISHAPI_PATCH],[$3],[Varnish API patchlevel]) +check_minor_number() { + if [ "$2" -gt 1 ]; then + AC_MSG_ERROR([Unsupported Varnish API version; please try varnish_mib 3.0 or newer]) + fi } v=$($PKG_CONFIG --modversion varnishapi) if test -n "$v"; then save_IFS=$IFS IFS='.' - varnishapi_version $v + check_minor_number $v IFS=$save_IFS fi # Check for Net-SNMP AC_PATH_PROG([NET_SNMP_CONFIG], net-snmp-config, none, $PATH) if test "$NET_SNMP_CONFIG" = "none"; then AC_MSG_ERROR([cannot find Net-SNMP (net-snmp-config not found)]) fi AC_SUBST(NET_SNMP_CONFIG) # Checks for header files. AC_HEADER_STDC # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_SIZE_T # Directories AC_SUBST([DLMODDIR],['$(libdir)/snmp']) AC_ARG_WITH([dlmoddir], [AC_HELP_STRING([--with-dlmoddir=DIR], [installation directory for net-snmp loadable agents])], [case $withval in /*) DLMODDIR=$withval;; diff --git a/lib/VarnishMib/HashTable.pm b/lib/VarnishMib/HashTable.pm index 1faef96..00224ac 100644 --- a/lib/VarnishMib/HashTable.pm +++ b/lib/VarnishMib/HashTable.pm @@ -1,24 +1,40 @@ +# This file is part of varnish-mib -*- automake -*- +# Copyright (C) 2018 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 <http://www.gnu.org/licenses/>. + package VarnishMib::HashTable; use strict; use warnings; use Carp; use Inline 'C'; use Pod::Usage; use Pod::Man; =head1 NAME VarnishMib::HashTable - Create a hash table implementation in C =head1 DESCRIPTION Given a list of unique strings, creates a C code for fast look ups of data associated with them. =head1 CONSTRUCTOR $ht = new VarnishMib::HashTable([KW => VAL,...]); Returns a new instance of the hash table generator. Allowed arguments are: =over 4 diff --git a/lib/VarnishMib/MIBTable.pm b/lib/VarnishMib/MIBTable.pm index 6aa959f..da0ca19 100644 --- a/lib/VarnishMib/MIBTable.pm +++ b/lib/VarnishMib/MIBTable.pm @@ -1,24 +1,40 @@ +# This file is part of varnish-mib -*- automake -*- +# Copyright (C) 2018 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 <http://www.gnu.org/licenses/>. + package VarnishMib::MIBTable; use strict; use warnings; use parent 'VarnishMib::HashTable'; use Carp; sub new { my ($class, $type, $table, %args) = @_; my @oids = sort { $table->{$a}[1] cmp $table->{$b}[1] } grep { $table->{$_}[0] eq 'DICT' } keys %{$table}; my @equiv; my @uniq_oids; for (my $i = 0; $i <= $#oids; $i++) { unless ($i > 0 && $table->{$uniq_oids[-1]}[1] eq $table->{$oids[$i]}[1]) { push @uniq_oids, $oids[$i]; } push @equiv, $#uniq_oids; } my $self = bless $class->SUPER::new(%args), $class; $self->{oids_all} = \@oids; $self->{oids_uniq} = \@uniq_oids; diff --git a/src/Makefile.am b/src/Makefile.am index 55cdb85..5c79dfc 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,26 +1,26 @@ # This file is part of varnish-mib -*- automake -*- -# Copyright (C) 2014-2015 Sergey Poznyakoff +# Copyright (C) 2014-2018 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 <http://www.gnu.org/licenses/>. dlmoddir=@DLMODDIR@ dlmod_LTLIBRARIES = varnish-mib.la varnish_mib_la_SOURCES = \ auth.c\ ban.c\ backend.h\ belex.l\ betab.c\ modconf.h\ diff --git a/src/VARNISH-MIB.txt b/src/VARNISH-MIB.txt index 6b03f21..b7e77f1 100644 --- a/src/VARNISH-MIB.txt +++ b/src/VARNISH-MIB.txt @@ -1,54 +1,54 @@ VARNISH-MIB DEFINITIONS ::= BEGIN -- ************************************************************* -- $Id: VARNISH-MIB.txt 8 2014-11-24 14:38:24Z graygnuorg $ -- -- Varnish reverse proxy MIB -- by Shared Autonomous sYstems -- -- ************************************************************* IMPORTS MODULE-IDENTITY, OBJECT-TYPE, enterprises, Counter64, TimeTicks, Counter32, Integer32 FROM SNMPv2-SMI TEXTUAL-CONVENTION, DateAndTime FROM SNMPv2-TC InetAddressIPv4, InetAddressIPv6, InetPortNumber FROM INET-ADDRESS-MIB OBJECT-GROUP, MODULE-COMPLIANCE FROM SNMPv2-CONF; varnishMIB MODULE-IDENTITY - LAST-UPDATED "201802020845Z" + LAST-UPDATED "201802052024Z" ORGANIZATION "Shared Autonomous sYstems" CONTACT-INFO "Morten Hermanrud <mhe@say.no> Sergey Poznyakoff <gray@gnu.org> " DESCRIPTION "This MIB module defines objects for Varnish reverse web proxy." - REVISION "201802020845Z" + REVISION "201802052024Z" DESCRIPTION "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 } objects OBJECT IDENTIFIER ::= { varnish 9 } vcl OBJECT IDENTIFIER ::= { varnish 10 } clientAcceptedConnections OBJECT-TYPE SYNTAX Counter64 MAX-ACCESS read-only STATUS current DESCRIPTION "Client connections accepted." ::= { client 1 } @@ -833,49 +833,49 @@ objectsExpired OBJECT-TYPE ::= { objects 5 } objectsLRUNuked OBJECT-TYPE SYNTAX Counter64 MAX-ACCESS read-only STATUS current DESCRIPTION "How many objects have been forcefully evicted from storage to make room for a new object." ::= { objects 6 } objectsLRUMoved OBJECT-TYPE SYNTAX Counter64 MAX-ACCESS read-only STATUS current DESCRIPTION "Number of move operations done on the LRU list." ::= { objects 7 } objectsPurges OBJECT-TYPE SYNTAX Counter64 MAX-ACCESS read-only STATUS current DESCRIPTION - "Number of purge operations executed" + "Number of purge operations executed." ::= { objects 8 } objectsObjPurged OBJECT-TYPE SYNTAX Counter64 MAX-ACCESS read-only STATUS current DESCRIPTION "Number of purged objects." ::= { objects 9 } objectsGzip OBJECT-TYPE SYNTAX Counter64 MAX-ACCESS read-only STATUS current DESCRIPTION "Number of gzip operations." ::= { objects 10 } objectsGunzip OBJECT-TYPE SYNTAX Counter64 MAX-ACCESS read-only STATUS current DESCRIPTION "Number of gunzip operations." @@ -1,26 +1,26 @@ /* This file is part of varnish-mib -*- c -*- - Copyright (C) 2014-2015 Sergey Poznyakoff + Copyright (C) 2014-2018 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 <http://www.gnu.org/licenses/>. */ #include "varnish_mib.h" #include "sha256.h" #include <unistd.h> #include <fcntl.h> #include <assert.h> #include <errno.h> void varnish_auth_response_fd(int fd, const char *challenge, diff --git a/src/backend.h b/src/backend.h index d60f613..b13e644 100644 --- a/src/backend.h +++ b/src/backend.h @@ -1,16 +1,15 @@ typedef struct be_string { char const *start; size_t len; } be_string_t; typedef void (*regfun_t)(be_string_t *, be_string_t *, be_string_t *, void *); -void read_defs(const char *str, size_t len, regfun_t regfun, void *d); -void varnish_backend_table_timeout_parser(const char *token, char *line); +struct vsm; struct VSC_point; void backend_register(char const *name, size_t len, char const *param, const struct VSC_point *vpt); void backend_clear(void); int backend_collect_addr(struct vsm *vsm); void backend_parser(const char *str, size_t len, regfun_t regfun, void *d); @@ -1,26 +1,26 @@ /* This file is part of varnish-mib -*- c -*- - Copyright (C) 2014-2015 Sergey Poznyakoff + Copyright (C) 2014-2018 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 <http://www.gnu.org/licenses/>. */ #include "varnish_mib.h" #include <ctype.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; diff --git a/src/belex.l b/src/belex.l index f35f114..bc0bfc0 100644 --- a/src/belex.l +++ b/src/belex.l @@ -1,24 +1,41 @@ +/* This file is part of varnish-mib + Copyright (C) 2018 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 <http://www.gnu.org/licenses/>. +*/ + %option nounput %option noinput %{ #include "backend.h" enum { T_BOGUS = 256, T_IDENT, T_NUMBER, T_STRING, T_BACKEND, T_HOST, T_PORT }; static char const *input_string; static size_t input_len; static size_t input_pos; static char const *string_start; static size_t current_pos; #define YY_INPUT(buf,result,max_size) \ do { \ diff --git a/src/modconf.c b/src/modconf.c index 85b2582..64177c1 100644 --- a/src/modconf.c +++ b/src/modconf.c @@ -1,24 +1,41 @@ +/* This file is part of varnish-mib + Copyright (C) 2018 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 <http://www.gnu.org/licenses/>. +*/ + #include "varnish_mib.h" #include <ctype.h> static int timeout_parser(const char *token, char *line, unsigned *retval) { 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 1; } } else { config_perror("invalid timeout value"); return 1; } } if (n > UINT_MAX) { diff --git a/src/varnish-mib.8 b/src/varnish-mib.8 index 8d86f18..77912af 100644 --- a/src/varnish-mib.8 +++ b/src/varnish-mib.8 @@ -1,151 +1,179 @@ .\" This file is part of Varnish-mib -*- nroff -*- -.\" Copyright (C) 2014-2016 Sergey Poznyakoff +.\" Copyright (C) 2014-2018 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 <http://www.gnu.org/licenses/>. -.TH VARNISH-MIB 8 "February 2, 2018" "varnish-mib" +.TH VARNISH-MIB 8 "February 5, 2018" "varnish-mib" .SH NAME -varnish\-mib \- net-snmp module for obtaining Varnish Cache statistics +varnish\-mib \- Net-SNMP module for Varnish Cache monitoring .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). The module is written for Varnish -version \fB5.\fIX\fR. +the package was configured). This version is written for Varnish +\fB5.2.0\fR. .PP -The module obtains most of the data using Varnish API, and \fBvarnishd\fR -administrative interface. You should make sure that \fBsnmpd\fR is -able to access both data sources. +The values in the OID branches +.BR client , +.BR total , +.BR master , +.BR session , +.BR threads ", and " +.B objects +are obtained from Varnish API. .PP -The user \fBsnmpd\fR runs as should be able to read contents of the -\fB/var/lib/varnish/\fIHOSTNAME\fB/_.vsm_mgt\fR directory and read -files located in it. It must also have read permission on the varnish -secret file. +The OID branches +.BR backend , +.BR bans ", and " +.B vcl +are obtained using \fBvarnishd\fR administrative interface (similar +to +.BR varnishadm (8)). +.PP +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 +\fB/var/lib/varnish/\fIHOSTNAME\fB/_.vsm_mgt\fR, where \fIHOSTNAME\fR +stands for the server's hostname. Unless +.BR 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 +\fBsnmp\fR, running the following two commands after starting +\fBvarnishd\fR will do the trick: + +.EX + setfacl -m u:snmp:rx /var/lib/varnish/$(hostname)/_.vsm_mgt + setfacl -m u:snmp:r /var/lib/varnish/$(hostname)/_.vsm_mgt/* +.EE +.PP + .SH CONFIGURATION OPTIONS Configuration statements specific to .B varnish\-mib must appear in the .B snmpd.conf -file below the +file, after 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 \fBvarnishBackendTableTimeout\fR \fINUMBER\fR Update interval for \fBbackendTable\fR. Default is 5 seconds. .TP \fBvarnishCLIPortTimeout\fR \fINUMBER\fR Sets timeout for I/O operations with Varnish administrative port. Default is 5 seconds. .PP -The following two statements are not normally needed, since -\fBvarnish-mib\fR obtains this information automatically. +The following two statements are not normally needed, but are +provided for completeness sake: .TP \fBvarnishCLISocket\fR \fIADDRESS\fR[:\fIPORT\fR] Sets the address of Varnish administrative interface socket. .TP \fBvarnishCLISecretFile\fR \fIFILE\fR -Pathname of the Varnish secret file. +Sets the pathname of the Varnish secret file. .SH DEBUGGING The module defines the following debugging tokens: .TP .B varnish_mib -General debugging information. +Produces general debugging information. .TP .B varnish_mib:ban -Debug ban table loading. +Outputs verbose report about loading th ban table. .TP .B varnish_mib:vcli -Varnish +Displays additional information regarding varnish .B CLI interaction. .TP .B varnish_mib:vcli:transcript -Enables full transcript of CLI interaction. +Enables full transcript of varnish CLI session. .TP .B varnish_mib:backend -Debug loading the backend information. +Outputs verbose information about loading the backend information. .SH OIDS -The following OIDs are defined: +The following OIDs are defined in the +.B VARNISH-MIB.txt +file: .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 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 +snmpset \fIhostname\fR VARNISH\-MIB::clientBan.0 s 'req.url ~ \(dq\\.png$\(dq' +.EE .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 |