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/apcups.php | 89 ------------------------------------------------------- 1 file changed, 89 deletions(-) delete mode 100644 plugin/apcups.php (limited to 'plugin/apcups.php') diff --git a/plugin/apcups.php b/plugin/apcups.php deleted file mode 100644 index 853f0ed..0000000 --- a/plugin/apcups.php +++ /dev/null @@ -1,89 +0,0 @@ -args['type']) { - case 'charge': - $obj->data_sources = array('value'); - $obj->legend = array('value' => 'Charge'); - $obj->colors = array('value' => '0000f0'); - $obj->rrd_title = sprintf('UPS Charge'); - $obj->rrd_vertical = 'Ampere hours'; - break; - case 'frequency': - $obj->data_sources = array('value'); - $obj->legend = array('value' => 'Input Frequency'); - $obj->colors = array('value' => '0000f0'); - $obj->rrd_title = sprintf('UPS Input Frequency'); - $obj->rrd_vertical = 'Hertz'; - break; - case 'percent': - $obj->data_sources = array('value'); - $obj->legend = array('value' => 'Load'); - $obj->colors = array('value' => '0000f0'); - $obj->rrd_title = sprintf('UPS Load'); - $obj->rrd_vertical = 'Percent'; - break; - case 'temperature': - $obj->data_sources = array('value'); - $obj->legend = array('value' => 'Temperature'); - $obj->colors = array('value' => '0000f0'); - $obj->rrd_title = sprintf('UPS Temperature'); - $obj->rrd_vertical = 'Celsius'; - break; - case 'timeleft': - $obj->data_sources = array('value'); - $obj->legend = array('value' => 'Time Left'); - $obj->colors = array('value' => '0000f0'); - $obj->rrd_title = sprintf('UPS Time Left'); - $obj->rrd_vertical = 'Seconds'; - break; - case 'voltage': - $obj->order = array('battery', 'input', 'output'); - $obj->legend = array( - 'battery' => 'Battery Voltage', - 'input' => 'Input Voltage', - 'output' => 'Output Voltage' - ); - $obj->colors = array( - 'battery' => '0000f0', - 'input' => '00f000', - 'output' => 'f00000' - ); - $obj->rrd_title = sprintf('UPS Voltage'); - $obj->rrd_vertical = 'Volt'; - break; -} -$obj->rrd_format = '%5.1lf%s'; - -# backwards compatibility -if ($CONFIG['version'] < 5 && - in_array($obj->args['type'], array('frequency', 'percent', 'timeleft'))) { - - $obj->data_sources = array($obj->args['type']); - - $obj->legend[$obj->args['type']] = $obj->legend['value']; - unset($obj->legend['value']); - - $obj->colors[$obj->args['type']] = $obj->colors['value']; - unset($obj->colors['value']); -} - -$obj->rrd_graph(); - -- cgit v1.1