aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/plugin
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--plugin/swap.php52
1 files changed, 33 insertions, 19 deletions
diff --git a/plugin/swap.php b/plugin/swap.php
index e1527cc..27bf7f9 100644
--- a/plugin/swap.php
+++ b/plugin/swap.php
@@ -3,7 +3,6 @@
3# Collectd Swap plugin 3# Collectd Swap plugin
4 4
5require_once 'conf/common.inc.php'; 5require_once 'conf/common.inc.php';
6require_once 'type/GenericStacked.class.php';
7require_once 'inc/collectd.inc.php'; 6require_once 'inc/collectd.inc.php';
8 7
9## LAYOUT 8## LAYOUT
@@ -12,28 +11,43 @@ require_once 'inc/collectd.inc.php';
12# swap/swap-free.rrd 11# swap/swap-free.rrd
13# swap/swap-used.rrd 12# swap/swap-used.rrd
14 13
15if ($_GET['t'] == 'swap_io') { 14switch($_GET['t']) {
16 die_img('Error: swap_io not supported yet'); 15 case 'swap':
17 exit; 16 require_once 'type/GenericStacked.class.php';
17 $obj = new Type_GenericStacked($CONFIG['datadir']);
18 $obj->order = array('free', 'cached', 'used');
19 $obj->ds_names = array(
20 'free' => 'Free ',
21 'cached' => 'Cached ',
22 'used' => 'Used ',
23 );
24 $obj->colors = array(
25 'free' => '00e000',
26 'cached' => '0000ff',
27 'used' => 'ff0000',
28 );
29 $obj->rrd_title = 'Swap utilization';
30 $obj->rrd_vertical = 'Bytes';
31 break;
32 case 'swap_io':
33 require_once 'type/GenericIO.class.php';
34 $obj = new Type_GenericIO($CONFIG['datadir']);
35 $obj->order = array('out', 'in');
36 $obj->ds_names = array(
37 'out' => 'Out',
38 'in' => 'In ',
39 );
40 $obj->colors = array(
41 'out' => '0000ff',
42 'in' => '00b000',
43 );
44 $obj->rrd_title = 'Swapped I/O pages';
45 $obj->rrd_vertical = 'Pages';
46 break;
18} 47}
19 48
20$obj = new Type_GenericStacked($CONFIG['datadir']);
21$obj->order = array('free', 'cached', 'used');
22$obj->ds_names = array(
23 'free' => 'Free ',
24 'cached' => 'Cached ',
25 'used' => 'Used ',
26);
27$obj->colors = array(
28 'free' => '00e000',
29 'cached' => '0000ff',
30 'used' => 'ff0000',
31);
32$obj->width = $width; 49$obj->width = $width;
33$obj->heigth = $heigth; 50$obj->heigth = $heigth;
34
35$obj->rrd_title = 'Swap utilization';
36$obj->rrd_vertical = 'Bytes';
37$obj->rrd_format = '%5.1lf%s'; 51$obj->rrd_format = '%5.1lf%s';
38 52
39collectd_flush($obj->identifiers); 53collectd_flush($obj->identifiers);