diff options
Diffstat (limited to '')
-rw-r--r-- | plugin/vmem.php | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/plugin/vmem.php b/plugin/vmem.php new file mode 100644 index 0000000..e465932 --- /dev/null +++ b/plugin/vmem.php | |||
@@ -0,0 +1,66 @@ | |||
1 | <?php | ||
2 | |||
3 | # Collectd VMem plugin | ||
4 | |||
5 | require_once 'conf/common.inc.php'; | ||
6 | require_once 'type/GenericStacked.class.php'; | ||
7 | require_once 'inc/collectd.inc.php'; | ||
8 | |||
9 | ## LAYOUT | ||
10 | # vmem/ | ||
11 | # vmem/vmpage_faults.rrd | ||
12 | # vmem/vmpage_io-memory.rrd | ||
13 | # vmem/vmpage_io-swapy.rrd | ||
14 | # vmem/vmpage_number-<type>.rrd | ||
15 | |||
16 | $obj = new Type_GenericStacked($CONFIG); | ||
17 | $obj->width = $width; | ||
18 | $obj->heigth = $heigth; | ||
19 | switch($obj->args['type']) { | ||
20 | case 'vmpage_faults': | ||
21 | $obj->data_sources = array('minflt', 'majflt'); | ||
22 | $obj->colors = array('minflt' => '0000f0', | ||
23 | 'majflt' => 'f00000'); | ||
24 | $obj->ds_names = array('minflt' => 'Minor', | ||
25 | 'majflt' => 'Major'); | ||
26 | $obj->rrd_title = 'Page faults'; | ||
27 | $obj->rrd_vertical = ''; | ||
28 | $obj->rrd_format = '%5.1lf%s'; | ||
29 | break; | ||
30 | case 'vmpage_io': | ||
31 | $obj->data_sources = array('in', 'out'); | ||
32 | $obj->ds_names = array('memory-in' => 'Memory (in) ', | ||
33 | 'memory-out' => 'Memory (out)', | ||
34 | 'swap-in' => 'Swap (in) ', | ||
35 | 'swap-out' => 'Swap (out) '); | ||
36 | $obj->colors = array('memory-in' => 'ff0000', | ||
37 | 'memory-out' => '0000ff', | ||
38 | 'swap-in' => 'ff00ff', | ||
39 | 'swap-out' => 'ffff00'); | ||
40 | $obj->rrd_title = 'Page IO'; | ||
41 | $obj->rrd_vertical = ''; | ||
42 | $obj->rrd_format = '%5.1lf%s'; | ||
43 | break; | ||
44 | case 'vmpage_number': | ||
45 | $obj->data_sources = array('value'); | ||
46 | $obj->generate_colors(); | ||
47 | $obj->order = array('active_anon', 'active_file', | ||
48 | 'anon_pages', 'bounce', | ||
49 | 'dirty', 'file_pages', | ||
50 | 'free_pages', 'inactive_anon', | ||
51 | 'inactive_file', 'mapped', | ||
52 | 'mlock', 'page_table_pages', | ||
53 | 'slab_reclaimable', 'slab_unreclaimable', | ||
54 | 'unevictable', 'unstable', | ||
55 | #'vmscan_write', | ||
56 | 'writeback', 'writeback_temp'); | ||
57 | $obj->rrd_title = 'Pages'; | ||
58 | $obj->rrd_vertical = ''; | ||
59 | $obj->rrd_format = '%5.1lf%s'; | ||
60 | break; | ||
61 | } | ||
62 | |||
63 | collectd_flush($obj->identifiers); | ||
64 | $obj->rrd_graph(); | ||
65 | |||
66 | ?> | ||