diff options
Diffstat (limited to 'plugin/swap.php')
-rw-r--r-- | plugin/swap.php | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/plugin/swap.php b/plugin/swap.php new file mode 100644 index 0000000..dfd9ba1 --- /dev/null +++ b/plugin/swap.php | |||
@@ -0,0 +1,50 @@ | |||
1 | <?php | ||
2 | |||
3 | # Collectd Swap plugin | ||
4 | |||
5 | require_once $CONFIG['webdir'].'/conf/config.php'; | ||
6 | require_once $CONFIG['webdir'].'/type/GenericStacked.class.php'; | ||
7 | |||
8 | ## LAYOUT | ||
9 | # swap/ | ||
10 | # swap/swap-cached.rrd | ||
11 | # swap/swap-free.rrd | ||
12 | # swap/swap-used.rrd | ||
13 | |||
14 | # grouped | ||
15 | require_once $CONFIG['webdir'].'/inc/collectd.inc.php'; | ||
16 | $tinstance = collectd_plugindetail($host, $plugin, 'ti'); | ||
17 | |||
18 | $obj = new Type_GenericStacked; | ||
19 | $obj->datadir = $CONFIG['datadir']; | ||
20 | $obj->path_format = '{host}/{plugin}/{type}-{tinstance}.rrd'; | ||
21 | $obj->args = array( | ||
22 | 'host' => $host, | ||
23 | 'plugin' => $plugin, | ||
24 | 'pinstance' => $pinstance, | ||
25 | 'type' => $type, | ||
26 | 'tinstance' => $tinstance, | ||
27 | ); | ||
28 | $obj->data_sources = array('value'); | ||
29 | $obj->order = array('free', 'cached', 'used'); | ||
30 | $obj->ds_names = array( | ||
31 | 'free' => 'Free ', | ||
32 | 'cached' => 'Cached ', | ||
33 | 'used' => 'Used ', | ||
34 | ); | ||
35 | $obj->colors = array( | ||
36 | 'free' => '00e000', | ||
37 | 'cached' => '0000ff', | ||
38 | 'used' => 'ff0000', | ||
39 | ); | ||
40 | $obj->width = $width; | ||
41 | $obj->heigth = $heigth; | ||
42 | $obj->seconds = $seconds; | ||
43 | |||
44 | $obj->rrd_title = "Swap utilization on $host"; | ||
45 | $obj->rrd_vertical = 'Bytes'; | ||
46 | $obj->rrd_format = '%5.1lf%s'; | ||
47 | |||
48 | $obj->rrd_graph(); | ||
49 | |||
50 | ?> | ||