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/vserver.php | 122 ----------------------------------------------------- 1 file changed, 122 deletions(-) delete mode 100644 plugin/vserver.php (limited to 'plugin/vserver.php') diff --git a/plugin/vserver.php b/plugin/vserver.php deleted file mode 100644 index 80fad3e..0000000 --- a/plugin/vserver.php +++ /dev/null @@ -1,122 +0,0 @@ -args['type']) { - case 'load': - require_once "plugin/load.php"; - break; - case 'vs_memory': - $obj = new Type_GenericStacked($CONFIG, $_GET); - $obj->order = array('vm', 'vml', 'rss', 'anon'); - # http://oldwiki.linux-vserver.org/Memory+Allocation - $obj->legend = array( - 'vm' => "Virtual memory pages", - 'vml' => "Pages locked into memory", - 'rss' => "Resident set size", - 'anon' => "Anonymous memory pages", - ); - $obj->colors = array( - 'vm' => '00e000', - 'vml' => '0000ff', - 'rss' => 'ffb000', - 'anon' => 'ff00ff', - ); - - $obj->rrd_title = sprintf('Memory utilization on Vserver %s', $obj->args['pinstance']); - $obj->rrd_vertical = 'Bytes'; - $obj->rrd_format = '%5.1lf%s'; - - $obj->rrd_graph(); - break; - case 'vs_threads': - $obj = new Type_GenericStacked($CONFIG, $_GET); - $obj->order = array('running', 'uninterruptable', 'onhold', 'total'); - # http://linux-vserver.org/ProcFS - $obj->legend = array( - 'onhold' => "Number of threads on hold", - 'running' => "Number of running threads", - 'total' => "Total number of threads", - 'uninterruptable' => "Number of uninterruptible threads", - ); - $obj->colors = array( - 'onhold' => '00e000', - 'running' => '0000ff', - 'total' => 'ffb000', - 'uninterruptable' => 'ff00ff', - ); - - $obj->rrd_title = sprintf('Threads on Vserver %s', $obj->args['pinstance']); - $obj->rrd_vertical = 'Numbers'; - $obj->rrd_format = '%5.1lf%s'; - - $obj->rrd_graph(); - break; - case 'if_octets': - $obj->data_sources = array('rx', 'tx'); - $obj->legend = array( - 'inet-rx' => 'IPv4 Receive', - 'inet-tx' => 'IPv4 Transmit', - 'inet6-rx' => 'IPv6 Receive', - 'inet6-tx' => 'IPv6 Transmit', - ); - $obj->colors = array( - 'inet-rx' => '0000ff', - 'inet-tx' => '00b000', - 'inet6-rx' => 'e0e0e0', - 'inet6-tx' => 'ffb000', - 'other-rx' => 'ff00ff', - 'other-tx' => 'a000a0', - 'unix-rx' => '00e000', - 'unix-tx' => '0080ff', - 'unspec-rx' => 'ff0000', - 'unspec-tx' => '000080', - ); - $obj->rrd_title = sprintf('Traffic on Vserver %s', $obj->args['pinstance']); - $obj->rrd_vertical = sprintf('%s per second', ucfirst($CONFIG['network_datasize'])); - $obj->scale = $CONFIG['network_datasize'] == 'bits' ? 8 : 1; - $obj->rrd_format = '%5.1lf%s'; - - $obj->rrd_graph(); - break; - case 'vs_processes': - $obj->data_sources = array('value'); - $obj->legend = array( - 'value' => 'Processes', - ); - $obj->rrd_title = sprintf('Processes on Vserver %s', $obj->args['pinstance']); - $obj->rrd_vertical = 'Processes'; - - $obj->rrd_format = '%5.1lf%s'; - - $obj->rrd_graph(); - break; - - default: - die('Not implemented yet.'); - break; -} -- cgit v1.1