From: Jérôme Renard Date: Sun, 6 Jun 2010 07:10:12 +0000 (+0200) Subject: Varnish plugin: Added SMS monitor X-Git-Tag: collectd-5.0.0-beta0~103^2~20 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=4dcc843a2370a6c6268249aae7185c78925c71f7;p=collectd.git Varnish plugin: Added SMS monitor --- diff --git a/src/collectd.conf.in b/src/collectd.conf.in index 2e31ea35..80643e58 100644 --- a/src/collectd.conf.in +++ b/src/collectd.conf.in @@ -905,6 +905,15 @@ # - SMA bytes allocated # - SMA bytes free # MonitorSMA yes +# +# Will monitor: +# - SMS allocator requests +# - SMS outstanding allocations +# - SMS outstanding bytes +# - SMS bytes allocated +# - SMS bytes freed +# MonitorSMS yes +# # # diff --git a/src/types.db b/src/types.db index 3444e45a..6bdb7744 100644 --- a/src/types.db +++ b/src/types.db @@ -168,6 +168,7 @@ varnish_fetch value:GAUGE:0:U varnish_hcb value:GAUGE:0:U varnish_shm value:GAUGE:0:U varnish_sma value:GAUGE:0:U +varnish_sms 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 88fd58d0..80c6d371 100644 --- a/src/varnish.c +++ b/src/varnish.c @@ -101,11 +101,11 @@ * 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 - * sms_balloc SMS bytes allocated N - * sms_bfree SMS bytes freed N + * sms_nreq SMS allocator requests Y + * sms_nobj SMS outstanding allocations Y + * sms_nbytes SMS outstanding bytes Y + * sms_balloc SMS bytes allocated Y + * sms_bfree SMS bytes freed Y * backend_req Backend requests made N * n_vcl N vcl total N * n_vcl_avail N vcl available N @@ -128,7 +128,7 @@ #include -#define USER_CONFIG_INIT {0, 0, 0, 0, 0, 0, 0, 0} +#define USER_CONFIG_INIT {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 */ @@ -141,6 +141,7 @@ struct user_config_s { int monitor_hcb; int monitor_shm; int monitor_sma; + int monitor_sms; }; typedef struct user_config_s user_config_t; /* }}} */ @@ -157,7 +158,8 @@ static const char *config_keys[] = "MonitorFetch", "MonitorHCB", "MonitorSHM", - "MonitorSMA" + "MonitorSMA", + "MonitorSMS" }; static int config_keys_num = STATIC_ARRAY_SIZE (config_keys); /* }}} */ @@ -172,6 +174,7 @@ static int varnish_config(const char *key, const char *value) /* {{{ */ SET_MONITOR_FLAG("MonitorHCB" , monitor_hcb , value); SET_MONITOR_FLAG("MonitorSHM" , monitor_shm , value); SET_MONITOR_FLAG("MonitorSMA" , monitor_sma , value); + SET_MONITOR_FLAG("MonitorSMS" , monitor_sms , value); return (0); } /* }}} */ @@ -264,6 +267,15 @@ static void varnish_monitor(struct varnish_stats *VSL_stats) /* {{{ */ 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 */ } + + if(user_config.monitor_sms == 1) + { + varnish_submit("varnish_sms", "sms_nreq" , VSL_stats->sms_nreq); /* SMS allocator requests */ + varnish_submit("varnish_sms", "sms_nobj" , VSL_stats->sms_nobj); /* SMS outstanding allocations */ + varnish_submit("varnish_sms", "sms_nbytes", VSL_stats->sms_nbytes); /* SMS outstanding bytes */ + 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 */ + } } /* }}} */ static int varnish_read(void) /* {{{ */