diff options
| author | Pim van den Berg | 2014-05-03 19:17:16 +0200 |
|---|---|---|
| committer | Pim van den Berg | 2014-05-12 21:32:24 +0200 |
| commit | 0a547add2f4cc264380d2dab2c472efe5a1d7094 (patch) | |
| tree | 55bb43a3e31c5814848d61eea92c8438e4a37886 /plugin/memcached.php | |
| parent | type/base: set default title to "Plugin Type (PluginInstance) (Category)" (diff) | |
| download | apt-panopticon_cgp-0a547add2f4cc264380d2dab2c472efe5a1d7094.zip apt-panopticon_cgp-0a547add2f4cc264380d2dab2c472efe5a1d7094.tar.gz apt-panopticon_cgp-0a547add2f4cc264380d2dab2c472efe5a1d7094.tar.bz2 apt-panopticon_cgp-0a547add2f4cc264380d2dab2c472efe5a1d7094.tar.xz | |
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.
Diffstat (limited to '')
| -rw-r--r-- | plugin/memcached.php | 179 |
1 files changed, 0 insertions, 179 deletions
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 @@ | |||
| 1 | <?php | ||
| 2 | |||
| 3 | # Collectd Memcached plugin | ||
| 4 | |||
| 5 | # Details on http://github.com/octo/collectd/blob/master/src/memcached.c | ||
| 6 | |||
| 7 | |||
| 8 | |||
| 9 | require_once 'conf/common.inc.php'; | ||
| 10 | |||
| 11 | ## LAYOUT | ||
| 12 | # df-cache.rrd | ||
| 13 | # memcached_command-(flush|get|set).rrd | ||
| 14 | # memcached_connections-current.rrd | ||
| 15 | # memcached_items-current.rrd | ||
| 16 | # memcached_octets.rrd | ||
| 17 | # memcached_ops-(evictions|hits|misses).rrd | ||
| 18 | # percent-hitratio.rrd | ||
| 19 | # ps_count.rrd | ||
| 20 | # ps_cputime.rrd | ||
| 21 | |||
| 22 | |||
| 23 | switch(GET('t')) { | ||
| 24 | # df-cache.rrd | ||
| 25 | case 'df': | ||
| 26 | require_once 'type/Default.class.php'; | ||
| 27 | $obj = new Type_Default($CONFIG, $_GET); | ||
| 28 | $obj->data_sources = array('used', 'free'); | ||
| 29 | $obj->order = array('used', 'free'); | ||
| 30 | $obj->legend = array( | ||
| 31 | 'used' => 'Used', | ||
| 32 | 'free' => 'Free', | ||
| 33 | ); | ||
| 34 | $obj->colors = array( | ||
| 35 | 'used' => '00e000', | ||
| 36 | 'free' => '0000ff', | ||
| 37 | ); | ||
| 38 | $obj->rrd_title = 'Memcached Memory Usage'; | ||
| 39 | $obj->rrd_vertical = 'bytes'; | ||
| 40 | break; | ||
| 41 | |||
| 42 | # memcached_command-(flush|get|set).rrd | ||
| 43 | case 'memcached_command': | ||
| 44 | require_once 'type/GenericStacked.class.php'; | ||
| 45 | $obj = new Type_GenericStacked($CONFIG, $_GET); | ||
| 46 | $obj->order = array('flush', 'get', 'set'); | ||
| 47 | $obj->legend = array( | ||
| 48 | 'flush' => 'Flush', | ||
| 49 | 'get' => 'Get', | ||
| 50 | 'set' => 'Set', | ||
| 51 | ); | ||
| 52 | $obj->colors = array( | ||
| 53 | 'flush' => '00e000', | ||
| 54 | 'get' => '0000ff', | ||
| 55 | 'set' => 'ffb000', | ||
| 56 | ); | ||
| 57 | $obj->rrd_title = 'Memcached Commands'; | ||
| 58 | $obj->rrd_vertical = 'Commands'; | ||
| 59 | break; | ||
| 60 | |||
| 61 | # memcached_connections-current.rrd | ||
| 62 | case 'memcached_connections': | ||
| 63 | require_once 'type/Default.class.php'; | ||
| 64 | $obj = new Type_Default($CONFIG, $_GET); | ||
| 65 | $obj->data_sources = array('value'); | ||
| 66 | $obj->legend = array( | ||
| 67 | 'value' => 'Connections', | ||
| 68 | ); | ||
| 69 | $obj->colors = array( | ||
| 70 | 'percent' => '00b000', | ||
| 71 | ); | ||
| 72 | $obj->rrd_title = 'Memcached Number of Connections'; | ||
| 73 | $obj->rrd_vertical = 'Connections'; | ||
| 74 | break; | ||
| 75 | |||
| 76 | # memcached_items-current.rrd | ||
| 77 | case 'memcached_items': | ||
| 78 | require_once 'type/Default.class.php'; | ||
| 79 | $obj = new Type_Default($CONFIG, $_GET); | ||
| 80 | $obj->data_sources = array('value'); | ||
| 81 | $obj->legend = array( | ||
| 82 | 'value ' => 'Items', | ||
| 83 | ); | ||
| 84 | $obj->colors = array( | ||
| 85 | 'value' => '00b000', | ||
| 86 | ); | ||
| 87 | $obj->rrd_title = 'Number of Items in Memcached'; | ||
| 88 | $obj->rrd_vertical = 'Items'; | ||
| 89 | break; | ||
| 90 | |||
| 91 | # memcached_octets.rrd | ||
| 92 | case 'memcached_octets': | ||
| 93 | require_once 'type/Default.class.php'; | ||
| 94 | $obj = new Type_Default($CONFIG, $_GET); | ||
| 95 | $obj->data_sources = array('rx', 'tx'); | ||
| 96 | $obj->order = array('rx', 'tx'); | ||
| 97 | $obj->legend = array( | ||
| 98 | 'rx' => 'Receive', | ||
| 99 | 'tx' => 'Transmit', | ||
| 100 | ); | ||
| 101 | $obj->colors = array( | ||
| 102 | 'rx' => '0000ff', | ||
| 103 | 'tx' => '00b000', | ||
| 104 | ); | ||
| 105 | $obj->rrd_title = 'Memcached Network Traffic'; | ||
| 106 | $obj->rrd_vertical = ucfirst($CONFIG['network_datasize']); | ||
| 107 | $obj->scale = $CONFIG['network_datasize'] == 'bits' ? 8 : 1; | ||
| 108 | break; | ||
| 109 | # memcached_ops-(evictions|hits|misses).rrd | ||
| 110 | case 'memcached_ops': | ||
| 111 | require_once 'type/GenericStacked.class.php'; | ||
| 112 | $obj = new Type_GenericStacked($CONFIG, $_GET); | ||
| 113 | $obj->order = array('evictions', 'hits', 'misses'); | ||
| 114 | $obj->legend = array( | ||
| 115 | 'evictions' => 'Evictions', | ||
| 116 | 'hits' => 'Hits', | ||
| 117 | 'misses' => 'Misses', | ||
| 118 | ); | ||
| 119 | $obj->colors = array( | ||
| 120 | 'evictions' => '00e000', | ||
| 121 | 'hits' => '0000ff', | ||
| 122 | 'misses' => 'ffb000', | ||
| 123 | ); | ||
| 124 | $obj->rrd_title = 'Memcached Operations'; | ||
| 125 | $obj->rrd_vertical = 'Commands'; | ||
| 126 | break; | ||
| 127 | |||
| 128 | # percent-hitratio.rrd | ||
| 129 | case 'percent': | ||
| 130 | require_once 'type/Default.class.php'; | ||
| 131 | $obj = new Type_Default($CONFIG, $_GET); | ||
| 132 | $obj->data_sources = array('percent'); | ||
| 133 | $obj->legend = array( | ||
| 134 | 'percent ' => 'Percentage', | ||
| 135 | ); | ||
| 136 | $obj->colors = array( | ||
| 137 | 'percent' => '00e000', | ||
| 138 | ); | ||
| 139 | $obj->rrd_title = 'Memcached Hits/Gets Ratio'; | ||
| 140 | $obj->rrd_vertical = 'Percent'; | ||
| 141 | break; | ||
| 142 | # ps_count.rrd | ||
| 143 | case 'ps_count': | ||
| 144 | require_once 'type/Default.class.php'; | ||
| 145 | $obj = new Type_Default($CONFIG, $_GET); | ||
| 146 | $obj->data_sources = array('threads'); | ||
| 147 | $obj->order = array('threads'); | ||
| 148 | $obj->legend = array( | ||
| 149 | 'threads' => 'Threads', | ||
| 150 | ); | ||
| 151 | $obj->colors = array( | ||
| 152 | 'threads' => '00b000', | ||
| 153 | ); | ||
| 154 | $obj->rrd_title = 'Memcached number of Threads'; | ||
| 155 | $obj->rrd_vertical = 'Threads'; | ||
| 156 | break; | ||
| 157 | |||
| 158 | # ps_cputime.rrd | ||
| 159 | case 'ps_cputime': | ||
| 160 | require_once 'type/Default.class.php'; | ||
| 161 | $obj = new Type_Default($CONFIG, $_GET); | ||
| 162 | $obj->data_sources = array('user', 'syst'); | ||
| 163 | $obj->order = array('user', 'syst'); | ||
| 164 | $obj->legend = array( | ||
| 165 | 'user' => 'User', | ||
| 166 | 'syst' => 'System', | ||
| 167 | ); | ||
| 168 | $obj->colors = array( | ||
| 169 | 'user' => '00e000', | ||
| 170 | 'syst' => '0000ff', | ||
| 171 | ); | ||
| 172 | $obj->rrd_title = 'CPU Time consumed by the memcached process'; | ||
| 173 | $obj->rrd_vertical = 'Time'; | ||
| 174 | break; | ||
| 175 | } | ||
| 176 | |||
| 177 | $obj->rrd_format = '%5.1lf%s'; | ||
| 178 | |||
| 179 | $obj->rrd_graph(); | ||
