diff options
Diffstat (limited to '')
| -rw-r--r-- | plugin/conntrack.php | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/plugin/conntrack.php b/plugin/conntrack.php index 949d88e..2034a57 100644 --- a/plugin/conntrack.php +++ b/plugin/conntrack.php | |||
| @@ -10,13 +10,12 @@ require_once 'inc/collectd.inc.php'; | |||
| 10 | # conntrack/conntrack.rrd | 10 | # conntrack/conntrack.rrd |
| 11 | 11 | ||
| 12 | $obj = new Type_Default($CONFIG); | 12 | $obj = new Type_Default($CONFIG); |
| 13 | # the data source is named 'entropy' in collectd's types.db | 13 | $obj->data_sources = array('value'); |
| 14 | $obj->data_sources = array('entropy'); | ||
| 15 | $obj->ds_names = array( | 14 | $obj->ds_names = array( |
| 16 | 'entropy' => 'Conntrack entries', | 15 | 'value' => 'Conntrack entries', |
| 17 | ); | 16 | ); |
| 18 | $obj->colors = array( | 17 | $obj->colors = array( |
| 19 | 'entropy' => '0000f0', | 18 | 'value' => '0000f0', |
| 20 | ); | 19 | ); |
| 21 | $obj->width = $width; | 20 | $obj->width = $width; |
| 22 | $obj->heigth = $heigth; | 21 | $obj->heigth = $heigth; |
| @@ -24,5 +23,19 @@ $obj->rrd_title = 'Conntrack entries'; | |||
| 24 | $obj->rrd_vertical = '#'; | 23 | $obj->rrd_vertical = '#'; |
| 25 | $obj->rrd_format = '%.1lf'; | 24 | $obj->rrd_format = '%.1lf'; |
| 26 | 25 | ||
| 26 | # backwards compatibility | ||
| 27 | # the data source is named 'entropy' in collectd's types.db | ||
| 28 | if ($CONFIG['version'] < 5) { | ||
| 29 | $obj->data_sources = array('entropy'); | ||
| 30 | if (count($obj->ds_names) == 1) { | ||
| 31 | $obj->ds_names['entropy'] = $obj->ds_names['value']; | ||
| 32 | unset($obj->ds_names['value']); | ||
| 33 | } | ||
| 34 | if (count($obj->colors) == 1) { | ||
| 35 | $obj->colors['entropy'] = $obj->colors['value']; | ||
| 36 | unset($obj->colors['value']); | ||
| 37 | } | ||
| 38 | } | ||
| 39 | |||
| 27 | collectd_flush($obj->identifiers); | 40 | collectd_flush($obj->identifiers); |
| 28 | $obj->rrd_graph(); | 41 | $obj->rrd_graph(); |
