diff options
author | Pim van den Berg | 2011-06-15 22:45:39 +0200 |
---|---|---|
committer | Pim van den Berg | 2011-06-15 23:02:53 +0200 |
commit | d06c3047d77c0c08108dd19bbbbf2a62e1f0a3bf (patch) | |
tree | 71a857f9a9e2eeffec658f59ea0ff14a7fa5be25 /plugin | |
parent | plugin/apache: collectd 5 compatibility (diff) | |
download | apt-panopticon_cgp-d06c3047d77c0c08108dd19bbbbf2a62e1f0a3bf.zip apt-panopticon_cgp-d06c3047d77c0c08108dd19bbbbf2a62e1f0a3bf.tar.gz apt-panopticon_cgp-d06c3047d77c0c08108dd19bbbbf2a62e1f0a3bf.tar.bz2 apt-panopticon_cgp-d06c3047d77c0c08108dd19bbbbf2a62e1f0a3bf.tar.xz |
plugin/conntrack: collectd 5 compatibility
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(); |