summaryrefslogtreecommitdiffabout
path: root/src
authorSergey Poznyakoff <gray@nxc.no>2018-02-01 20:36:41 (GMT)
committer Sergey Poznyakoff <gray@nxc.no>2018-02-01 20:36:41 (GMT)
commit8bba300e4118da5737b2f015028a9ca425e83628 (patch) (side-by-side diff)
tree7de98c55cf47c87d17f0404c44f91f879eafb898 /src
parent85f908426e444a596b979a9569bf83fadfa5ace1 (diff)
downloadvarnish-mib-8bba300e4118da5737b2f015028a9ca425e83628.tar.gz
varnish-mib-8bba300e4118da5737b2f015028a9ca425e83628.tar.bz2
Add new object IDs as per https://puszcza.gnu.org.ua/bugs/?362
* src/Makefile.am: Make sure VARNISH-MIB.txt is read from the src directory. * src/VARNISH-MIB.txt: Add new mibs. * src/varnish_mib.mib2c: Add new objects. Make sure objects marked with varnish_type NULL will never be returned.
Diffstat (limited to 'src') (more/less context) (ignore whitespace changes)
-rw-r--r--src/Makefile.am3
-rw-r--r--src/VARNISH-MIB.txt136
-rw-r--r--src/varnish_mib.mib2c33
3 files changed, 164 insertions, 8 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 3a7f12a..3b5547b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -34,20 +34,21 @@ BUILT_SOURCES = \
varnish_mib.c\
varnish_mib.h
varnish_mib.c varnish_mib.h: varnish_mib.mib2c VARNISH-MIB.txt
.mib2c.c:
- MIBDIRS=${top_srcdir}/src:${NET_SNMP_MIBDIRS} MIBS="+VARNISH-MIB" \
+ MIBDIRS=${top_srcdir}/src:${NET_SNMP_MIBDIRS} MIBS="VARNISH-MIB:${NET_SNMP_MIBS}" \
mib2c -c $< -f $@ varnish
#NET_SNMP_INCLUDES = `$(NET_SNMP_CONFIG) --cflags`
#NET_SNMP_INCLUDES =
NET_SNMP_LIBS = `$(NET_SNMP_CONFIG) --libs`
NET_SNMP_EXLIBS = `$(NET_SNMP_CONFIG) --external-libs`
NET_SNMP_MIBDIRS = `net-snmp-config --mibdirs`
+NET_SNMP_MIBS = `net-snmp-config --default-mibs`
AM_LDFLAGS = \
-module \
-export-dynamic\
-avoid-version \
-rpath '$(dlmoddir)'\
diff --git a/src/VARNISH-MIB.txt b/src/VARNISH-MIB.txt
index 59a9d42..8d60477 100644
--- a/src/VARNISH-MIB.txt
+++ b/src/VARNISH-MIB.txt
@@ -17,20 +17,20 @@ IMPORTS
InetAddressIPv4, InetAddressIPv6, InetPortNumber
FROM INET-ADDRESS-MIB
OBJECT-GROUP, MODULE-COMPLIANCE
FROM SNMPv2-CONF;
varnishMIB MODULE-IDENTITY
- LAST-UPDATED "201509250838Z"
+ LAST-UPDATED "201802012132Z"
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 "201509250838Z"
+ REVISION "201802012132Z"
DESCRIPTION
"Second revision."
::= { varnish 0 }
varnish OBJECT IDENTIFIER ::= { enterprises 33043 6 1 }
client OBJECT IDENTIFIER ::= { varnish 1 }
@@ -38,12 +38,14 @@ 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
@@ -780,12 +782,142 @@ banExpression OBJECT-TYPE
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"VCL expression of the ban."
::= { varnishBanEntry 4 }
+objectsCount OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Approximate number of HTTP objects (headers + body,
+ if present) in the cache."
+ ::= { objects 1 }
+
+objectsVampire OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Number of unresurrected objects."
+ ::= { objects 2 }
+
+objectsCore OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "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."
+ ::= { objects 3 }
+
+objectsHead OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Approximate number of different hash entries in the cache."
+ ::= { objects 4 }
+
+objectsExpired OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Number of objects that expired from cache because of old age."
+ ::= { 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"
+ ::= { 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."
+ ::= { objects 11 }
+
+
+--
+-- VCL statistics
+--
+
+vclTotal OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Number of loaded VCLs in total."
+ ::= { vcl 1 }
+
+vclAvail OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Number of VCLs available."
+ ::= { vcl 2 }
+
+vclDiscard OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Number of discarded VCLs."
+ ::= { vcl 3 }
+
+vclFail OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Number of VCL failures"
+ ::= { vcl 4 }
+
--
-- Groups and Compliance
--
varnishConfs OBJECT IDENTIFIER ::= { varnish 100 }
varnishGroups OBJECT IDENTIFIER ::= { varnishConfs 1 }
varnishCompl OBJECT IDENTIFIER ::= { varnishConfs 2 }
diff --git a/src/varnish_mib.mib2c b/src/varnish_mib.mib2c
index a458723..155df42 100644
--- a/src/varnish_mib.mib2c
+++ b/src/varnish_mib.mib2c
@@ -95,13 +95,29 @@ $vars{'varnish_translate_table'} = {
bansLurkerTestTested => [ 'DICT', 'MAIN.bans_lurker_tests_tested' ],
bansLurkerObjKilled => [ 'DICT', 'MAIN.bans_lurker_obj_killed' ],
bansDups => [ 'DICT', 'MAIN.bans_dups' ],
bansLurkerContention => [ 'DICT', 'MAIN.bans_lurker_contention' ],
bansPersistedBytes => [ 'DICT', 'MAIN.bans_persisted_bytes' ],
bansPersistedFragmentation => [ 'DICT', 'MAIN.bans_persisted_fragmentation' ],
-
+
+ objectsCount => [ 'DICT', 'MAIN.n_object' ],
+ objectsVampire => [ 'DICT', 'MAIN.n_vampireobject' ],
+ objectsCore => [ 'DICT', 'MAIN.n_objectcore' ],
+ objectsHead => [ 'DICT', 'MAIN.n_objecthead' ],
+ objectsExpired => [ 'DICT', 'MAIN.n_expired' ],
+ objectsLRUNuked => [ 'DICT', 'MAIN.n_lru_nuked' ],
+ objectsLRUMoved => [ 'DICT', 'MAIN.n_lru_moved' ],
+ objectsPurges => [ 'DICT', 'MAIN.n_purges' ],
+ objectsObjPurged => [ 'DICT', 'MAIN.n_obj_purged' ],
+ objectsGzip => [ 'DICT', 'MAIN.n_gzip' ],
+ objectsGunzip => [ 'DICT', 'MAIN.n_gunzip' ],
+
+ vclTotal => [ 'DICT', 'MAIN.n_vcl' ],
+ vclAvail => [ 'DICT', 'MAIN.n_vcl_avail' ],
+ vclDiscard => [ 'DICT', 'MAIN.n_vcl_discard' ],
+ vclFail => [ 'DICT', 'MAIN.vcl_fail' ],
};
$vars{'varnish_translate'} = sub {
my $name = shift;
my $r = $vars{'varnish_translate_table'}->{$name};
@@ -234,15 +250,17 @@ varnish_get_vsm_data()
An instance handler only hands us one request at a time, unwrapping
any eventual GETNEXT requests.
*/
@foreach $i scalar@
+/* COMMX $i */
@startperl@
&{$vars{'varnish_translate'}}($vars{'i'});
@endperl@
+@if $varnish_type ne 'NULL'@
$varnish_if
static int
handle_$i(netsnmp_mib_handler *handler,
netsnmp_handler_registration *reginfo,
netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests)
@@ -299,21 +317,21 @@ handle_$i(netsnmp_mib_handler *handler,
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@
- @elsif $varnish_type eq 'NULL'@
+ @elsif $varnish_type eq 'NUMBER'@
{
@if $i.type eq 'ASN_COUNTER64'@
- struct counter64 ctr = { 0, 0};
+ struct counter64 ctr = { ($varnish_member>>32)&0xffffffff, ($varnish_member)&0xffffffff };
snmp_set_var_typed_value(requests->requestvb, $i.type,
&ctr,
sizeof(ctr));
@else@
- uint64_t val;
+ uint64_t val = $varnish_member;
snmp_set_var_typed_value(requests->requestvb, $i.type,
&val,
sizeof(val));
@end@
}
@else@
@@ -385,12 +403,13 @@ handle_$i(netsnmp_mib_handler *handler,
}
return SNMP_ERR_NOERROR;
}
$varnish_endif
@end@
+@end@
@foreach $i table@
## Determine the first/last column names
@eval $first_column = "-"@
@eval $last_column = "-"@
@foreach $c column@
@@ -571,15 +590,17 @@ void
init_$modulename(void)
{
@foreach $i scalar@
@startperl@
&{$vars{'varnish_translate'}}($vars{'i'});
@endperl@
+ @if $varnish_type ne 'NULL'@
$varnish_if
const oid ${i}_oid[] = { $i.commaoid };
$varnish_endif
+ @end@
@end@
DEBUGMSGTL(("$modulename", "Initializing\n"));
if (!register_config_handler("snmpd", "varnishBanTableTimeout",
varnish_ban_table_timeout_parser,
@@ -598,24 +619,26 @@ $varnish_endif
snmp_log(LOG_ERR,"can't register config handler\n");
@foreach $i scalar@
@startperl@
&{$vars{'varnish_translate'}}($vars{'i'});
@endperl@
+ @if $varnish_type ne 'NULL'@
$varnish_if
netsnmp_register_scalar(
netsnmp_create_handler_registration("$i", handle_$i,
${i}_oid, OID_LENGTH(${i}_oid),
@if !$i.settable@
HANDLER_CAN_RONLY
@end@
@if $i.settable@
HANDLER_CAN_RWRITE
@end@
));
-$varnish_endif
+$varnish_endif
+ @end@
@end@
@foreach $i table@
initialize_table_$i();
@end@
varnish_snmp_init();
}

Return to:

Send suggestions and report system problems to the System administrator.