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