From: Jérôme Renard Date: Fri, 4 Jun 2010 16:59:05 +0000 (+0200) Subject: Varnish plugin: Added SHM monitoring X-Git-Tag: collectd-5.0.0-beta0~103^2~25 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;ds=sidebyside;h=bff8e494d5683f066450c2b3f515a94f7eebb298;p=collectd.git Varnish plugin: Added SHM monitoring --- diff --git a/src/collectd.conf.in b/src/collectd.conf.in index 2ca0561f..b04eb28c 100644 --- a/src/collectd.conf.in +++ b/src/collectd.conf.in @@ -850,6 +850,7 @@ # MonitorBackend yes # MonitorFetch yes # MonitorHCB yes +# MonitorSHM yes # # diff --git a/src/types.db b/src/types.db index 10a7ff2d..7df495c5 100644 --- a/src/types.db +++ b/src/types.db @@ -166,6 +166,7 @@ varnish_esi value:GAUGE:0:U 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 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 ea510e17..f4b36bf9 100644 --- a/src/varnish.c +++ b/src/varnish.c @@ -87,11 +87,11 @@ * sess_readahead Session Read Ahead N * sess_linger Session Linger N * sess_herd Session herd N - * shm_records SHM records N - * shm_writes SHM writes N - * shm_flushes SHM flushes due to overflow N - * shm_cont SHM MTX contention N - * shm_cycles SHM cycles through buffer N + * shm_records SHM records Y + * shm_writes SHM writes Y + * shm_flushes SHM flushes due to overflow Y + * shm_cont SHM MTX contention Y + * shm_cycles SHM cycles through buffer Y * sm_nreq allocator requests N * sm_nobj outstanding allocations N * sm_balloc bytes allocated N @@ -128,7 +128,7 @@ #include -#define USER_CONFIG_INIT {0, 0, 0, 0, 0,0} +#define USER_CONFIG_INIT {0, 0, 0, 0, 0, 0, 0} #define SET_MONITOR_FLAG(name, flag, value) if((strcasecmp(name, key) == 0) && IS_TRUE(value)) user_config.flag = 1 /* {{{ user_config_s */ @@ -139,6 +139,7 @@ struct user_config_s { int monitor_backend; int monitor_fetch; int monitor_hcb; + int monitor_shm; }; typedef struct user_config_s user_config_t; /* }}} */ @@ -153,7 +154,8 @@ static const char *config_keys[] = "MonitorESI", "MonitorBackend", "MonitorFetch", - "MonitorHCB" + "MonitorHCB", + "MonitorSHM" }; static int config_keys_num = STATIC_ARRAY_SIZE (config_keys); /* }}} */ @@ -166,6 +168,7 @@ static int varnish_config(const char *key, const char *value) /* {{{ */ SET_MONITOR_FLAG("MonitorBackend", monitor_backend, value); SET_MONITOR_FLAG("MonitorFetch", monitor_fetch, value); SET_MONITOR_FLAG("MonitorHCB", monitor_hcb, value); + SET_MONITOR_FLAG("MonitorSHM", monitor_shm, value); return (0); } /* }}} */ @@ -240,6 +243,15 @@ static void varnish_monitor(struct varnish_stats *VSL_stats) /* {{{ */ varnish_submit("varnish_hcb", "hcb_lock" , VSL_stats->hcb_lock); /* HCB Lookups with lock */ varnish_submit("varnish_hcb", "hcb_insert", VSL_stats->hcb_insert); /* HCB Inserts */ } + + if(user_config.monitor_shm == 1) + { + varnish_submit("varnish_shm", "shm_records" , VSL_stats->shm_records); /* SHM records */ + varnish_submit("varnish_shm", "shm_writes" , VSL_stats->shm_writes); /* SHM writes */ + varnish_submit("varnish_shm", "shm_flushes" , VSL_stats->shm_flushes); /* SHM flushes due to overflow */ + 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 */ + } } /* }}} */ static int varnish_read(void) /* {{{ */