aboutsummaryrefslogtreecommitdiff
path: root/src/varnish_mib.mib2c
diff options
context:
space:
mode:
Diffstat (limited to 'src/varnish_mib.mib2c')
-rw-r--r--src/varnish_mib.mib2c227
1 files changed, 122 insertions, 105 deletions
diff --git a/src/varnish_mib.mib2c b/src/varnish_mib.mib2c
index 9d49ce9..a458723 100644
--- a/src/varnish_mib.mib2c
+++ b/src/varnish_mib.mib2c
@@ -1,3 +1,3 @@
# This file is part of varnish-mib -*- c -*-
-# Copyright (C) 2014-2016 Sergey Poznyakoff
+# Copyright (C) 2014-2018 Sergey Poznyakoff
#
@@ -27,8 +27,7 @@
$vars{'varnish_translate_table'} = {
- uptime => [ 'MAIN', 'uptime' ],
- clientAcceptedConnections => [ 'MAIN', 'sess_conn' ],
- clientRequestsReceived => [ 'MAIN', 'client_req' ],
- clientCacheHits => [ 'MAIN', 'cache_hit' ],
- clientCacheHitsPass => [ 'MAIN', 'cache_hitpass' ],
- clientCacheMisses => [ 'MAIN', 'cache_miss' ],
+ uptime => [ 'DICT', 'MAIN.uptime' ],
+ clientAcceptedConnections => [ 'DICT', 'MAIN.sess_conn' ],
+ clientCacheHits => [ 'DICT', 'MAIN.cache_hit' ],
+ clientCacheHitsPass => [ 'DICT', 'MAIN.cache_hitpass' ],
+ clientCacheMisses => [ 'DICT', 'MAIN.cache_miss' ],
clientBan => [ 'STRING', '',
@@ -36,67 +35,67 @@ $vars{'varnish_translate_table'} = {
- clientRequestsReceived => [ 'MAIN', 'client_req' ],
- clientRequests400 => [ 'MAIN', 'client_req_400' ],
- clientRequests411 => [ 'MAIN', 'client_req_411' ],
- clientRequests413 => [ 'MAIN', 'client_req_413' ],
- clientRequests417 => [ 'MAIN', 'client_req_417' ],
+ clientRequestsReceived => [ 'DICT', 'MAIN.client_req' ],
+ clientRequests400 => [ 'DICT', 'MAIN.client_req_400' ],
+ clientRequests411 => [ 'NULL', 'MAIN.client_req_411' ],
+ clientRequests413 => [ 'NULL', 'MAIN.client_req_413' ],
+ clientRequests417 => [ 'DICT', 'MAIN.client_req_417' ],
- backendConnSuccess => [ 'MAIN', 'backend_conn' ],
- backendConnNotAttempted => [ 'MAIN', 'backend_unhealthy' ],
- backendConnToMany => [ 'MAIN', 'backend_busy' ],
- backendConnFailures => [ 'MAIN', 'backend_fail' ],
- backendConnReuses => [ 'MAIN', 'backend_reuse' ],
- backendConnRecycled => [ 'MAIN', 'backend_recycle' ],
- backendConnUnused => [ 'MAIN', 'backend_toolate' ],
- backendConnRetry => [ 'MAIN', 'backend_retry' ],
- backendRequests => [ 'MAIN', 'backend_req' ],
+ backendConnSuccess => [ 'DICT', 'MAIN.backend_conn' ],
+ backendConnNotAttempted => [ 'DICT', 'MAIN.backend_unhealthy' ],
+ backendConnToMany => [ 'DICT', 'MAIN.backend_busy' ],
+ backendConnFailures => [ 'DICT', 'MAIN.backend_fail' ],
+ backendConnReuses => [ 'DICT', 'MAIN.backend_reuse' ],
+ backendConnRecycled => [ 'DICT', 'MAIN.backend_recycle' ],
+ backendConnUnused => [ 'NULL', 'MAIN.backend_toolate' ],
+ backendConnRetry => [ 'DICT', 'MAIN.backend_retry' ],
+ backendRequests => [ 'DICT', 'MAIN.backend_req' ],
- totalSessions => [ 'MAIN', 's_sess' ],
- totalRequests => [ 'MAIN', 's_req' ],
- totalPipe => [ 'MAIN', 's_pipe' ],
- totalPass => [ 'MAIN', 's_pass' ],
- totalFetch => [ 'MAIN', 's_fetch' ],
- totalRequestHeaderBytes => [ 'MAIN', 's_req_hdrbytes' ],
- totalRequestBodyBytes => [ 'MAIN', 's_req_bodybytes' ],
- totalResponseHeaderBytes => [ 'MAIN', 's_resp_hdrbytes' ],
- totalResponseBodyBytes => [ 'MAIN', 's_resp_bodybytes' ],
- totalPipeHeaderBytes => [ 'MAIN', 's_pipe_hdrbytes' ],
- totalPipeIn => [ 'MAIN', 's_pipe_in' ],
- totalPipeOut => [ 'MAIN', 's_pipe_out' ],
+ totalSessions => [ 'DICT', 'MAIN.s_sess' ],
+ totalRequests => [ 'DICT', 'MAIN.client_req' ],
+ totalPipe => [ 'DICT', 'MAIN.s_pipe' ],
+ totalPass => [ 'DICT', 'MAIN.s_pass' ],
+ totalFetch => [ 'DICT', 'MAIN.s_fetch' ],
+ totalRequestHeaderBytes => [ 'DICT', 'MAIN.s_req_hdrbytes' ],
+ totalRequestBodyBytes => [ 'DICT', 'MAIN.s_req_bodybytes' ],
+ totalResponseHeaderBytes => [ 'DICT', 'MAIN.s_resp_hdrbytes' ],
+ totalResponseBodyBytes => [ 'DICT', 'MAIN.s_resp_bodybytes' ],
+ totalPipeHeaderBytes => [ 'DICT', 'MAIN.s_pipe_hdrbytes' ],
+ totalPipeIn => [ 'DICT', 'MAIN.s_pipe_in' ],
+ totalPipeOut => [ 'DICT', 'MAIN.s_pipe_out' ],
- sessAccepted => [ 'MAIN', 'sess_conn'],
- sessQueued => [ 'MAIN', 'sess_queued'],
- sessDropped => [ 'MAIN', 'sess_dropped'],
- sessClosed => [ 'MAIN', 'sess_closed'],
- sessPipeline => [ 'MAIN', 'sess_pipeline'],
- sessReadAhead => [ 'MAIN', 'sess_readahead'],
- sessHerd => [ 'MAIN', 'sess_herd'],
- sessDrop => [ 'MAIN', 'sess_drop'],
- sessFail => [ 'MAIN', 'sess_fail'],
- sessPipeOverflow => [ 'MAIN', 'sess_pipe_overflow'],
-
- threadsPools => [ 'MAIN', 'pools'],
- threadsTotal => [ 'MAIN', 'threads'],
- threadsLimitHits => [ 'MAIN', 'threads_limited'],
- threadsCreated => [ 'MAIN', 'threads_created'],
- threadsDestroyed => [ 'MAIN', 'threads_destroyed'],
- threadsFailed => [ 'MAIN', 'threads_failed'],
- threadsQueueLength => [ 'MAIN', 'thread_queue_len'],
-
- bansTotal => [ 'MAIN', 'bans' ],
- bansCompleted => [ 'MAIN', 'bans_completed' ],
- bansObj => [ 'MAIN', 'bans_obj' ],
- bansReq => [ 'MAIN', 'bans_req' ],
- bansAdded => [ 'MAIN', 'bans_added' ],
- bansDeleted => [ 'MAIN', 'bans_deleted' ],
- bansTested => [ 'MAIN', 'bans_tested' ],
- bansObjectsKilled => [ 'MAIN', 'bans_obj_killed' ],
- bansLurkerTested => [ 'MAIN', 'bans_lurker_tested' ],
- bansTestTested => [ 'MAIN', 'bans_tests_tested' ],
- bansLurkerTestTested => [ 'MAIN', 'bans_lurker_tests_tested' ],
- bansLurkerObjKilled => [ 'MAIN', 'bans_lurker_obj_killed' ],
- bansDups => [ 'MAIN', 'bans_dups' ],
- bansLurkerContention => [ 'MAIN', 'bans_lurker_contention' ],
- bansPersistedBytes => [ 'MAIN', 'bans_persisted_bytes' ],
- bansPersistedFragmentation => [ 'MAIN', 'bans_persisted_fragmentation' ],
+ sessAccepted => [ 'DICT', 'MAIN.sess_conn'],
+ sessQueued => [ 'DICT', 'MAIN.sess_queued'],
+ sessDropped => [ 'DICT', 'MAIN.sess_dropped'],
+ sessClosed => [ 'DICT', 'MAIN.sess_closed'],
+ sessPipeline => [ 'DICT', 'MAIN.s_pipe'],
+ sessReadAhead => [ 'DICT', 'MAIN.sess_readahead'],
+ sessHerd => [ 'DICT', 'MAIN.sess_herd'],
+ sessDrop => [ 'DICT', 'MAIN.sess_drop'],
+ sessFail => [ 'DICT', 'MAIN.sess_fail'],
+ sessPipeOverflow => [ 'DICT', 'MAIN.sc_pipe_overflow'],
+
+ threadsPools => [ 'DICT', 'MAIN.pools'],
+ threadsTotal => [ 'DICT', 'MAIN.threads'],
+ threadsLimitHits => [ 'DICT', 'MAIN.threads_limited'],
+ threadsCreated => [ 'DICT', 'MAIN.threads_created'],
+ threadsDestroyed => [ 'DICT', 'MAIN.threads_destroyed'],
+ threadsFailed => [ 'DICT', 'MAIN.threads_failed'],
+ threadsQueueLength => [ 'DICT', 'MAIN.thread_queue_len'],
+
+ bansTotal => [ 'DICT', 'MAIN.bans' ],
+ bansCompleted => [ 'DICT', 'MAIN.bans_completed' ],
+ bansObj => [ 'DICT', 'MAIN.bans_obj' ],
+ bansReq => [ 'DICT', 'MAIN.bans_req' ],
+ bansAdded => [ 'DICT', 'MAIN.bans_added' ],
+ bansDeleted => [ 'DICT', 'MAIN.bans_deleted' ],
+ bansTested => [ 'DICT', 'MAIN.bans_tested' ],
+ bansObjectsKilled => [ 'DICT', 'MAIN.bans_obj_killed' ],
+ bansLurkerTested => [ 'DICT', 'MAIN.bans_lurker_tested' ],
+ bansTestTested => [ 'DICT', 'MAIN.bans_tests_tested' ],
+ 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' ],
@@ -120,9 +119,2 @@ $vars{'varnish_translate'} = sub {
}
- if ($vars{'varnish_type'} eq 'MAIN') {
- $vars{'varnish_if'} = "#if HAVE_STRUCT_VSC_C_MAIN_" . uc($vars{'varnish_member'});
- $vars{'varnish_endif'} = '#endif';
- } else {
- delete $vars{'varnish_if'};
- delete $vars{'varnish_endif'}
- }
return 0;
@@ -178,5 +170,5 @@ int vcli_asprintf(vcli_conn_t *conn, const char *fmt, ...);
void vcli_disconnect(vcli_conn_t *conn);
-int vcli_connect(struct VSM_data *vd, vcli_conn_t *conn);
+int vcli_connect(struct vsm *vsm, vcli_conn_t *conn);
-struct VSM_data *varnish_get_vsm_data(void);
+struct vsm *varnish_get_vsm_data(void);
@@ -187,3 +179,3 @@ int varnish_ban(netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests,
- struct VSM_data *vd);
+ struct vsm *vsm);
@@ -195,3 +187,5 @@ void varnish_vcli_timeout_parser(const char *token, char *line);
-void varnish_backend_table_timeout_parser(const char *token, char *line);
+int dict_lookup(char const *key, uint64_t *val);
+void dict_install(struct VSC_point const *pt);
+void dict_load(struct vsc *vsc);
@@ -201,4 +195,6 @@ void varnish_backend_table_timeout_parser(const char *token, char *line);
#include "varnish_mib.h"
+#include "backend.h"
-static struct VSM_data *vd;
+static struct vsm *vd;
+static struct vsc *vsc;
@@ -207,3 +203,11 @@ varnish_snmp_init(void)
{
- vd = VSM_New();
+ vd = VSM_New();
+ if (vd) {
+ vsc = VSC_New(vd);
+ if (vsc) {
+ if (VSM_Attach(vd, 2))
+ fprintf(stderr, "%s\n", VSM_Error(vd));
+ }
+ }
+ dict_load(vsc);
}
@@ -213,14 +217,15 @@ varnish_snmp_deinit(void)
{
- VSM_Close(vd);
+ /* FIXME? */
}
-struct VSM_data *
+struct vsm *
varnish_get_vsm_data()
{
- if (VSM_Abandoned(vd)) {
- DEBUGMSGTL(("$modulename", "reopening vd\n"));
- VSM_Close(vd);
- VSM_Open(vd);
- }
- return vd;
+ if (vd) {
+ if (VSM_Status(vd) & (VSM_MGT_CHANGED|VSM_WRK_CHANGED)) {
+ DEBUGMSGTL(("$modulename", "reopening vd\n"));
+ dict_load(vsc);
+ }
+ }
+ return vd;
}
@@ -253,11 +258,12 @@ handle_$i(netsnmp_mib_handler *handler,
case MODE_GET:
- @if $varnish_type eq 'MAIN'@
- {
- struct VSC_C_main const *st = VSC_Main(vd, NULL);
+ @if $varnish_type eq 'DICT'@
+ {
+ uint64_t val;
+ if (dict_lookup("$varnish_member", &val))
+ return SNMP_ERR_NOSUCHNAME;
@if $i.type eq 'ASN_COUNTER64'@
+ {
struct counter64 ctr;
- if (!st)
- return SNMP_ERR_NOSUCHNAME;
- ctr.high = st->$varnish_member >> 32;
- ctr.low = st->$varnish_member & 0xffffffff;
+ ctr.high = val >> 32;
+ ctr.low = val & 0xffffffff;
snmp_set_var_typed_value(requests->requestvb, $i.type,
@@ -265,8 +271,7 @@ handle_$i(netsnmp_mib_handler *handler,
sizeof(ctr));
+ }
@else@
- if (!st)
- return SNMP_ERR_NOSUCHNAME;
snmp_set_var_typed_value(requests->requestvb, $i.type,
- &st->$varnish_member,
- sizeof(st->$varnish_member));
+ &val,
+ sizeof(val));
@end@
@@ -299,2 +304,16 @@ handle_$i(netsnmp_mib_handler *handler,
@end@
+ @elsif $varnish_type eq 'NULL'@
+ {
+ @if $i.type eq 'ASN_COUNTER64'@
+ struct counter64 ctr = { 0, 0};
+ snmp_set_var_typed_value(requests->requestvb, $i.type,
+ &ctr,
+ sizeof(ctr));
+ @else@
+ uint64_t val;
+ snmp_set_var_typed_value(requests->requestvb, $i.type,
+ &val,
+ sizeof(val));
+ @end@
+ }
@else@
@@ -417,7 +436,7 @@ struct ${i}_entry {
@endperl@
- @if $field_dim > 0@
+ @if $field_dim > 0@
$c.decl ${c}[$field_dim];
- @else@
+ @else@
$c.decl *$c;
- @end@
+ @end@
size_t ${c}_len;
@@ -569,3 +588,2 @@ $varnish_endif
snmp_log(LOG_ERR,"can't register config handler\n");
-
if (!register_config_handler("snmpd", "varnishBackendTableTimeout",
@@ -575,3 +593,2 @@ $varnish_endif
snmp_log(LOG_ERR,"can't register config handler\n");
-
if (!register_config_handler("snmpd", "varnishCLIPortTimeout",

Return to:

Send suggestions and report system problems to the System administrator.