From: Jérôme Renard Date: Sun, 6 Jun 2010 06:50:33 +0000 (+0200) Subject: Varnish plugin: Added SMA monitor X-Git-Tag: collectd-5.0.0-beta0~103^2~22 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=7665e23080bb08021efff821ed160c4360ed2cca;p=collectd.git Varnish plugin: Added SMA monitor --- diff --git a/src/collectd.conf.in b/src/collectd.conf.in index b8d8b8d7..2e31ea35 100644 --- a/src/collectd.conf.in +++ b/src/collectd.conf.in @@ -897,6 +897,14 @@ # - SHM MTX contention # - SHM cycles through buffer # MonitorSHM yes +# +# Will monitor: +# - SMA allocator requests +# - SMA outstanding allocations +# - SMA outstanding bytes +# - SMA bytes allocated +# - SMA bytes free +# MonitorSMA yes # # diff --git a/src/types.db b/src/types.db index 7df495c5..3444e45a 100644 --- a/src/types.db +++ b/src/types.db @@ -167,6 +167,7 @@ varnish_backend_connections value:GAUGE:0:U varnish_fetch value:GAUGE:0:U varnish_hcb value:GAUGE:0:U varnish_shm value:GAUGE:0:U +varnish_sma value:GAUGE:0:U virt_cpu_total ns:COUNTER:0:256000000000 virt_vcpu ns:COUNTER:0:1000000000 vmpage_action value:COUNTER:0:4294967295 diff --git a/src/varnish.c b/src/varnish.c index 55afe295..d298ab8a 100644 --- a/src/varnish.c +++ b/src/varnish.c @@ -96,11 +96,11 @@ * sm_nobj outstanding allocations N * sm_balloc bytes allocated N * sm_bfree bytes free N - * sma_nreq SMA allocator requests N - * sma_nobj SMA outstanding allocations N - * sma_nbytes SMA outstanding bytes N - * sma_balloc SMA bytes allocated N - * sma_bfree SMA bytes free N + * sma_nreq SMA allocator requests Y + * sma_nobj SMA outstanding allocations Y + * sma_nbytes SMA outstanding bytes Y + * sma_balloc SMA bytes allocated Y + * sma_bfree SMA bytes free Y * sms_nreq SMS allocator requests N * sms_nobj SMS outstanding allocations N * sms_nbytes SMS outstanding bytes N @@ -140,6 +140,7 @@ struct user_config_s { int monitor_fetch; int monitor_hcb; int monitor_shm; + int monitor_sma; }; typedef struct user_config_s user_config_t; /* }}} */ @@ -155,7 +156,8 @@ static const char *config_keys[] = "MonitorBackend", "MonitorFetch", "MonitorHCB", - "MonitorSHM" + "MonitorSHM", + "MonitorSMA" }; static int config_keys_num = STATIC_ARRAY_SIZE (config_keys); /* }}} */ @@ -169,6 +171,7 @@ static int varnish_config(const char *key, const char *value) /* {{{ */ SET_MONITOR_FLAG("MonitorFetch" , monitor_fetch , value); SET_MONITOR_FLAG("MonitorHCB" , monitor_hcb , value); SET_MONITOR_FLAG("MonitorSHM" , monitor_shm , value); + SET_MONITOR_FLAG("MonitorSMA" , monitor_sma , value); return (0); } /* }}} */ @@ -252,6 +255,15 @@ static void varnish_monitor(struct varnish_stats *VSL_stats) /* {{{ */ varnish_submit("varnish_shm", "shm_contention", VSL_stats->shm_cont); /* SHM MTX contention */ varnish_submit("varnish_shm", "shm_cycles" , VSL_stats->shm_cycles); /* SHM cycles through buffer */ } + + if(user_config.monitor_sma == 1) + { + varnish_submit("varnish_sma", "sma_req" , VSL_stats->sma_nreq); /* SMA allocator requests */ + varnish_submit("varnish_sma", "sma_nobj" , VSL_stats->sma_nobj); /* SMA outstanding allocations */ + varnish_submit("varnish_sma", "sma_nbytes", VSL_stats->sma_nbytes); /* SMA outstanding bytes */ + varnish_submit("varnish_sma", "sma_balloc", VSL_stats->sma_balloc); /* SMA bytes allocated */ + varnish_submit("varnish_sma", "sma_bfree" , VSL_stats->sma_bfree); /* SMA bytes free */ + } } /* }}} */ static int varnish_read(void) /* {{{ */