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/interface.php | 48 ------------------------------------------------ 1 file changed, 48 deletions(-) delete mode 100644 plugin/interface.php (limited to 'plugin/interface.php') diff --git a/plugin/interface.php b/plugin/interface.php deleted file mode 100644 index 5728c07..0000000 --- a/plugin/interface.php +++ /dev/null @@ -1,48 +0,0 @@ -data_sources = array('rx', 'tx'); -$obj->legend = array( - 'rx' => 'Receive', - 'tx' => 'Transmit', -); -$obj->colors = array( - 'rx' => '0000ff', - 'tx' => '00b000', -); -$obj->rrd_format = '%5.1lf%s'; - -$instance = $CONFIG['version'] < 5 ? 'tinstance' : 'pinstance'; -switch($obj->args['type']) { - case 'if_errors': - $obj->rrd_title = sprintf('Interface Errors (%s)', $obj->args[$instance]); - $obj->rrd_vertical = 'Errors per second'; - break; - case 'if_octets': - $obj->rrd_title = sprintf('Interface Traffic (%s)', $obj->args[$instance]); - $obj->rrd_vertical = sprintf('%s per second', ucfirst($CONFIG['network_datasize'])); - $obj->scale = $CONFIG['network_datasize'] == 'bits' ? 8 : 1; - break; - case 'if_packets': - $obj->rrd_title = sprintf('Interface Packets (%s)', $obj->args[$instance]); - $obj->rrd_vertical = 'Packets per second'; - break; -} - -$obj->rrd_graph(); -- cgit v1.1