diff options
Diffstat (limited to '')
-rw-r--r-- | plugin/processes.php | 183 |
1 files changed, 163 insertions, 20 deletions
diff --git a/plugin/processes.php b/plugin/processes.php index caf445b..ddee61d 100644 --- a/plugin/processes.php +++ b/plugin/processes.php | |||
@@ -16,41 +16,184 @@ require_once 'inc/collectd.inc.php'; | |||
16 | # processes/ps_state-sleeping.rrd | 16 | # processes/ps_state-sleeping.rrd |
17 | 17 | ||
18 | $obj = new Type_GenericStacked($CONFIG); | 18 | $obj = new Type_GenericStacked($CONFIG); |
19 | $obj->ds_names = array( | ||
20 | 'paging' => 'Paging', | ||
21 | 'blocked' => 'Blocked', | ||
22 | 'zombies' => 'Zombies', | ||
23 | 'stopped' => 'Stopped', | ||
24 | 'running' => 'Running', | ||
25 | 'sleeping' => 'Sleeping', | ||
26 | 'value' => 'Forks', | ||
27 | ); | ||
28 | $obj->colors = array( | ||
29 | 'paging' => 'ffb000', | ||
30 | 'blocked' => 'ff00ff', | ||
31 | 'zombies' => 'ff0000', | ||
32 | 'stopped' => 'a000a0', | ||
33 | 'running' => '00e000', | ||
34 | 'sleeping' => '0000ff', | ||
35 | 'value' => 'f0a000', | ||
36 | ); | ||
37 | $obj->width = $width; | 19 | $obj->width = $width; |
38 | $obj->heigth = $heigth; | 20 | $obj->heigth = $heigth; |
39 | 21 | ||
40 | switch($obj->args['type']) | 22 | switch($obj->args['type']) |
41 | { | 23 | { |
42 | case 'ps_state': | 24 | case 'ps_state': |
25 | $obj->ds_names = array( | ||
26 | 'paging' => 'Paging', | ||
27 | 'blocked' => 'Blocked', | ||
28 | 'zombies' => 'Zombies', | ||
29 | 'stopped' => 'Stopped', | ||
30 | 'running' => 'Running', | ||
31 | 'sleeping' => 'Sleeping', | ||
32 | ); | ||
33 | $obj->colors = array( | ||
34 | 'paging' => 'ffb000', | ||
35 | 'blocked' => 'ff00ff', | ||
36 | 'zombies' => 'ff0000', | ||
37 | 'stopped' => 'a000a0', | ||
38 | 'running' => '00e000', | ||
39 | 'sleeping' => '0000ff', | ||
40 | 'value' => 'f0a000', | ||
41 | ); | ||
43 | $obj->rrd_title = 'Processes'; | 42 | $obj->rrd_title = 'Processes'; |
44 | $obj->rrd_vertical = 'Processes'; | 43 | $obj->rrd_vertical = 'Processes'; |
45 | $obj->rrd_format = '%5.1lf%s'; | 44 | $obj->rrd_format = '%5.1lf%s'; |
46 | break; | 45 | break; |
46 | |||
47 | case 'fork_rate': | 47 | case 'fork_rate': |
48 | $obj->ds_names = array( | ||
49 | 'value' => 'Forks', | ||
50 | ); | ||
51 | $obj->colors = array( | ||
52 | 'value' => 'f0a000', | ||
53 | ); | ||
48 | $obj->rrd_title = 'Fork rate'; | 54 | $obj->rrd_title = 'Fork rate'; |
49 | $obj->rrd_vertical = 'forks/s'; | 55 | $obj->rrd_vertical = 'forks/s'; |
50 | $obj->rrd_format = '%5.1lf%s'; | 56 | $obj->rrd_format = '%5.1lf%s'; |
51 | break; | 57 | break; |
58 | |||
59 | case 'ps_code': | ||
60 | $obj->ds_names = array( | ||
61 | 'value' => 'TRS', | ||
62 | ); | ||
63 | $obj->colors = array( | ||
64 | 'value' => '0000ff', | ||
65 | ); | ||
66 | $obj->rrd_title = sprintf('Text Resident Set (%s)', $obj->args['pinstance']); | ||
67 | $obj->rrd_vertical = 'Bytes'; | ||
68 | $obj->rrd_format = '%5.1lf%s'; | ||
69 | break; | ||
70 | |||
71 | case 'ps_count': | ||
72 | $obj->data_sources = array('processes', 'threads'); | ||
73 | $obj->ds_names = array( | ||
74 | 'processes' => 'Processes', | ||
75 | 'threads' => 'Threads', | ||
76 | ); | ||
77 | $obj->colors = array( | ||
78 | 'processes' => '0000ff', | ||
79 | 'threads' => 'ff0000', | ||
80 | ); | ||
81 | $obj->rrd_title = sprintf('Number of Processes/Threads (%s)', $obj->args['pinstance']); | ||
82 | $obj->rrd_vertical = 'Amount'; | ||
83 | $obj->rrd_format = '%5.1lf%s'; | ||
84 | break; | ||
85 | |||
86 | case 'ps_cputime': | ||
87 | $obj->data_sources = array('user', 'syst'); | ||
88 | $obj->ds_names = array( | ||
89 | 'user' => 'User', | ||
90 | 'syst' => 'System', | ||
91 | ); | ||
92 | $obj->colors = array( | ||
93 | 'user' => '0000ff', | ||
94 | 'syst' => 'ff0000', | ||
95 | ); | ||
96 | $obj->rrd_title = sprintf('CPU time (%s)', $obj->args['pinstance']); | ||
97 | $obj->rrd_vertical = 'CPU time [s]'; | ||
98 | $obj->rrd_format = '%5.1lf%s'; | ||
99 | break; | ||
100 | |||
101 | case 'ps_disk_octets': | ||
102 | $obj->data_sources = array('read', 'write'); | ||
103 | $obj->ds_names = array( | ||
104 | 'read' => 'Read', | ||
105 | 'write' => 'Write', | ||
106 | ); | ||
107 | $obj->colors = array( | ||
108 | 'read' => '0000ff', | ||
109 | 'write' => '00b000', | ||
110 | ); | ||
111 | $obj->rrd_title = sprintf('Disk Traffic (%s)', $obj->args['pinstance']); | ||
112 | $obj->rrd_vertical = 'Bytes per second'; | ||
113 | $obj->rrd_format = '%5.1lf%s'; | ||
114 | break; | ||
115 | |||
116 | case 'ps_disk_ops': | ||
117 | $obj->data_sources = array('read', 'write'); | ||
118 | $obj->ds_names = array( | ||
119 | 'read' => 'Read', | ||
120 | 'write' => 'Write', | ||
121 | ); | ||
122 | $obj->colors = array( | ||
123 | 'read' => '0000ff', | ||
124 | 'write' => '00b000', | ||
125 | ); | ||
126 | $obj->rrd_title = sprintf('Disk Operations (%s)', $obj->args['pinstance']); | ||
127 | $obj->rrd_vertical = 'Ops per second'; | ||
128 | $obj->rrd_format = '%5.1lf%s'; | ||
129 | break; | ||
130 | |||
131 | case 'ps_data': | ||
132 | $obj->ds_names = array( | ||
133 | 'value' => 'DRS', | ||
134 | ); | ||
135 | $obj->colors = array( | ||
136 | 'value' => '0000ff', | ||
137 | ); | ||
138 | $obj->rrd_title = sprintf('Data Resident Set (%s)', $obj->args['pinstance']); | ||
139 | $obj->rrd_vertical = 'Bytes'; | ||
140 | $obj->rrd_format = '%5.1lf%s'; | ||
141 | break; | ||
142 | |||
143 | case 'ps_pagefaults': | ||
144 | $obj->data_sources = array('minflt', 'majflt'); | ||
145 | $obj->ds_names = array( | ||
146 | 'minflt' => 'Minor', | ||
147 | 'majflt' => 'Major', | ||
148 | ); | ||
149 | $obj->colors = array( | ||
150 | 'minflt' => 'ff0000', | ||
151 | 'majflt' => '0000ff', | ||
152 | ); | ||
153 | $obj->rrd_title = sprintf('PageFaults (%s)', $obj->args['pinstance']); | ||
154 | $obj->rrd_vertical = 'Pagefaults'; | ||
155 | $obj->rrd_format = '%5.1lf%s'; | ||
156 | break; | ||
157 | |||
158 | case 'ps_rss': | ||
159 | $obj->ds_names = array( | ||
160 | 'value' => 'RSS', | ||
161 | ); | ||
162 | $obj->colors = array( | ||
163 | 'value' => '0000ff', | ||
164 | ); | ||
165 | $obj->rrd_title = sprintf('Resident Segment Size (%s)', $obj->args['pinstance']); | ||
166 | $obj->rrd_vertical = 'Bytes'; | ||
167 | $obj->rrd_format = '%5.1lf%s'; | ||
168 | break; | ||
169 | |||
170 | case 'ps_stacksize': | ||
171 | $obj->ds_names = array( | ||
172 | 'value' => 'Stacksize', | ||
173 | ); | ||
174 | $obj->colors = array( | ||
175 | 'value' => '0000ff', | ||
176 | ); | ||
177 | $obj->rrd_title = sprintf('Stacksize (%s)', $obj->args['pinstance']); | ||
178 | $obj->rrd_vertical = 'Bytes'; | ||
179 | $obj->rrd_format = '%5.1lf%s'; | ||
180 | break; | ||
181 | |||
182 | case 'ps_vm': | ||
183 | $obj->ds_names = array( | ||
184 | 'value' => 'Memory', | ||
185 | ); | ||
186 | $obj->colors = array( | ||
187 | 'value' => '0000ff', | ||
188 | ); | ||
189 | $obj->rrd_title = sprintf('Virtual Memory (%s)', $obj->args['pinstance']); | ||
190 | $obj->rrd_vertical = 'Bytes'; | ||
191 | $obj->rrd_format = '%5.1lf%s'; | ||
192 | break; | ||
193 | |||
52 | } | 194 | } |
53 | 195 | ||
196 | |||
54 | collectd_flush($obj->identifiers); | 197 | collectd_flush($obj->identifiers); |
55 | $obj->rrd_graph(); | 198 | $obj->rrd_graph(); |
56 | 199 | ||