From 0a547add2f4cc264380d2dab2c472efe5a1d7094 Mon Sep 17 00:00:00 2001 From: Pim van den Berg Date: Sat, 3 May 2014 19:17:16 +0200 Subject: graph.php: use JSON plugins instead of including PHP plugin files A couple of big changes here. A lot of logic moved to graph.php. The PHP plugin files have been rewritten to JSON. In these JSON files *everything* is optional. Also *NOT* having a JSON plugin file won't block you from having a graph. The JSON will just make the graphs prettier (by having a title, y-axis title, legend, colors, etc..). The Collectd types.db file is parsed and used to determine RRD content. When things are not defined in the JSON it will fallback to a default. --- plugin/memcached.php | 179 --------------------------------------------------- 1 file changed, 179 deletions(-) delete mode 100644 plugin/memcached.php (limited to 'plugin/memcached.php') diff --git a/plugin/memcached.php b/plugin/memcached.php deleted file mode 100644 index 62eebfd..0000000 --- a/plugin/memcached.php +++ /dev/null @@ -1,179 +0,0 @@ -data_sources = array('used', 'free'); - $obj->order = array('used', 'free'); - $obj->legend = array( - 'used' => 'Used', - 'free' => 'Free', - ); - $obj->colors = array( - 'used' => '00e000', - 'free' => '0000ff', - ); - $obj->rrd_title = 'Memcached Memory Usage'; - $obj->rrd_vertical = 'bytes'; - break; - -# memcached_command-(flush|get|set).rrd - case 'memcached_command': - require_once 'type/GenericStacked.class.php'; - $obj = new Type_GenericStacked($CONFIG, $_GET); - $obj->order = array('flush', 'get', 'set'); - $obj->legend = array( - 'flush' => 'Flush', - 'get' => 'Get', - 'set' => 'Set', - ); - $obj->colors = array( - 'flush' => '00e000', - 'get' => '0000ff', - 'set' => 'ffb000', - ); - $obj->rrd_title = 'Memcached Commands'; - $obj->rrd_vertical = 'Commands'; - break; - -# memcached_connections-current.rrd - case 'memcached_connections': - require_once 'type/Default.class.php'; - $obj = new Type_Default($CONFIG, $_GET); - $obj->data_sources = array('value'); - $obj->legend = array( - 'value' => 'Connections', - ); - $obj->colors = array( - 'percent' => '00b000', - ); - $obj->rrd_title = 'Memcached Number of Connections'; - $obj->rrd_vertical = 'Connections'; - break; - -# memcached_items-current.rrd - case 'memcached_items': - require_once 'type/Default.class.php'; - $obj = new Type_Default($CONFIG, $_GET); - $obj->data_sources = array('value'); - $obj->legend = array( - 'value ' => 'Items', - ); - $obj->colors = array( - 'value' => '00b000', - ); - $obj->rrd_title = 'Number of Items in Memcached'; - $obj->rrd_vertical = 'Items'; - break; - -# memcached_octets.rrd - case 'memcached_octets': - require_once 'type/Default.class.php'; - $obj = new Type_Default($CONFIG, $_GET); - $obj->data_sources = array('rx', 'tx'); - $obj->order = array('rx', 'tx'); - $obj->legend = array( - 'rx' => 'Receive', - 'tx' => 'Transmit', - ); - $obj->colors = array( - 'rx' => '0000ff', - 'tx' => '00b000', - ); - $obj->rrd_title = 'Memcached Network Traffic'; - $obj->rrd_vertical = ucfirst($CONFIG['network_datasize']); - $obj->scale = $CONFIG['network_datasize'] == 'bits' ? 8 : 1; - break; -# memcached_ops-(evictions|hits|misses).rrd - case 'memcached_ops': - require_once 'type/GenericStacked.class.php'; - $obj = new Type_GenericStacked($CONFIG, $_GET); - $obj->order = array('evictions', 'hits', 'misses'); - $obj->legend = array( - 'evictions' => 'Evictions', - 'hits' => 'Hits', - 'misses' => 'Misses', - ); - $obj->colors = array( - 'evictions' => '00e000', - 'hits' => '0000ff', - 'misses' => 'ffb000', - ); - $obj->rrd_title = 'Memcached Operations'; - $obj->rrd_vertical = 'Commands'; - break; - -# percent-hitratio.rrd - case 'percent': - require_once 'type/Default.class.php'; - $obj = new Type_Default($CONFIG, $_GET); - $obj->data_sources = array('percent'); - $obj->legend = array( - 'percent ' => 'Percentage', - ); - $obj->colors = array( - 'percent' => '00e000', - ); - $obj->rrd_title = 'Memcached Hits/Gets Ratio'; - $obj->rrd_vertical = 'Percent'; - break; -# ps_count.rrd - case 'ps_count': - require_once 'type/Default.class.php'; - $obj = new Type_Default($CONFIG, $_GET); - $obj->data_sources = array('threads'); - $obj->order = array('threads'); - $obj->legend = array( - 'threads' => 'Threads', - ); - $obj->colors = array( - 'threads' => '00b000', - ); - $obj->rrd_title = 'Memcached number of Threads'; - $obj->rrd_vertical = 'Threads'; - break; - -# ps_cputime.rrd - case 'ps_cputime': - require_once 'type/Default.class.php'; - $obj = new Type_Default($CONFIG, $_GET); - $obj->data_sources = array('user', 'syst'); - $obj->order = array('user', 'syst'); - $obj->legend = array( - 'user' => 'User', - 'syst' => 'System', - ); - $obj->colors = array( - 'user' => '00e000', - 'syst' => '0000ff', - ); - $obj->rrd_title = 'CPU Time consumed by the memcached process'; - $obj->rrd_vertical = 'Time'; - break; -} - -$obj->rrd_format = '%5.1lf%s'; - -$obj->rrd_graph(); -- cgit v1.1