From e0b921c172febee979574cd12baa22ae5f4db166 Mon Sep 17 00:00:00 2001 From: Peter Chiochetti Date: Mon, 1 Aug 2011 21:28:59 +0200 Subject: plugin: add apcups plugin --- plugin/apcups.php | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 plugin/apcups.php (limited to 'plugin/apcups.php') diff --git a/plugin/apcups.php b/plugin/apcups.php new file mode 100644 index 0000000..5fc3687 --- /dev/null +++ b/plugin/apcups.php @@ -0,0 +1,80 @@ +width = $width; +$obj->heigth = $heigth; + +switch($obj->args['type']) { + case 'charge': + $obj->data_sources = array('value'); + $obj->ds_names = 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('frequency'); + $obj->ds_names = array('frequency' => 'Input Frequency'); + $obj->colors = array('frequency' => '0000f0'); + $obj->rrd_title = sprintf('UPS Input Frequency'); + $obj->rrd_vertical = 'Hertz'; + break; + case 'percent': + $obj->data_sources = array('percent'); + $obj->ds_names = array('percent' => 'Load'); + $obj->colors = array('percent' => '0000f0'); + $obj->rrd_title = sprintf('UPS Load'); + $obj->rrd_vertical = 'Percent'; + break; + case 'temperature': + $obj->data_sources = array('value'); + $obj->ds_names = 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('timeleft'); + $obj->ds_names = array('timeleft' => 'Time Left'); + $obj->colors = array('timeleft' => '0000f0'); + $obj->rrd_title = sprintf('UPS Time Left'); + $obj->rrd_vertical = 'Minutes'; + break; + case 'voltage': + $obj->order = array('battery', 'input', 'output'); + $obj->ds_names = 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'; + +collectd_flush($obj->identifiers); +$obj->rrd_graph(); + -- cgit v1.1