diff options
Diffstat (limited to 'src/varnish_mib.mib2c')
-rw-r--r-- | src/varnish_mib.mib2c | 33 |
1 files changed, 28 insertions, 5 deletions
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(); } |