Varnish plugin: Added SMA monitor
authorJérôme Renard <jerome.renard@gmail.com>
Sun, 6 Jun 2010 06:50:33 +0000 (08:50 +0200)
committerFlorian Forster <octo@leeloo.lan.home.verplant.org>
Mon, 7 Jun 2010 12:40:47 +0000 (14:40 +0200)
src/collectd.conf.in
src/types.db
src/varnish.c

index b8d8b8d..2e31ea3 100644 (file)
 #  - 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
 #</Plugin>
 
 #<Plugin vmem>
index 7df495c..3444e45 100644 (file)
@@ -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
index 55afe29..d298ab8 100644 (file)
  * 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) /* {{{ */