From d62033252236ebcb598576e9c1e32c66ca883c85 Mon Sep 17 00:00:00 2001 From: Pim van den Berg Date: Mon, 19 Jul 2010 22:45:20 +0200 Subject: plugin/wireless: better labels and deduplicate code Wireless tools for Linux uses these labels: - signal_noice: Noice level - signal_power: Signal level - signal_quality: Link quality --- plugin/wireless.php | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) (limited to 'plugin') diff --git a/plugin/wireless.php b/plugin/wireless.php index 6f3af36..bbb9f4a 100644 --- a/plugin/wireless.php +++ b/plugin/wireless.php @@ -7,35 +7,28 @@ require_once 'type/GenericStacked.class.php'; require_once 'inc/collectd.inc.php'; $obj = new Type_GenericStacked($CONFIG); +$obj->data_sources = array('value'); +$obj->ds_names = array('value' => 'Value'); +$obj->colors = array('value' => '0000f0'); $obj->width = $width; $obj->heigth = $heigth; +$obj->rrd_format = '%6.1lf'; switch($obj->args['type']) { case 'signal_noise': - $obj->data_sources = array('value'); - $obj->colors = array('value' => '0000f0'); - $obj->ds_names = array('value' => 'Value'); - $obj->rrd_title = 'Signal Noise'; - $obj->rrd_vertical = ''; - $obj->rrd_format = '%6.1lf'; + $obj->rrd_title = sprintf('Noise level (%s)', $obj->args['pinstance']); + $obj->rrd_vertical = 'dBm'; break; case 'signal_power': - $obj->data_sources = array('value'); - $obj->colors = array('value' => '0000f0'); - $obj->ds_names = array('value' => 'Value'); - $obj->rrd_title = 'Signal Power'; - $obj->rrd_vertical = ''; - $obj->rrd_format = '%6.1lf'; + $obj->rrd_title = sprintf('Signal level (%s)', $obj->args['pinstance']); + $obj->rrd_vertical = 'dBm'; break; case 'signal_quality': - $obj->data_sources = array('value'); - $obj->colors = array('value' => '0000f0'); - $obj->ds_names = array('value' => 'Value'); - $obj->rrd_title = 'Signal Quality'; - $obj->rrd_vertical = ''; - $obj->rrd_format = '%6.1lf'; + $obj->rrd_title = sprintf('Link Quality (%s)', $obj->args['pinstance']); + $obj->rrd_vertical = 'quality'; break; } + collectd_flush($obj->identifiers); $obj->rrd_graph(); -- cgit v1.1