From a5242158176268e733d1f481602aa5ec298dada7 Mon Sep 17 00:00:00 2001 From: Pim van den Berg Date: Sun, 26 Jun 2011 21:14:51 +0200 Subject: type/Default: dont use t as ti when no ti is set Use 'value' instead. --- plugin/apache.php | 24 ++++++++++++------------ plugin/conntrack.php | 14 ++++++-------- plugin/contextswitch.php | 13 ++++++++++--- plugin/entropy.php | 13 ++++++++++--- plugin/users.php | 13 ++++++++++--- 5 files changed, 48 insertions(+), 29 deletions(-) (limited to 'plugin') diff --git a/plugin/apache.php b/plugin/apache.php index 99fc689..95c12fa 100644 --- a/plugin/apache.php +++ b/plugin/apache.php @@ -19,10 +19,10 @@ switch ($obj->args['type']) { case 'apache_bytes': $obj->data_sources = array('value'); $obj->ds_names = array( - $obj->args['type'] => 'Bytes/s', + 'value' => 'Bytes/s', ); $obj->colors = array( - $obj->args['type'] => '0000ff', + 'value' => '0000ff', ); $obj->rrd_title = sprintf('Webserver Traffic%s', !empty($obj->args['pinstance']) ? ' ('.$obj->args['pinstance'].')' : ''); @@ -31,10 +31,10 @@ switch ($obj->args['type']) { case 'apache_connections': $obj->data_sources = array('value'); $obj->ds_names = array( - $obj->args['type'] => 'Conns/s', + 'value' => 'Conns/s', ); $obj->colors = array( - $obj->args['type'] => '00b000', + 'value' => '00b000', ); $obj->rrd_title = sprintf('Webserver Connections%s', !empty($obj->args['pinstance']) ? ' ('.$obj->args['pinstance'].')' : ''); @@ -43,10 +43,10 @@ switch ($obj->args['type']) { case 'apache_idle_workers': $obj->data_sources = array('value'); $obj->ds_names = array( - $obj->args['type'] => 'Workers', + 'value' => 'Workers', ); $obj->colors = array( - $obj->args['type'] => '0000ff', + 'value' => '0000ff', ); $obj->rrd_title = sprintf('Webserver Idle Workers%s', !empty($obj->args['pinstance']) ? ' ('.$obj->args['pinstance'].')' : ''); @@ -55,10 +55,10 @@ switch ($obj->args['type']) { case 'apache_requests': $obj->data_sources = array('value'); $obj->ds_names = array( - $obj->args['type'] => 'Requests/s', + 'value' => 'Requests/s', ); $obj->colors = array( - $obj->args['type'] => '00b000', + 'value' => '00b000', ); $obj->rrd_title = sprintf('Webserver Requests%s', !empty($obj->args['pinstance']) ? ' ('.$obj->args['pinstance'].')' : ''); @@ -157,12 +157,12 @@ $obj->rrd_format = '%5.1lf'; if ($CONFIG['version'] < 5) { $obj->data_sources = array('count'); if (count($obj->ds_names) == 1) { - $obj->ds_names['count'] = $obj->ds_names[$obj->args['type']]; - unset($obj->ds_names[$obj->args['type']]); + $obj->ds_names['count'] = $obj->ds_names['value']; + unset($obj->ds_names['value']); } if (count($obj->colors) == 1) { - $obj->colors['count'] = $obj->colors[$obj->args['type']]; - unset($obj->colors[$obj->args['type']]); + $obj->colors['count'] = $obj->colors['value']; + unset($obj->colors['value']); } } diff --git a/plugin/conntrack.php b/plugin/conntrack.php index 2034a57..6c38776 100644 --- a/plugin/conntrack.php +++ b/plugin/conntrack.php @@ -27,14 +27,12 @@ $obj->rrd_format = '%.1lf'; # the data source is named 'entropy' in collectd's types.db if ($CONFIG['version'] < 5) { $obj->data_sources = array('entropy'); - if (count($obj->ds_names) == 1) { - $obj->ds_names['entropy'] = $obj->ds_names['value']; - unset($obj->ds_names['value']); - } - if (count($obj->colors) == 1) { - $obj->colors['entropy'] = $obj->colors['value']; - unset($obj->colors['value']); - } + + $obj->ds_names['entropy'] = $obj->ds_names['value']; + unset($obj->ds_names['value']); + + $obj->colors['entropy'] = $obj->colors['value']; + unset($obj->colors['value']); } collectd_flush($obj->identifiers); diff --git a/plugin/contextswitch.php b/plugin/contextswitch.php index 8a2036f..701a3a7 100644 --- a/plugin/contextswitch.php +++ b/plugin/contextswitch.php @@ -12,10 +12,10 @@ require_once 'inc/collectd.inc.php'; $obj = new Type_Default($CONFIG); $obj->data_sources = array('value'); $obj->ds_names = array( - 'contextswitches' => 'Context switches', + 'value' => 'Context switches', ); $obj->colors = array( - 'contextswitches' => '0000f0', + 'value' => '0000f0', ); $obj->width = $width; $obj->heigth = $heigth; @@ -24,8 +24,15 @@ $obj->rrd_vertical = 'switch per second Bits'; $obj->rrd_format = '%4.0lf'; # backwards compatibility -if ($CONFIG['version'] < 5) +if ($CONFIG['version'] < 5) { $obj->data_sources = array('contextswitches'); + $obj->ds_names['contextswitches'] = $obj->ds_names['value']; + unset($obj->ds_names['value']); + + $obj->colors['contextswitches'] = $obj->colors['value']; + unset($obj->colors['value']); +} + collectd_flush($obj->identifiers); $obj->rrd_graph(); diff --git a/plugin/entropy.php b/plugin/entropy.php index bc7d308..bc1c95f 100644 --- a/plugin/entropy.php +++ b/plugin/entropy.php @@ -12,10 +12,10 @@ require_once 'inc/collectd.inc.php'; $obj = new Type_Default($CONFIG); $obj->data_sources = array('value'); $obj->ds_names = array( - 'entropy' => 'Entropy bits', + 'value' => 'Entropy bits', ); $obj->colors = array( - 'entropy' => '0000f0', + 'value' => '0000f0', ); $obj->width = $width; $obj->heigth = $heigth; @@ -24,8 +24,15 @@ $obj->rrd_vertical = 'Bits'; $obj->rrd_format = '%4.0lf'; # backwards compatibility -if ($CONFIG['version'] < 5) +if ($CONFIG['version'] < 5) { $obj->data_sources = array('entropy'); + $obj->ds_names['entropy'] = $obj->ds_names['value']; + unset($obj->ds_names['value']); + + $obj->colors['entropy'] = $obj->colors['value']; + unset($obj->colors['value']); +} + collectd_flush($obj->identifiers); $obj->rrd_graph(); diff --git a/plugin/users.php b/plugin/users.php index a4558b5..a948fc1 100644 --- a/plugin/users.php +++ b/plugin/users.php @@ -12,10 +12,10 @@ require_once 'inc/collectd.inc.php'; $obj = new Type_Default($CONFIG); $obj->data_sources = array('value'); $obj->ds_names = array( - 'users' => 'Users', + 'value' => 'Users', ); $obj->colors = array( - 'users' => '0000f0', + 'value' => '0000f0', ); $obj->width = $width; $obj->heigth = $heigth; @@ -24,8 +24,15 @@ $obj->rrd_vertical = 'Users'; $obj->rrd_format = '%.1lf'; # backwards compatibility -if ($CONFIG['version'] < 5) +if ($CONFIG['version'] < 5) { $obj->data_sources = array('users'); + $obj->ds_names['users'] = $obj->ds_names['value']; + unset($obj->ds_names['value']); + + $obj->colors['users'] = $obj->colors['value']; + unset($obj->colors['value']); +} + collectd_flush($obj->identifiers); $obj->rrd_graph(); -- cgit v1.1