diff options
Diffstat (limited to 'plugin/interface.php')
-rw-r--r-- | plugin/interface.php | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/plugin/interface.php b/plugin/interface.php index 7d8d929..89e4280 100644 --- a/plugin/interface.php +++ b/plugin/interface.php | |||
@@ -12,15 +12,7 @@ require_once 'inc/collectd.inc.php'; | |||
12 | # interface/if_octets-XXXX.rrd | 12 | # interface/if_octets-XXXX.rrd |
13 | # interface/if_packets-XXXX.rrd | 13 | # interface/if_packets-XXXX.rrd |
14 | 14 | ||
15 | $obj = new Type_GenericIO; | 15 | $obj = new Type_GenericIO($CONFIG['datadir']); |
16 | $obj->datadir = $CONFIG['datadir']; | ||
17 | $obj->args = array( | ||
18 | 'host' => $host, | ||
19 | 'plugin' => $plugin, | ||
20 | 'pinstance' => $pinstance, | ||
21 | 'type' => $type, | ||
22 | 'tinstance' => $tinstance, | ||
23 | ); | ||
24 | $obj->data_sources = array('rx', 'tx'); | 16 | $obj->data_sources = array('rx', 'tx'); |
25 | $obj->ds_names = array( | 17 | $obj->ds_names = array( |
26 | 'rx' => 'Receive ', | 18 | 'rx' => 'Receive ', |
@@ -32,25 +24,24 @@ $obj->colors = array( | |||
32 | ); | 24 | ); |
33 | $obj->width = $width; | 25 | $obj->width = $width; |
34 | $obj->heigth = $heigth; | 26 | $obj->heigth = $heigth; |
35 | $obj->seconds = $seconds; | ||
36 | $obj->rrd_format = '%5.1lf%s'; | 27 | $obj->rrd_format = '%5.1lf%s'; |
37 | switch($type) { | 28 | |
29 | switch($obj->args['type']) { | ||
38 | case 'if_errors': | 30 | case 'if_errors': |
39 | $obj->rrd_title = sprintf('Interface Errors (%s)', $tinstance); | 31 | $obj->rrd_title = sprintf('Interface Errors (%s)', $obj->args['tinstance']); |
40 | $obj->rrd_vertical = 'Errors per second'; | 32 | $obj->rrd_vertical = 'Errors per second'; |
41 | break; | 33 | break; |
42 | case 'if_octets': | 34 | case 'if_octets': |
43 | $obj->rrd_title = sprintf('Interface Traffic (%s)', $tinstance); | 35 | $obj->rrd_title = sprintf('Interface Traffic (%s)', $obj->args['tinstance']); |
44 | $obj->rrd_vertical = 'Bits per second'; | 36 | $obj->rrd_vertical = 'Bits per second'; |
45 | break; | 37 | break; |
46 | case 'if_packets': | 38 | case 'if_packets': |
47 | $obj->rrd_title = sprintf('Interface Packets (%s)', $tinstance); | 39 | $obj->rrd_title = sprintf('Interface Packets (%s)', $obj->args['tinstance']); |
48 | $obj->rrd_vertical = 'Packets per second'; | 40 | $obj->rrd_vertical = 'Packets per second'; |
49 | break; | 41 | break; |
50 | } | 42 | } |
51 | 43 | ||
52 | collectd_flush(ident_from_args($obj->args)); | 44 | collectd_flush($obj->identifiers); |
53 | |||
54 | $obj->rrd_graph(); | 45 | $obj->rrd_graph(); |
55 | 46 | ||
56 | ?> | 47 | ?> |