From: Jérôme Renard Date: Sun, 6 Jun 2010 07:23:25 +0000 (+0200) Subject: Varnish plugin: Added SM Monitor X-Git-Tag: collectd-5.0.0-beta0~103^2~19 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e73f418e3fcbbe94f95a688094fdb4fde4db33f0;p=collectd.git Varnish plugin: Added SM Monitor --- diff --git a/src/collectd.conf.in b/src/collectd.conf.in index 80643e58..8cb3fceb 100644 --- a/src/collectd.conf.in +++ b/src/collectd.conf.in @@ -914,6 +914,13 @@ # - SMS bytes freed # MonitorSMS yes # +# Will monitor: +# - allocator requests +# - outstanding allocations +# - bytes allocated +# - bytes free +# MonitorSM yes +# # # diff --git a/src/types.db b/src/types.db index 6bdb7744..2fe5f4ff 100644 --- a/src/types.db +++ b/src/types.db @@ -169,6 +169,7 @@ varnish_hcb value:GAUGE:0:U varnish_shm value:GAUGE:0:U varnish_sma value:GAUGE:0:U varnish_sms value:GAUGE:0:U +varnish_sm 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 80c6d371..1d07945e 100644 --- a/src/varnish.c +++ b/src/varnish.c @@ -92,10 +92,10 @@ * 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 - * sm_bfree bytes free N + * sm_nreq allocator requests Y + * sm_nobj outstanding allocations Y + * sm_balloc bytes allocated Y + * sm_bfree bytes free Y * sma_nreq SMA allocator requests Y * sma_nobj SMA outstanding allocations Y * sma_nbytes SMA outstanding bytes Y @@ -128,7 +128,7 @@ #include -#define USER_CONFIG_INIT {0, 0, 0, 0, 0, 0, 0, 0, 0} +#define USER_CONFIG_INIT {0, 0, 0, 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 */ @@ -142,6 +142,7 @@ struct user_config_s { int monitor_shm; int monitor_sma; int monitor_sms; + int monitor_sm; }; typedef struct user_config_s user_config_t; /* }}} */ @@ -159,7 +160,8 @@ static const char *config_keys[] = "MonitorHCB", "MonitorSHM", "MonitorSMA", - "MonitorSMS" + "MonitorSMS", + "MonitorSM" }; static int config_keys_num = STATIC_ARRAY_SIZE (config_keys); /* }}} */ @@ -175,6 +177,7 @@ static int varnish_config(const char *key, const char *value) /* {{{ */ SET_MONITOR_FLAG("MonitorSHM" , monitor_shm , value); SET_MONITOR_FLAG("MonitorSMA" , monitor_sma , value); SET_MONITOR_FLAG("MonitorSMS" , monitor_sms , value); + SET_MONITOR_FLAG("MonitorSM" , monitor_sm , value); return (0); } /* }}} */ @@ -276,6 +279,14 @@ static void varnish_monitor(struct varnish_stats *VSL_stats) /* {{{ */ varnish_submit("varnish_sms", "sms_balloc", VSL_stats->sms_balloc); /* SMS bytes allocated */ varnish_submit("varnish_sms", "sms_bfree" , VSL_stats->sms_bfree); /* SMS bytes freed */ } + + if(user_config.monitor_sm == 1) + { + varnish_submit("varnish_sm", "sm_nreq" , VSL_stats->sm_nreq); /* allocator requests */ + varnish_submit("varnish_sm", "sm_nobj" , VSL_stats->sm_nobj); /* outstanding allocations */ + varnish_submit("varnish_sm", "sm_balloc", VSL_stats->sm_balloc); /* bytes allocated */ + varnish_submit("varnish_sm", "sm_bfree" , VSL_stats->sm_bfree); /* bytes free */ + } } /* }}} */ static int varnish_read(void) /* {{{ */