From 4dd7e1b28bfdad22ad704ef7b8ac6386bbcad08e Mon Sep 17 00:00:00 2001 From: Pim van den Berg Date: Tue, 12 Oct 2010 19:01:49 +0200 Subject: plugin: add battery plugin --- plugin/battery.php | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 plugin/battery.php (limited to 'plugin') diff --git a/plugin/battery.php b/plugin/battery.php new file mode 100644 index 0000000..ade645c --- /dev/null +++ b/plugin/battery.php @@ -0,0 +1,42 @@ +width = $width; +$obj->heigth = $heigth; +$obj->colors = array( + 'value' => '0000f0', +); +switch($obj->args['type']) { + case 'charge': + $obj->ds_names = array('value' => 'Charge'); + $obj->rrd_title = sprintf('Charge (Battery %s)', $obj->args['pinstance']); + $obj->rrd_vertical = 'Ampere hours'; + break; + case 'current': + $obj->ds_names = array('value' => 'Current'); + $obj->rrd_title = sprintf('Current (Battery %s)', $obj->args['pinstance']); + $obj->rrd_vertical = 'Ampere'; + break; + case 'voltage': + $obj->ds_names = array('value' => 'Voltage'); + $obj->rrd_title = sprintf('Voltage (Battery %s)', $obj->args['pinstance']); + $obj->rrd_vertical = 'Volt'; + break; +} +$obj->rrd_format = '%4.1lf'; + +collectd_flush($obj->identifiers); +$obj->rrd_graph(); + -- cgit v1.1