diff options
-rw-r--r-- | plugin/zfs_arc.php | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/plugin/zfs_arc.php b/plugin/zfs_arc.php new file mode 100644 index 0000000..4a2592b --- /dev/null +++ b/plugin/zfs_arc.php | |||
@@ -0,0 +1,103 @@ | |||
1 | <?php | ||
2 | # Collectd zfs_arc plugin | ||
3 | |||
4 | require_once 'conf/common.inc.php'; | ||
5 | require_once 'type/Default.class.php'; | ||
6 | require_once 'inc/collectd.inc.php'; | ||
7 | |||
8 | ## LAYOUT | ||
9 | # zfs_arc/ | ||
10 | # zfs_arc/arc_counts-hits.rrd | ||
11 | # zfs_arc/arc_counts-misses.rrd | ||
12 | # zfs_arc/arc_l2_bytes.rrd | ||
13 | # zfs_arc/arc_l2_size.rrd | ||
14 | # zfs_arc/arc_ratio-L1.rrd | ||
15 | # zfs_arc/arc_ratio-L2.rrd | ||
16 | # zfs_arc/arc_size.rrd | ||
17 | $obj = new Type_Default($CONFIG); | ||
18 | $obj->width = $width; | ||
19 | $obj->heigth = $heigth; | ||
20 | switch($obj->args['type']) { | ||
21 | case 'arc_counts': | ||
22 | $obj->data_sources = array( | ||
23 | 'demand_data', | ||
24 | 'demand_metadata', | ||
25 | 'prefetch_data', | ||
26 | 'prefetch_metadata' | ||
27 | ); | ||
28 | $obj->colors = array( | ||
29 | 'hits-demand_data' => 'ff0000', | ||
30 | 'misses-demand_data' => '880000', | ||
31 | 'hits-demand_metadata' => '00ff00', | ||
32 | 'misses-demand_metadata' => '00aa00', | ||
33 | 'hits-prefetch_data' => '0000ff', | ||
34 | 'misses-prefetch_data' => '00f0f0', | ||
35 | 'hits-prefetch_metadata' => 'ff00ff', | ||
36 | 'misses-prefetch_metadata' => '888800' | ||
37 | ); | ||
38 | $obj->ds_names = array( | ||
39 | 'hits-demand_data' => 'data hits', | ||
40 | 'misses-demand_data' => 'metadata misses', | ||
41 | 'hits-demand_metadata' => 'metadata hits', | ||
42 | 'misses-demand_metadata' => 'metadata misses', | ||
43 | 'hits-prefetch_data' => 'prefetch data hits', | ||
44 | 'misses-prefetch_data' => 'prefetch data misses', | ||
45 | 'hits-prefetch_metadata' => 'prefetch metadata hits', | ||
46 | 'misses-prefetch_metadata' => 'prefetch metadata misses' | ||
47 | ); | ||
48 | $obj->rrd_title = 'arc counts'; | ||
49 | $obj->rrd_vertical = 'count'; | ||
50 | $obj->rrd_format = '%5.1lf%s'; | ||
51 | break; | ||
52 | case 'arc_size': | ||
53 | $obj->data_sources = array('current','target','minlimit','maxlimit'); | ||
54 | $obj->order = array( | ||
55 | 'current', | ||
56 | 'target', | ||
57 | 'minlimit', | ||
58 | 'maxlimit' | ||
59 | ); | ||
60 | $obj->rrd_title = 'Arc size'; | ||
61 | $obj->rrd_vertical = 'bytes'; | ||
62 | $obj->rrd_format = '%5.1lf%s'; | ||
63 | break; | ||
64 | case 'arc_l2_bytes': | ||
65 | $obj->data_sources = array( | ||
66 | 'write', | ||
67 | 'read' | ||
68 | ); | ||
69 | $obj->ds_names = array( | ||
70 | 'write' => 'Write', | ||
71 | 'read' => 'Read', | ||
72 | ); | ||
73 | $obj->colors = array( | ||
74 | 'write' => 'ff0000', | ||
75 | 'read' => '0000ff', | ||
76 | ); | ||
77 | $obj->rrd_title = 'Arc L2 bytes'; | ||
78 | $obj->rrd_vertical = 'bytes'; | ||
79 | $obj->rrd_format = '%5.1lf%s'; | ||
80 | break; | ||
81 | case 'arc_l2_size': | ||
82 | $obj->data_sources = array( | ||
83 | 'value' | ||
84 | ); | ||
85 | $obj->ds_names = array( | ||
86 | 'value' => 'Bytes' | ||
87 | ); | ||
88 | $obj->colors = array( | ||
89 | 'value' => '0000ff', | ||
90 | ); | ||
91 | $obj->rrd_title = 'Arc L2 size'; | ||
92 | $obj->rrd_vertical = 'bytes'; | ||
93 | $obj->rrd_format = '%5.1lf%s'; | ||
94 | break; | ||
95 | case 'arc_ratio': | ||
96 | $obj->data_sources = array('value'); | ||
97 | $obj->rrd_title = 'Arc ratio'; | ||
98 | $obj->rrd_vertical = 'ratio'; | ||
99 | $obj->rrd_format = '%5.1lf%s'; | ||
100 | break; | ||
101 | } | ||
102 | collectd_flush($obj->identifiers); | ||
103 | $obj->rrd_graph(); | ||