diff options
Diffstat (limited to 'plugin/swap.php')
-rw-r--r-- | plugin/swap.php | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/plugin/swap.php b/plugin/swap.php index 638ddc3..e1527cc 100644 --- a/plugin/swap.php +++ b/plugin/swap.php | |||
@@ -4,6 +4,7 @@ | |||
4 | 4 | ||
5 | require_once 'conf/common.inc.php'; | 5 | require_once 'conf/common.inc.php'; |
6 | require_once 'type/GenericStacked.class.php'; | 6 | require_once 'type/GenericStacked.class.php'; |
7 | require_once 'inc/collectd.inc.php'; | ||
7 | 8 | ||
8 | ## LAYOUT | 9 | ## LAYOUT |
9 | # swap/ | 10 | # swap/ |
@@ -11,25 +12,12 @@ require_once 'type/GenericStacked.class.php'; | |||
11 | # swap/swap-free.rrd | 12 | # swap/swap-free.rrd |
12 | # swap/swap-used.rrd | 13 | # swap/swap-used.rrd |
13 | 14 | ||
14 | if ($type == 'swap_io') { | 15 | if ($_GET['t'] == 'swap_io') { |
15 | die_img('Error: swap_io not supported yet'); | 16 | die_img('Error: swap_io not supported yet'); |
16 | exit; | 17 | exit; |
17 | } | 18 | } |
18 | 19 | ||
19 | # grouped | 20 | $obj = new Type_GenericStacked($CONFIG['datadir']); |
20 | require_once 'inc/collectd.inc.php'; | ||
21 | $tinstance = collectd_plugindetail($host, $plugin, 'ti', array('t' => $type)); | ||
22 | |||
23 | $obj = new Type_GenericStacked; | ||
24 | $obj->datadir = $CONFIG['datadir']; | ||
25 | $obj->args = array( | ||
26 | 'host' => $host, | ||
27 | 'plugin' => $plugin, | ||
28 | 'pinstance' => $pinstance, | ||
29 | 'type' => $type, | ||
30 | 'tinstance' => $tinstance, | ||
31 | ); | ||
32 | $obj->data_sources = array('value'); | ||
33 | $obj->order = array('free', 'cached', 'used'); | 21 | $obj->order = array('free', 'cached', 'used'); |
34 | $obj->ds_names = array( | 22 | $obj->ds_names = array( |
35 | 'free' => 'Free ', | 23 | 'free' => 'Free ', |
@@ -43,14 +31,12 @@ $obj->colors = array( | |||
43 | ); | 31 | ); |
44 | $obj->width = $width; | 32 | $obj->width = $width; |
45 | $obj->heigth = $heigth; | 33 | $obj->heigth = $heigth; |
46 | $obj->seconds = $seconds; | ||
47 | 34 | ||
48 | $obj->rrd_title = 'Swap utilization'; | 35 | $obj->rrd_title = 'Swap utilization'; |
49 | $obj->rrd_vertical = 'Bytes'; | 36 | $obj->rrd_vertical = 'Bytes'; |
50 | $obj->rrd_format = '%5.1lf%s'; | 37 | $obj->rrd_format = '%5.1lf%s'; |
51 | 38 | ||
52 | collectd_flush(ident_from_args($obj->args)); | 39 | collectd_flush($obj->identifiers); |
53 | |||
54 | $obj->rrd_graph(); | 40 | $obj->rrd_graph(); |
55 | 41 | ||
56 | ?> | 42 | ?> |