From 51f5d8d4be186e90c5c4b748e292b9f75add5585 Mon Sep 17 00:00:00 2001 From: Manuel CISSÉ Date: Tue, 23 Feb 2010 17:44:22 +0100 Subject: add nut plugin --- plugin/nut.php | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 plugin/nut.php (limited to 'plugin/nut.php') diff --git a/plugin/nut.php b/plugin/nut.php new file mode 100644 index 0000000..82b967e --- /dev/null +++ b/plugin/nut.php @@ -0,0 +1,57 @@ +width = $width; +$obj->heigth = $heigth; +$obj->generate_colors(); +switch($obj->args['type']) { + case 'percent': + $obj->data_sources = array('percent'); + $obj->ds_names = array('charge' => 'Charge', + 'load' => 'Load'); + $obj->rrd_title = sprintf('Charge & load (%s)', $obj->args['pinstance']); + $obj->rrd_vertical = '%'; + $obj->rrd_format = '%5.1lf'; + break; + case 'temperature': + $obj->data_sources = array('value'); + $obj->ds_names = array('value' => 'Temperature'); + $obj->rrd_title = sprintf('Temperature (%s)', $obj->args['pinstance']); + $obj->rrd_vertical = '°C'; + $obj->rrd_format = '%5.1lf%s'; + break; + case 'timeleft': + $obj->data_sources = array('timeleft'); + $obj->ds_names = array('timeleft' => 'Timeleft'); + $obj->rrd_title = sprintf('Timeleft (%s)', $obj->args['pinstance']); + $obj->rrd_vertical = 'Seconds'; + $obj->rrd_format = '%5.1lf'; + break; + case 'voltage': + $obj->data_sources = array('value'); + $obj->ds_names = array('battery' => 'Battery', + 'input' => 'Input', + 'output' => 'Output'); + $obj->rrd_title = sprintf('Voltage (%s)', $obj->args['pinstance']); + $obj->rrd_vertical = 'Volts'; + $obj->rrd_format = '%5.1lf'; + break; +} + +collectd_flush($obj->identifiers); +$obj->rrd_graph(); + +?> -- cgit v1.1