From b54a87d8daef08d8960cd247d34bb8a4cdf92cef Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Renard?= Date: Fri, 4 Jun 2010 18:38:31 +0200 Subject: [PATCH] Varnish plugin: Added HCB monitoring --- src/collectd.conf.in | 1 + src/types.db | 1 + src/varnish.c | 14 ++++++++++++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/collectd.conf.in b/src/collectd.conf.in index efa2af4c..2ca0561f 100644 --- a/src/collectd.conf.in +++ b/src/collectd.conf.in @@ -849,6 +849,7 @@ # MonitorESI yes # MonitorBackend yes # MonitorFetch yes +# MonitorHCB yes # # diff --git a/src/types.db b/src/types.db index 375ac7ce..10a7ff2d 100644 --- a/src/types.db +++ b/src/types.db @@ -165,6 +165,7 @@ varnish_connections value:GAUGE:0:U 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 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 14e18f12..5fa36c9b 100644 --- a/src/varnish.c +++ b/src/varnish.c @@ -25,7 +25,7 @@ #include -#define USER_CONFIG_INIT {0, 0, 0, 0, 0} +#define USER_CONFIG_INIT {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 */ @@ -35,6 +35,7 @@ struct user_config_s { int monitor_esi; int monitor_backend; int monitor_fetch; + int monitor_hcb; }; typedef struct user_config_s user_config_t; /* }}} */ @@ -48,7 +49,8 @@ static const char *config_keys[] = "MonitorConnections", "MonitorESI", "MonitorBackend", - "MonitorFetch" + "MonitorFetch", + "MonitorHCB" }; static int config_keys_num = STATIC_ARRAY_SIZE (config_keys); /* }}} */ @@ -60,6 +62,7 @@ static int varnish_config(const char *key, const char *value) /* {{{ */ SET_MONITOR_FLAG("MonitorESI", monitor_esi, value); SET_MONITOR_FLAG("MonitorBackend", monitor_backend, value); SET_MONITOR_FLAG("MonitorFetch", monitor_fetch, value); + SET_MONITOR_FLAG("MonitorHCB", monitor_hcb, value); return (0); } /* }}} */ @@ -127,6 +130,13 @@ static void varnish_monitor(struct varnish_stats *VSL_stats) /* {{{ */ varnish_submit("varnish_fetch", "fetch_zero" , VSL_stats->fetch_zero); /* Fetch zero len */ varnish_submit("varnish_fetch", "fetch_failed" , VSL_stats->fetch_failed); /* Fetch failed */ } + + if(user_config.monitor_hcb == 1) + { + varnish_submit("varnish_hcb", "hcb_nolock", VSL_stats->hcb_nolock); /* HCB Lookups without lock */ + 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 */ + } } /* }}} */ static int varnish_read(void) /* {{{ */ -- 2.11.0