2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/. */
6 // RRD info for CPU info
8 $rrd_info['*']['graph']['path'] = 'graphs';
9 // $rrd_info['*']['page']['graph_url'] = 'http://127.0.0.1/testbed/rrd/';
10 $rrd_info['*']['graph']['units_length'] = 6;
11 // $rrd_info['*']['graph']['force_recreate'] = true;
13 $rrd_info['index']['page']['type'] = 'index';
14 // $rrd_info['index']['page']['index_ids'] = 'hd,-hd.root';
15 // $rrd_info['index']['page']['scan_config'] = false;
16 $rrd_info['index']['page']['scan_files'] = true;
17 $rrd_info['index']['hidden'] = true;
19 $rrd_info['overview']['page']['type'] = 'overview';
20 $rrd_info['overview']['page']['index_ids'] = 'cpu,cpu.frequency,load,temp,hd,mem|pct,eth0,connect,loopback,sensors.power|relpct,ping.gateway,rrdup';
21 $rrd_info['overview']['page']['scan_config'] = false;
22 $rrd_info['overview']['page']['text_intro'] = 'Go to the <a href="?stat=index">index page</a> for a full list of all available statistics. Also see <a href="?stat=cpu-overview">CPU</a> overview.';
23 // $rrd_info['overview']['hidden'] = true;
25 $rrd_info['cpu-overview']['page']['type'] = 'overview';
26 $rrd_info['cpu-overview']['page']['title_page'] = 'CPU statistics - total + per cpu core';
27 $rrd_info['cpu-overview']['page']['index_ids'] = 'cpu,cpu.frequency,cpu0,cpu1,cpu2,cpu3,cpu4,cpu5,cpu6,cpu7';
28 $rrd_info['cpu-overview']['page']['scan_config'] = false;
29 // $rrd_info['cpu-overview']['hidden'] = true;
31 $rrd_info['cpu']['file'] = 'system.cpu.rrd';
32 $rrd_info['cpu']['auto-update'] = true;
33 $rrd_info['cpu']['fields'][] = array('name' => 'user', 'type' => 'DERIVE', 'heartbeat' => 600, 'min' => 0, 'max' => 'U');
34 $rrd_info['cpu']['fields'][] = array('name' => 'nice', 'type' => 'DERIVE', 'heartbeat' => 600, 'min' => 0, 'max' => 'U');
35 $rrd_info['cpu']['fields'][] = array('name' => 'system', 'type' => 'DERIVE', 'heartbeat' => 600, 'min' => 0, 'max' => 'U');
36 $rrd_info['cpu']['fields'][] = array('name' => 'idle', 'type' => 'DERIVE', 'heartbeat' => 600, 'min' => 0, 'max' => 'U');
37 $rrd_info['cpu']['fields'][] = array('name' => 'iowait', 'type' => 'DERIVE', 'heartbeat' => 600, 'min' => 0, 'max' => 'U');
38 $rrd_info['cpu']['fields'][] = array('name' => 'irq', 'type' => 'DERIVE', 'heartbeat' => 600, 'min' => 0, 'max' => 'U');
39 $rrd_info['cpu']['fields'][] = array('name' => 'softirq', 'type' => 'DERIVE', 'heartbeat' => 600, 'min' => 0, 'max' => 'U');
40 $rrd_info['cpu']['fields'][] = array('name' => 'total', 'type' => 'DERIVE', 'heartbeat' => 600, 'min' => 0, 'max' => 'U');
41 $rrd_info['cpu']['update'] =
43 $udata = array("user"=>null,"nice"=>null,"system"=>null,"idle"=>null,
44 "iowait"=>null,"irq"=>null,"softirq"=>null, "total"=>null);
45 $sdata = file("/proc/stat");
46 foreach ($sdata as $sline) {
47 if (preg_match("/^\s*cpu\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/", $sline, $regs)) {
48 $udata = array("user"=>$regs[1],"nice"=>$regs[2],"system"=>$regs[3],"idle"=>$regs[4],
49 "iowait"=>$regs[5],"irq"=>$regs[6],"softirq"=>$regs[7],
50 "total"=>$regs[1]+$regs[2]+$regs[3]+$regs[4]+$regs[5]+$regs[6]+$regs[7]);
55 $rrd_info['cpu']['graph']['rows'][] = array('name'=>'total', 'gType'=>'');
56 $rrd_info['cpu']['graph']['rows'][] = array('name'=>'softirq_tmp', 'dsname'=>'softirq', 'gType'=>'');
57 $rrd_info['cpu']['graph']['rows'][] = array('name'=>'irq_tmp', 'dsname'=>'irq', 'gType'=>'');
58 $rrd_info['cpu']['graph']['rows'][] = array('name'=>'iowait_tmp', 'dsname'=>'iowait', 'gType'=>'');
59 $rrd_info['cpu']['graph']['rows'][] = array('name'=>'system_tmp', 'dsname'=>'system', 'gType'=>'');
60 $rrd_info['cpu']['graph']['rows'][] = array('name'=>'nice_tmp', 'dsname'=>'nice', 'gType'=>'');
61 $rrd_info['cpu']['graph']['rows'][] = array('name'=>'user_tmp', 'dsname'=>'user', 'gType'=>'');
62 $rrd_info['cpu']['graph']['rows'][] = array('dType'=>'CDEF', 'name'=>'softirq', 'rpn_expr'=>'softirq_tmp,total,/,100,*', 'gType'=>'AREA', 'color'=>'#CCCCCC', 'color_bg'=>'#606060', 'legend'=>'softIRQ');
63 $rrd_info['cpu']['graph']['rows'][] = array('dType'=>'CDEF', 'name'=>'irq', 'rpn_expr'=>'irq_tmp,total,/,100,*', 'gType'=>'AREA', 'color'=>'#808080', 'legend'=>'IRQ', 'stack'=>true);
64 $rrd_info['cpu']['graph']['rows'][] = array('dType'=>'CDEF', 'name'=>'iowait', 'rpn_expr'=>'iowait_tmp,total,/,100,*', 'gType'=>'AREA', 'color'=>'#FF00FF', 'legend'=>'I/O wait', 'stack'=>true);
65 $rrd_info['cpu']['graph']['rows'][] = array('dType'=>'CDEF', 'name'=>'system', 'rpn_expr'=>'system_tmp,total,/,100,*', 'gType'=>'AREA', 'color'=>'#FF0000', 'legend'=>'System', 'stack'=>true);
66 $rrd_info['cpu']['graph']['rows'][] = array('dType'=>'CDEF', 'name'=>'nice', 'rpn_expr'=>'nice_tmp,total,/,100,*', 'gType'=>'AREA', 'color'=>'#FFFF00', 'color_bg'=>'#606060', 'legend'=>'Nice', 'stack'=>true);
67 $rrd_info['cpu']['graph']['rows'][] = array('dType'=>'CDEF', 'name'=>'user', 'rpn_expr'=>'user_tmp,total,/,100,*', 'gType'=>'AREA', 'color'=>'#0000FF', 'legend'=>'User', 'stack'=>true);
68 $rrd_info['cpu']['graph']['units_length'] = 4;
69 $rrd_info['cpu']['graph']['label_y'] = '% CPU Usage';
70 $rrd_info['cpu']['graph']['min_y'] = 0;
71 $rrd_info['cpu']['graph']['max_y'] = 100;
72 $rrd_info['cpu']['graph']['fix_scale_y'] = true;
73 // $rrd_info['cpu']['graph']['force_recreate'] = true;
75 $rrd_info['cpu.frequency.proto']['hidden'] = true;
76 $rrd_info['cpu.frequency.proto']['auto-update'] = false;
77 $rrd_info['cpu.frequency.proto']['fields'][] = array('name' => 'cur_frequency', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
78 $rrd_info['cpu.frequency.proto']['fields'][] = array('name' => 'min_frequency', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
79 $rrd_info['cpu.frequency.proto']['fields'][] = array('name' => 'max_frequency', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
80 $rrd_info['cpu.frequency.proto']['graph']['rows'][] = array('name'=>'cur_frequency', 'gType'=>'LINE1', 'color'=>'#00CC00', 'legend'=>'Current');
81 $rrd_info['cpu.frequency.proto']['graph']['rows'][] = array('name'=>'min_frequency', 'gType'=>'LINE1', 'color'=>'#CCCCCC', 'legend'=>'Min');
82 $rrd_info['cpu.frequency.proto']['graph']['rows'][] = array('name'=>'max_frequency', 'gType'=>'LINE1', 'color'=>'#808080', 'legend'=>'Max');
83 $rrd_info['cpu.frequency.proto']['graph']['units_length'] = 5;
84 //$rrd_info['cpu.frequency.proto']['graph']['units_exponent'] = 0;
85 $rrd_info['cpu.frequency.proto']['graph']['scale'] = 1000;
86 $rrd_info['cpu.frequency.proto']['graph']['label_y'] = 'Hz';
87 $rrd_info['cpu.frequency.proto']['graph']['min_y'] = 0;
88 // $rrd_info['cpu.frequency.proto']['graph']['force_recreate'] = true;
90 for ($i = 0; $i < 8; $i++) {
91 $rrd_info['cpu'.$i] = $rrd_info['cpu'];
92 $rrd_info['cpu'.$i]['file'] = 'system.cpu'.$i.'.rrd';
93 $rrd_info['cpu'.$i]['update'] =
95 $udata = array("user"=>null,"nice"=>null,"system"=>null,"idle"=>null,
96 "iowait"=>null,"irq"=>null,"softirq"=>null, "total"=>null);
97 $sdata = file("/proc/stat");
98 foreach ($sdata as $sline) {
99 if (preg_match("/^\s*cpu'.$i.'\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/", $sline, $regs)) {
100 $udata = array("user"=>$regs[1],"nice"=>$regs[2],"system"=>$regs[3],"idle"=>$regs[4],
101 "iowait"=>$regs[5],"irq"=>$regs[6],"softirq"=>$regs[7],
102 "total"=>$regs[1]+$regs[2]+$regs[3]+$regs[4]+$regs[5]+$regs[6]+$regs[7]);
108 $rrd_info['cpu'.$i.'.frequency'] = $rrd_info['cpu.frequency.proto'];
109 $rrd_info['cpu'.$i.'.frequency']['hidden'] = false;
110 $rrd_info['cpu'.$i.'.frequency']['file'] = 'system.cpu'.$i.'.freq.rrd';
111 $rrd_info['cpu'.$i.'.frequency']['auto-update'] = true;
112 $rrd_info['cpu'.$i.'.frequency']['update'] =
114 $udata = array("cur_frequency"=>null,"min_frequency"=>null,"max_frequency"=>null);
116 $sdata = trim(file_get_contents("/sys/devices/system/cpu/cpu'.$i.'/cpufreq/cpuinfo_cur_freq"));
117 if (is_numeric($sdata)) { $udata["cur_frequency"] = intval($sdata); }
118 $sdata = trim(file_get_contents("/sys/devices/system/cpu/cpu'.$i.'/cpufreq/cpuinfo_min_freq"));
119 if (is_numeric($sdata)) { $udata["min_frequency"] = intval($sdata); }
120 $sdata = trim(file_get_contents("/sys/devices/system/cpu/cpu'.$i.'/cpufreq/cpuinfo_max_freq"));
121 if (is_numeric($sdata)) { $udata["max_frequency"] = intval($sdata); }
126 $rrd_info['cpu.frequency']['graph-only'] = true;
127 $rrd_info['cpu.frequency']['graph']['rows'][] = array('name'=>'freq_cpu0', 'dsname'=>'cur_frequency', 'dsfile'=>'system.cpu0.freq.rrd',
128 'gType'=>'LINE1', 'color'=>'#00CC00', 'legend'=>'CPU0');
129 $rrd_info['cpu.frequency']['graph']['rows'][] = array('name'=>'freq_cpu1', 'dsname'=>'cur_frequency', 'dsfile'=>'system.cpu1.freq.rrd',
130 'gType'=>'LINE1', 'color'=>'#008000', 'legend'=>'CPU1');
131 $rrd_info['cpu.frequency']['graph']['rows'][] = array('name'=>'freq_cpu2', 'dsname'=>'cur_frequency', 'dsfile'=>'system.cpu2.freq.rrd',
132 'gType'=>'LINE1', 'color'=>'#8080FF', 'legend'=>'CPU2');
133 $rrd_info['cpu.frequency']['graph']['rows'][] = array('name'=>'freq_cpu3', 'dsname'=>'cur_frequency', 'dsfile'=>'system.cpu3.freq.rrd',
134 'gType'=>'LINE1', 'color'=>'#0000FF', 'legend'=>'CPU3');
135 $rrd_info['cpu.frequency']['graph']['rows'][] = array('name'=>'freq_cpu4', 'dsname'=>'cur_frequency', 'dsfile'=>'system.cpu4.freq.rrd',
136 'gType'=>'LINE1', 'color'=>'#FF8080', 'legend'=>'CPU4');
137 $rrd_info['cpu.frequency']['graph']['rows'][] = array('name'=>'freq_cpu5', 'dsname'=>'cur_frequency', 'dsfile'=>'system.cpu5.freq.rrd',
138 'gType'=>'LINE1', 'color'=>'#FFCCCC', 'legend'=>'CPU5');
139 $rrd_info['cpu.frequency']['graph']['rows'][] = array('name'=>'freq_cpu6', 'dsname'=>'cur_frequency', 'dsfile'=>'system.cpu6.freq.rrd',
140 'gType'=>'LINE1', 'color'=>'#CCCCCC', 'legend'=>'CPU6');
141 $rrd_info['cpu.frequency']['graph']['rows'][] = array('name'=>'freq_cpu7', 'dsname'=>'cur_frequency', 'dsfile'=>'system.cpu7.freq.rrd',
142 'gType'=>'LINE1', 'color'=>'#808080', 'legend'=>'CPU7');
143 $rrd_info['cpu.frequency']['graph']['units_length'] = 5;
144 //$rrd_info['cpu.frequency']['graph']['units_exponent'] = 0;
145 $rrd_info['cpu.frequency']['graph']['scale'] = 1000;
146 $rrd_info['cpu.frequency']['graph']['label_y'] = 'Hz';
147 $rrd_info['cpu.frequency']['graph']['min_y'] = 0;
148 // $rrd_info['cpu.frequency']['graph']['force_recreate'] = true;
150 $rrd_info['cpu.coretemp']['file'] = 'cpu.coretemp.rrd';
151 $rrd_info['cpu.coretemp']['auto-update'] = true;
152 $rrd_info['cpu.coretemp']['fields'][] = array('name' => 'core0_temp', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
153 $rrd_info['cpu.coretemp']['fields'][] = array('name' => 'core1_temp', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
154 $rrd_info['cpu.coretemp']['fields'][] = array('name' => 'core2_temp', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
155 $rrd_info['cpu.coretemp']['fields'][] = array('name' => 'core3_temp', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
156 $rrd_info['cpu.coretemp']['update'] =
158 $udata = array("core0_temp"=>null,"core1_temp"=>null);
159 $sdata = explode("\n", `/usr/bin/sensors -A coretemp-isa-*`);
160 foreach ($sdata as $sline) {
161 if (preg_match("/Core 0:\s+([+-]?[\d\.]+).+?C/i", $sline, $regs)) {
162 $udata["core0_temp"] = $regs[1];
164 elseif (preg_match("/Core 1:\s+([+-]?[\d\.]+).+?C/i", $sline, $regs)) {
165 $udata["core1_temp"] = $regs[1];
167 elseif (preg_match("/Core 2:\s+([+-]?[\d\.]+).+?C/i", $sline, $regs)) {
168 $udata["core2_temp"] = $regs[1];
170 elseif (preg_match("/Core 3:\s+([+-]?[\d\.]+).+?C/i", $sline, $regs)) {
171 $udata["core3_temp"] = $regs[1];
176 $rrd_info['cpu.coretemp']['graph']['rows'][] = array('name'=>'core0_temp', 'gType'=>'LINE1', 'color'=>'#80CC80', 'legend'=>'Core 0 Temp');
177 $rrd_info['cpu.coretemp']['graph']['rows'][] = array('name'=>'core1_temp', 'gType'=>'LINE1', 'color'=>'#8080CC', 'legend'=>'Core 1 Temp');
178 $rrd_info['cpu.coretemp']['graph']['rows'][] = array('name'=>'core2_temp', 'gType'=>'LINE1', 'color'=>'#CC8080', 'legend'=>'Core 2 Temp');
179 $rrd_info['cpu.coretemp']['graph']['rows'][] = array('name'=>'core3_temp', 'gType'=>'LINE1', 'color'=>'#808080', 'legend'=>'Core 3 Temp');
180 $rrd_info['cpu.coretemp']['graph']['units_length'] = 4;
181 $rrd_info['cpu.coretemp']['graph']['label_y'] = '°C';
182 // $rrd_info['cpu.coretemp']['graph']['max_y'] = 13;
183 // $rrd_info['cpu.coretemp']['graph']['min_y'] = -13;
185 $rrd_info['mem']['file'] = 'system.mem.rrd';
186 $rrd_info['mem']['auto-update'] = true;
187 $rrd_info['mem']['fields'][] = array('name' => 'total', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
188 $rrd_info['mem']['fields'][] = array('name' => 'used', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
189 $rrd_info['mem']['fields'][] = array('name' => 'buffers', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
190 $rrd_info['mem']['fields'][] = array('name' => 'cached', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
191 $rrd_info['mem']['fields'][] = array('name' => 'swap_total', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
192 $rrd_info['mem']['fields'][] = array('name' => 'swap_used', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
193 $rrd_info['mem']['update'] =
195 $sdata = explode("\n", `/usr/bin/free -wb`);
196 $udata = array("total"=>null,"used"=>null,"buffers"=>null,"cached"=>null,
197 "swap_total"=>null,"swap_used"=>null);
198 foreach ($sdata as $sline) {
199 if (preg_match("/Mem:\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/", $sline, $regs)) {
200 $udata["total"] = $regs[1];
201 $udata["used"] = $regs[2];
202 $udata["buffers"] = $regs[5];
203 $udata["cached"] = $regs[6];
205 elseif (preg_match("/Swap:\s+(\d+)\s+(\d+)\s+(\d+)/", $sline, $regs)) {
206 $udata["swap_total"] = $regs[1];
207 $udata["swap_used"] = $regs[2];
212 $rrd_info['mem']['graph']['rows'][] = array('name'=>'total', 'gType'=>'LINE1', 'color'=>'#000000', 'legend'=>'Available');
213 $rrd_info['mem']['graph']['rows'][] = array('name'=>'used', 'gType'=>'AREA', 'color'=>'#0000FF', 'legend'=>'Used');
214 $rrd_info['mem']['graph']['rows'][] = array('name'=>'buffers', 'gType'=>'AREA', 'color'=>'#FFFF00', 'legend'=>'Buffers', 'stack'=>true);
215 $rrd_info['mem']['graph']['rows'][] = array('name'=>'cached', 'gType'=>'AREA', 'color'=>'#008000', 'legend'=>'Cache', 'stack'=>true);
216 $rrd_info['mem']['graph']['rows'][] = array('name'=>'swap_total', 'gType'=>'LINE1', 'color'=>'#CCCCCC', 'legend'=>'Swap avail.');
217 $rrd_info['mem']['graph']['rows'][] = array('name'=>'swap_used', 'gType'=>'LINE2', 'color'=>'#00FFFF', 'legend'=>'Swap used');
218 $rrd_info['mem']['graph']['units_binary'] = true;
219 $rrd_info['mem']['graph']['units_exponent'] = 6;
220 $rrd_info['mem']['graph']['units_length'] = 6;
221 $rrd_info['mem']['graph']['label_y'] = 'Memory';
222 $rrd_info['mem']['graph']['min_y'] = 0;
223 // $rrd_info['mem']['graph']['max_y'] = 100;
224 // $rrd_info['mem']['graph']['fix_scale_y'] = true;
225 // $rrd_info['mem']['graph']['force_recreate'] = true;
226 $rrd_info['mem']['graph.pct']['rows'][] = array('name'=>'total', 'gType'=>'');
227 $rrd_info['mem']['graph.pct']['rows'][] = array('name'=>'swap_total', 'gType'=>'');
228 $rrd_info['mem']['graph.pct']['rows'][] = array('name'=>'used_tmp', 'dsname'=>'used', 'gType'=>'');
229 $rrd_info['mem']['graph.pct']['rows'][] = array('name'=>'buffers_tmp', 'dsname'=>'buffers', 'gType'=>'');
230 $rrd_info['mem']['graph.pct']['rows'][] = array('name'=>'cached_tmp', 'dsname'=>'cached', 'gType'=>'');
231 $rrd_info['mem']['graph.pct']['rows'][] = array('name'=>'swap_tmp', 'dsname'=>'swap_used', 'gType'=>'');
232 $rrd_info['mem']['graph.pct']['rows'][] = array('dType'=>'CDEF', 'name'=>'used', 'rpn_expr'=>'used_tmp,total,/,100,*', 'gType'=>'AREA', 'color'=>'#0000FF', 'legend'=>'Used');
233 $rrd_info['mem']['graph.pct']['rows'][] = array('dType'=>'CDEF', 'name'=>'buffers', 'rpn_expr'=>'buffers_tmp,total,/,100,*', 'gType'=>'AREA', 'color'=>'#FFFF00', 'legend'=>'Buffers', 'stack'=>true);
234 $rrd_info['mem']['graph.pct']['rows'][] = array('dType'=>'CDEF', 'name'=>'cached', 'rpn_expr'=>'cached_tmp,total,/,100,*', 'gType'=>'AREA', 'color'=>'#008000', 'legend'=>'Cache', 'stack'=>true);
235 $rrd_info['mem']['graph.pct']['rows'][] = array('dType'=>'CDEF', 'name'=>'swap_used', 'rpn_expr'=>'swap_tmp,swap_total,/,100,*', 'gType'=>'LINE2', 'color'=>'#00FFFF', 'legend'=>'Swap');
236 $rrd_info['mem']['graph.pct']['units_exponent'] = 0;
237 $rrd_info['mem']['graph.pct']['units_length'] = 4;
238 $rrd_info['mem']['graph.pct']['label_y'] = '% Memory';
239 $rrd_info['mem']['graph.pct']['min_y'] = 0;
240 $rrd_info['mem']['graph.pct']['max_y'] = 100;
241 $rrd_info['mem']['graph.pct']['fix_scale_y'] = true;
242 // $rrd_info['mem']['graph.pct']['force_recreate'] = true;
243 $rrd_info['mem']['page.pct']['graph_sub'] = 'pct';
245 $rrd_info['load']['file'] = 'system.load.rrd';
246 $rrd_info['load']['auto-update'] = true;
247 $rrd_info['load']['fields'][] = array('name' => 'load1', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
248 $rrd_info['load']['fields'][] = array('name' => 'load5', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
249 $rrd_info['load']['fields'][] = array('name' => 'load15', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
250 $rrd_info['load']['update'] = 'function { $sdata = explode(" ",file_get_contents("/proc/loadavg")); return array("load1"=>$sdata[0],"load5"=>$sdata[1],"load15"=>$sdata[2]); }';
251 $rrd_info['load']['graph']['rows'][] = array('name'=>'load1', 'gType'=>'AREA', 'color'=>'#00CC00', 'legend'=>'1 Min.');
252 $rrd_info['load']['graph']['rows'][] = array('name'=>'load5', 'gType'=>'LINE1', 'color'=>'#FF4000', 'legend'=>'5 Min.');
253 $rrd_info['load']['graph']['rows'][] = array('name'=>'load15', 'gType'=>'LINE1', 'color'=>'#0000FF', 'legend'=>'15 Min.');
254 $rrd_info['load']['graph']['units_length'] = 4;
255 $rrd_info['load']['graph']['units_exponent'] = 0;
256 $rrd_info['load']['graph']['label_y'] = 'Load average';
257 $rrd_info['load']['graph']['min_y'] = 0;
258 // $rrd_info['load']['graph']['force_recreate'] = true;
259 $rrd_info['load']['page']['data_colorize'] = true;
261 $rrd_info['hd']['graph-only'] = true;
262 $rrd_info['hd']['graph']['rows'][] = array('name'=>'boot_used', 'dsname'=>'used', 'dsfile'=>'hd.boot.rrd', 'gType'=>'',);
263 $rrd_info['hd']['graph']['rows'][] = array('name'=>'boot_total', 'dsname'=>'total', 'dsfile'=>'hd.boot.rrd', 'gType'=>'');
264 $rrd_info['hd']['graph']['rows'][] = array('name'=>'root_used', 'dsname'=>'used', 'dsfile'=>'hd.root.rrd', 'gType'=>'',);
265 $rrd_info['hd']['graph']['rows'][] = array('name'=>'root_total', 'dsname'=>'total', 'dsfile'=>'hd.root.rrd', 'gType'=>'');
266 $rrd_info['hd']['graph']['rows'][] = array('name'=>'home_used', 'dsname'=>'used', 'dsfile'=>'hd.home.rrd', 'gType'=>'',);
267 $rrd_info['hd']['graph']['rows'][] = array('name'=>'home_total', 'dsname'=>'total', 'dsfile'=>'hd.home.rrd', 'gType'=>'');
268 $rrd_info['hd']['graph']['rows'][] = array('dType'=>'CDEF', 'name'=>'boot', 'rpn_expr'=>'boot_used,boot_total,/,100,*',
269 'gType'=>'LINE1', 'color'=>'#808080', 'legend'=>'Boot');
270 $rrd_info['hd']['graph']['rows'][] = array('dType'=>'CDEF', 'name'=>'root', 'rpn_expr'=>'root_used,root_total,/,100,*',
271 'gType'=>'LINE1', 'color'=>'#0000FF', 'legend'=>'Root');
272 $rrd_info['hd']['graph']['rows'][] = array('dType'=>'CDEF', 'name'=>'home', 'rpn_expr'=>'home_used,home_total,/,100,*',
273 'gType'=>'LINE1', 'color'=>'#00E000', 'legend'=>'Home');
274 // $rrd_info['hd.root']['graph']['units_length'] = 4;
275 $rrd_info['hd']['graph']['label_y'] = '% Used';
276 $rrd_info['hd']['graph']['units_exponent'] = 0;
277 $rrd_info['hd']['graph']['units_length'] = 4;
278 $rrd_info['hd']['graph']['min_y'] = 0;
279 $rrd_info['hd']['graph']['max_y'] = 100;
280 $rrd_info['hd']['graph']['fix_scale_y'] = true;
281 // $rrd_info['hd']['graph']['force_recreate'] = true;
282 $rrd_info['hd']['page']['show_update'] = false;
284 // Every other HD config section copies from this definition
285 $rrd_info['hd.root']['file'] = 'hd.root.rrd';
286 $rrd_info['hd.root']['auto-update'] = true;
287 $rrd_info['hd.root']['fields'][] = array('name' => 'used', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
288 $rrd_info['hd.root']['fields'][] = array('name' => 'total', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
289 $rrd_info['hd.new.root']['update'] =
291 $sdata = explode("\n", `/bin/df -k -l`); $udata = array();
292 foreach ($sdata as $sline) {
293 if (preg_match("/(\d+)\s+(\d+)\s+\d+\s+\d+%\s+\/$/", $sline, $regs)) {
294 $udata = array("total"=>$regs[1], "used"=>$regs[2]);
299 $rrd_info['hd.root']['graph']['rows'][] = array('name'=>'used', 'gType'=>'AREA', 'color'=>'#00CC00', 'legend'=>'Used');
300 $rrd_info['hd.root']['graph']['rows'][] = array('name'=>'total', 'gType'=>'LINE1', 'color'=>'#808080', 'legend'=>'Available');
301 // $rrd_info['hd.root']['graph']['units_length'] = 4;
302 $rrd_info['hd.root']['graph']['label_y'] = 'Bytes';
303 $rrd_info['hd.root']['graph']['units_binary'] = true;
304 $rrd_info['hd.root']['graph']['scale'] = 1024;
305 $rrd_info['hd.root']['graph']['min_y'] = 0;
306 // $rrd_info['hd.root']['graph']['force_recreate'] = true;
308 $rrd_info['hd.boot'] = $rrd_info['hd.root'];
309 $rrd_info['hd.boot']['file'] = 'hd.boot.rrd';
310 $rrd_info['hd.boot']['update'] =
312 $sdata = explode("\n", `/bin/df -k -l`); $udata = array();
313 foreach ($sdata as $sline) {
314 if (preg_match("/(\d+)\s+(\d+)\s+\d+\s+\d+%\s+\/boot$/", $sline, $regs)) {
315 $udata = array("total"=>$regs[1], "used"=>$regs[2]);
320 // $rrd_info['hd.boot']['graph']['force_recreate'] = true;
322 $rrd_info['hd.home'] = $rrd_info['hd.root'];
323 $rrd_info['hd.home']['file'] = 'hd.home.rrd';
324 $rrd_info['hd.home']['update'] =
326 $sdata = explode("\n", `/bin/df -k -l`); $udata = array();
327 foreach ($sdata as $sline) {
328 if (preg_match("/(\d+)\s+(\d+)\s+\d+\s+\d+%\s+\/home$/", $sline, $regs)) {
329 $udata = array("total"=>$regs[1], "used"=>$regs[2]);
334 // $rrd_info['hd.home']['graph']['force_recreate'] = true;
337 $rrd_info['hd.btrfs.root']['file'] = 'hd.btrfs.root.rrd';
338 $rrd_info['hd.btrfs.root']['auto-update'] = true;
339 $rrd_info['hd.btrfs.root']['fields'][] = array('name' => 'total', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
340 $rrd_info['hd.btrfs.root']['fields'][] = array('name' => 'used_bytes', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
341 $rrd_info['hd.btrfs.root']['fields'][] = array('name' => 'used_fs', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
342 $rrd_info['hd.btrfs.root']['update'] =
344 $sdata = explode("\n", `btrfs fi show f00dbeef-f51d-b33f-f00d-beeff00df51d`);
345 $udata = array("total"=>null,"used_bytes"=>null,"used_fs"=>null);
346 $hdata = array("total"=>null,"used_bytes"=>null,"used_fs"=>null);
347 foreach ($sdata as $sline) {
348 if (preg_match("/\s+devid\s+1\ssize\s([\d\.]+(?:GiB|MiB|KiB|B))\sused\s([\d\.]+(?:GiB|MiB|KiB|B))\spath\s\//", $sline, $regs)) {
349 $hdata["total"] = $regs[1]; $hdata["used_fs"] = $regs[2]; }
350 if (preg_match("/\s+Total\sdevices\s1\sFS\sbytes\sused\s([\d\.]+(?:GiB|MiB|KiB|B))/", $sline, $regs)) { $hdata["used_bytes"] = $regs[1]; }
352 foreach ($hdata as $key=>$sizestring) {
353 if (preg_match("/^([\d\.]+)(GiB|MiB|KiB|B)$/", $sizestring, $regs)) {
354 if ($regs[2] == "GiB") { $udata[$key] = $regs[1] * 1024 * 1024 * 1024; }
355 elseif ($regs[2] == "MiB") { $udata[$key] = $regs[1] * 1024 * 1024; }
356 elseif ($regs[2] == "KiB") { $udata[$key] = $regs[1] * 1024; }
357 elseif ($regs[2] == "B") { $udata[$key] = $regs[1]; }
362 $rrd_info['hd.btrfs.root']['graph']['rows'][] = array('name'=>'used_fs', 'gType'=>'AREA', 'color'=>'#FF8080', 'legend'=>'Used/FS');
363 $rrd_info['hd.btrfs.root']['graph']['rows'][] = array('name'=>'used_bytes', 'gType'=>'AREA', 'color'=>'#00CC00', 'legend'=>'Used/Bytes');
364 $rrd_info['hd.btrfs.root']['graph']['rows'][] = array('name'=>'total', 'gType'=>'LINE1', 'color'=>'#808080', 'legend'=>'Total');
365 // $rrd_info['hd.btrfs.root']['graph']['units_length'] = 4;
366 $rrd_info['hd.btrfs.root']['graph']['label_y'] = 'Bytes';
367 $rrd_info['hd.btrfs.root']['graph']['units_binary'] = true;
368 $rrd_info['hd.btrfs.root']['graph']['min_y'] = 0;
369 // $rrd_info['hd.btrfs.root']['graph']['force_recreate'] = true;
371 $rrd_info['hdd.smart.rotdisk']['file'] = 'hdd.smart.rotdisk.rrd';
372 $rrd_info['hdd.smart.rotdisk']['auto-update'] = true;
373 $rrd_info['hdd.smart.rotdisk']['fields'][] = array('name' => 'load_cycle', 'type' => 'COUNTER', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
374 $rrd_info['hdd.smart.rotdisk']['fields'][] = array('name' => 'start_stop', 'type' => 'COUNTER', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
375 $rrd_info['hdd.smart.rotdisk']['fields'][] = array('name' => 'power_cycle', 'type' => 'COUNTER', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
376 $rrd_info['hdd.smart.rotdisk']['fields'][] = array('name' => 'temp', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
377 $rrd_info['hdd.smart.rotdisk']['update'] =
379 $sdata = explode("\n", `smartctl -A /dev/disk/by-id/ata-WHATEVER-THE_DISK-ID`);
380 $udata = array("load_cycle"=>null,"start_stop"=>null,"power_cycle"=>null,"temp"=>null);
381 foreach ($sdata as $sline) {
382 if (preg_match("/Load_Cycle_Count\s.+-\s+([\d]+)/", $sline, $regs)) { $udata["load_cycle"] = $regs[1]; }
383 if (preg_match("/Start_Stop_Count\s.+-\s+([\d]+)/", $sline, $regs)) { $udata["start_stop"] = $regs[1]; }
384 if (preg_match("/Power_Cycle_Count\s.+-\s+([\d]+)/", $sline, $regs)) { $udata["power_cycle"] = $regs[1]; }
385 if (preg_match("/Temperature_Celsius\s.+-\s+([\d\.]+)/", $sline, $regs)) { $udata["temp"] = $regs[1]; }
389 $rrd_info['hdd.smart.rotdisk']['graph']['rows'][] = array('name'=>'load_cycle', 'gType'=>'LINE1', 'color'=>'#000000',
390 'legend'=>'Load cycle');
391 $rrd_info['hdd.smart.rotdisk']['graph']['rows'][] = array('name'=>'start_stop', 'gType'=>'LINE1', 'color'=>'#0000FF',
392 'legend'=>'Start-Stop');
393 $rrd_info['hdd.smart.rotdisk']['graph']['rows'][] = array('name'=>'power_cycle', 'gType'=>'LINE1', 'color'=>'#008000',
394 'legend'=>'Power cycle');
395 $rrd_info['hdd.smart.rotdisk']['graph']['rows'][] = array('name'=>'temp', 'gType'=>'LINE1', 'color'=>'#FF0000',
396 'legend'=>'Temperature');
397 $rrd_info['hdd.smart.rotdisk']['graph']['units_length'] = 4;
398 $rrd_info['hdd.smart.rotdisk']['graph']['label_y'] = 'units';
399 // $rrd_info['hdd.smart.rotdisk']['graph']['max_y'] = 13;
400 // $rrd_info['hdd.smart.rotdisk']['graph']['min_y'] = -13;
401 // $rrd_info['hdd.smart.rotdisk']['graph']['force_recreate'] = true;
404 $rrd_info['eth0']['file'] = 'net.eth0.rrd';
405 $rrd_info['eth0']['auto-update'] = true;
406 $rrd_info['eth0']['fields'][] = array('name'=>'incoming', 'type'=>'COUNTER',
407 'heartbeat'=>600, 'min'=>'U', 'max'=>'U', 'update'=>'snmp-if:eth0:in', 'legend'=>'Incoming');
408 $rrd_info['eth0']['fields'][] = array('name'=>'outgoing', 'type'=>'COUNTER',
409 'heartbeat'=>600, 'min'=>'U', 'max'=>'U', 'update'=>'snmp-if:eth0:out', 'legend'=>'Outgoing');
410 $rrd_info['eth0']['graph']['label_y'] = 'Bytes per second';
411 // $rrd_info['eth0']['graph']['force_recreate'] = true;
413 $rrd_info['connect']['file'] = 'net.connect.rrd';
414 $rrd_info['connect']['auto-update'] = true;
415 $rrd_info['connect']['fields'][] = array('name' => 'listen', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
416 $rrd_info['connect']['fields'][] = array('name' => 'run_http', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
417 $rrd_info['connect']['fields'][] = array('name' => 'run_other', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
418 $rrd_info['connect']['fields'][] = array('name' => 'rest_http', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
419 $rrd_info['connect']['fields'][] = array('name' => 'rest_other', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
420 $rrd_info['connect']['fields'][] = array('name' => 'udp', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
421 $rrd_info['connect']['update'] =
423 $sdata = explode("\n", `LANG=C /bin/netstat -n -a`);
424 $udata = array("listen"=>0,"run_http"=>0,"run_other"=>0,"rest_http"=>0,"rest_other"=>0,"udp"=>0);
425 foreach ($sdata as $sline) {
426 if (substr($sline, 0, 3) == "tcp") {
427 if (preg_match("/LISTEN\s*$/", $sline)) { $udata["listen"]++; }
428 elseif (preg_match("/:(80|443)\s+[\d\.:*]+\s+ESTABLISHED\s*/", $sline)) { $udata["run_http"]++; }
429 elseif (preg_match("/^tcp\s+\d+\s+\d+\s+[\d\.]+:(80|443)/", $sline)) { $udata["rest_http"]++; }
430 elseif (preg_match("/ESTABLISHED\s*$/", $sline)) { $udata["run_other"]++; }
431 else { $udata["rest_other"]++; }
433 elseif (substr($sline, 0, 3) == "udp") { $udata["udp"]++; }
437 $rrd_info['connect']['graph']['rows'][] = array('name'=>'listen', 'gType'=>'AREA', 'color'=>'#CCCCCC', 'color_bg'=>'#606060',
438 'legend'=>'LISTEN', 'legend_long'=>'LISTEN-Verbindungen');
439 $rrd_info['connect']['graph']['rows'][] = array('name'=>'run_http', 'gType'=>'AREA', 'color'=>'#0000FF',
440 'legend'=>'HTTPconn', 'legend_long'=>'Aktive HTTP-Verbindungen', 'stack'=>true);
441 $rrd_info['connect']['graph']['rows'][] = array('name'=>'rest_http', 'gType'=>'AREA', 'color'=>'#8080FF',
442 'legend'=>'HTTPwait', 'legend_long'=>'Wartende HTTP-Verbindungen', 'stack'=>true);
443 $rrd_info['connect']['graph']['rows'][] = array('name'=>'run_other', 'gType'=>'AREA', 'color'=>'#FF0000',
444 'legend'=>'TCPconn', 'legend_long'=>'Aktive TCP-Verbindungen (außer HTTP)', 'stack'=>true);
445 $rrd_info['connect']['graph']['rows'][] = array('name'=>'rest_other', 'gType'=>'AREA', 'color'=>'#FF8080',
446 'legend'=>'TCPwait', 'legend_long'=>'Wartende TCP-Verbindungen (außer HTTP)', 'stack'=>true);
447 $rrd_info['connect']['graph']['rows'][] = array('name'=>'udp', 'gType'=>'AREA', 'color'=>'#00CC00',
448 'legend'=>'UDP', 'legend_long'=>'UDP-Verbindungen', 'stack'=>true);
449 $rrd_info['connect']['graph']['units_length'] = 4;
450 $rrd_info['connect']['graph']['label_y'] = 'Network Sockets';
451 $rrd_info['connect']['graph']['min_y'] = 0;
452 // $rrd_info['connect']['graph']['force_recreate'] = true;
454 $rrd_info['process']['file'] = 'system.process.rrd';
455 $rrd_info['process']['auto-update'] = true;
456 $rrd_info['process']['fields'][] = array('name' => 'ps_httpd', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
457 $rrd_info['process']['fields'][] = array('name' => 'ps_other', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
458 $rrd_info['process']['fields'][] = array('name' => 'psnum', 'type' => 'DERIVE', 'heartbeat' => 600, 'min' => 0, 'max' => 'U');
459 $rrd_info['process']['update'] =
461 $sdata = explode("\n", `LANG=C /bin/ps -e`);
462 $udata = array("ps_httpd"=>0,"ps_other"=>0);
463 foreach ($sdata as $sline) {
464 if (strpos($sline, "httpd-prefork")) { $udata["ps_httpd"]++; }
465 else { $udata["ps_other"]++; }
467 $udata["psnum"] = posix_getpid();
470 $rrd_info['process']['graph']['rows'][] = array('name'=>'ps_httpd', 'gType'=>'AREA', 'color'=>'#0000FF', 'legend'=>'HTTP');
471 $rrd_info['process']['graph']['rows'][] = array('name'=>'ps_other', 'gType'=>'AREA', 'color'=>'#FF0000', 'legend'=>'other', 'stack'=>true);
472 $rrd_info['process']['graph']['rows'][] = array('name'=>'psnum', 'scale'=>3.6, 'gType'=>'LINE1', 'color'=>'#00CC00', 'legend'=>'k ps/hour');
473 $rrd_info['process']['graph']['label_y'] = 'Processes';
474 $rrd_info['process']['graph']['min_y'] = 0;
475 // $rrd_info['process']['graph']['force_recreate'] = true;
476 $rrd_info['process']['graph.ps']['rows'][] = array('name'=>'ps_httpd', 'gType'=>'AREA', 'color'=>'#0000FF', 'legend'=>'HTTP');
477 $rrd_info['process']['graph.ps']['rows'][] = array('name'=>'ps_other', 'gType'=>'AREA', 'color'=>'#FF0000', 'legend'=>'other', 'stack'=>true);
478 $rrd_info['process']['graph.ps']['label_y'] = 'Processes';
479 $rrd_info['process']['graph.ps']['min_y'] = 0;
480 // $rrd_info['process']['graph.ps']['force_recreate'] = true;
481 $rrd_info['process']['page.ps']['graph_sub'] = 'ps';
482 $rrd_info['process']['graph.pi']['rows'][] = array('name'=>'psnum', 'scale'=>3600, 'gType'=>'LINE1', 'color'=>'#000000', 'legend'=>'started processes per hour');
483 $rrd_info['process']['graph.pi']['label_y'] = '';
484 $rrd_info['process']['graph.pi']['min_y'] = 0;
485 // $rrd_info['process']['graph.pi']['force_recreate'] = true;
486 $rrd_info['process']['page.pi']['graph_sub'] = 'pi';
488 $rrd_info['temp']['graph-only'] = true;
489 $rrd_info['temp']['graph']['rows'][] = array('name'=>'core0_temp', 'dsfile'=>'cpu.coretemp.rrd', 'gType'=>'LINE1',
490 'color'=>'#606060', 'legend'=>'C0', 'legend_long'=>'CPU Core 0 internal sensor');
491 $rrd_info['temp']['graph']['rows'][] = array('name'=>'core1_temp', 'dsfile'=>'cpu.coretemp.rrd', 'gType'=>'LINE1',
492 'color'=>'#808080', 'legend'=>'C1', 'legend_long'=>'CPU Core 1 internal sensor');
493 $rrd_info['temp']['graph']['rows'][] = array('name'=>'core2_temp', 'dsfile'=>'cpu.coretemp.rrd', 'gType'=>'LINE1',
494 'color'=>'#A0A0A0', 'legend'=>'C2', 'legend_long'=>'CPU Core 2 internal sensor');
495 $rrd_info['temp']['graph']['rows'][] = array('name'=>'core3_temp', 'dsfile'=>'cpu.coretemp.rrd', 'gType'=>'LINE1',
496 'color'=>'#C0C0C0', 'legend'=>'C3', 'legend_long'=>'CPU Core 3 internal sensor');
497 $rrd_info['temp']['graph']['rows'][] = array('name'=>'cpu_temp', 'dsfile'=>'sensors.temp.rrd', 'gType'=>'LINE1',
498 'color'=>'#000000', 'legend'=>'CPU', 'legend_long'=>'CPU sensor');
499 $rrd_info['temp']['graph']['rows'][] = array('name'=>'mb_temp', 'dsfile'=>'sensors.temp.rrd', 'gType'=>'LINE1',
500 'color'=>'#008000', 'legend'=>'SYS', 'legend_long'=>'Mainboard/system sensor');
501 $rrd_info['temp']['graph']['rows'][] = array('name'=>'rotdisk_temp', 'dsname'=>'temp', 'dsfile'=>'hdd.smart.rotdisk.rrd', 'gType'=>'LINE1',
502 'color'=>'#FFB000', 'legend'=>'WDblack', 'legend_long'=>'Harddisk');
503 $rrd_info['temp']['graph']['label_y'] = '°C';
504 $rrd_info['temp']['graph']['units_exponent'] = 0;
505 $rrd_info['temp']['graph']['units_length'] = 4;
506 //$rrd_info['temp']['graph']['min_y'] = 0;
507 //$rrd_info['temp']['graph']['max_y'] = 100;
508 //$rrd_info['temp']['graph']['fix_scale_y'] = true;
509 // $rrd_info['temp']['graph']['force_recreate'] = true;
510 $rrd_info['temp']['page']['show_update'] = false;
512 $rrd_info['ping.gateway']['file'] = 'net.ping.gateway.rrd';
513 $rrd_info['ping.gateway']['auto-update'] = true;
514 $rrd_info['ping.gateway']['fields'][] = array('name' => 'single_min', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 0, 'max' => 'U');
515 $rrd_info['ping.gateway']['fields'][] = array('name' => 'single_avg', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 0, 'max' => 'U');
516 $rrd_info['ping.gateway']['fields'][] = array('name' => 'single_max', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 0, 'max' => 'U');
517 $rrd_info['ping.gateway']['fields'][] = array('name' => 'single_loss', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 0, 'max' => 100);
518 $rrd_info['ping.gateway']['fields'][] = array('name' => 'flood_min', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 0, 'max' => 'U');
519 $rrd_info['ping.gateway']['fields'][] = array('name' => 'flood_avg', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 0, 'max' => 'U');
520 $rrd_info['ping.gateway']['fields'][] = array('name' => 'flood_max', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 0, 'max' => 'U');
521 $rrd_info['ping.gateway']['fields'][] = array('name' => 'flood_loss', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 0, 'max' => 100);
522 $rrd_info['ping.gateway']['update'] =
524 $pinghost = "10.0.0.1"; $pingnum = 20;
526 $sdata["single"] = explode("\n", `LANG=C /usr/bin/ping -q -c $pingnum -w 90 $pinghost 2>/dev/null`);
527 $sdata["flood"] = explode("\n", `LANG=C /usr/bin/ping -qf -c $pingnum -w 30 $pinghost 2>/dev/null`);
528 $udata = array("single_min"=>0,"single_avg"=>0,"single_max"=>0,"single_loss"=>100,
529 "flood_min"=>0,"flood_avg"=>0,"flood_max"=>0,"flood_loss"=>100);
530 foreach (array("single","flood") as $mode) {
531 foreach ($sdata[$mode] as $sline) {
532 if (preg_match("/(\d+)% (?:packet )?loss/", $sline, $regs)) { $udata[$mode."_loss"] = $regs[1]; }
533 elseif (preg_match("/min\/avg\/max(?:\/mdev)? = ([\d\.]+)\/([\d\.]+)\/([\d\.]+)(?:\/[\d\.]+)? ms/", $sline, $regs)) {
534 $udata[$mode."_min"] = $regs[1]/1000; $udata[$mode."_avg"] = $regs[2]/1000; $udata[$mode."_max"] = $regs[3]/1000;
540 $rrd_info['ping.gateway']['graph']['rows'][] = array('name'=>'flood_min', 'gType'=>'LINE1', 'color'=>'#80FF80', 'legend'=>'f:min/max', 'desc'=>'f:min');
541 $rrd_info['ping.gateway']['graph']['rows'][] = array('name'=>'flood_max', 'gType'=>'LINE1', 'color'=>'#80FF80', 'desc'=>'f:max');
542 $rrd_info['ping.gateway']['graph']['rows'][] = array('name'=>'single_min', 'gType'=>'LINE1', 'color'=>'#CCCCFF', 'legend'=>'s:min/max', 'desc'=>'s:min');
543 $rrd_info['ping.gateway']['graph']['rows'][] = array('name'=>'single_max', 'gType'=>'LINE1', 'color'=>'#CCCCFF', 'desc'=>'s:max');
544 $rrd_info['ping.gateway']['graph']['rows'][] = array('name'=>'flood_avg', 'gType'=>'LINE1', 'color'=>'#008000', 'legend'=>'f:avg');
545 $rrd_info['ping.gateway']['graph']['rows'][] = array('name'=>'single_avg', 'gType'=>'LINE1', 'color'=>'#0000FF', 'legend'=>'s:avg');
546 $rrd_info['ping.gateway']['graph']['rows'][] = array('name'=>'flood_loss', 'scale'=>0.001, 'gType'=>'LINE1', 'color'=>'#000000', 'legend'=>'f:mloss');
547 $rrd_info['ping.gateway']['graph']['rows'][] = array('name'=>'single_loss', 'scale'=>0.001, 'gType'=>'LINE1', 'color'=>'#FF0000', 'legend'=>'s:mloss');
548 $rrd_info['ping.gateway']['graph']['label_y'] = 'Seconds';
549 $rrd_info['ping.gateway']['graph']['min_y'] = 0;
550 // $rrd_info['ping.gateway']['graph']['force_recreate'] = true;
551 $rrd_info['ping.gateway']['page']['text_intro'] = 'Alternate graphs: <a href="?stat=ping.gateway">totals</a>, <a href="?stat=ping.gateway&sub=avg">averages</a>.';
552 $rrd_info['ping.gateway']['graph.avg']['rows'][] = array('name'=>'flood_avg', 'gType'=>'LINE1', 'color'=>'#008000',
553 'legend'=>'f:avg', 'legend_long'=>'Flood ping: average time (of 20 parallel pings)');
554 $rrd_info['ping.gateway']['graph.avg']['rows'][] = array('name'=>'single_avg', 'gType'=>'LINE1', 'color'=>'#0000FF',
555 'legend'=>'s:avg', 'legend_long'=>'Single ping: average time (of 20 sequential pings, 1s gap)');
556 $rrd_info['ping.gateway']['graph.avg']['rows'][] = array('name'=>'flood_loss', 'scale'=>0.001, 'gType'=>'LINE1', 'color'=>'#000000',
557 'legend'=>'f:mloss', 'legend_long'=>'Flood ping: packet loss (percent of 20 parallel pings)');
558 $rrd_info['ping.gateway']['graph.avg']['rows'][] = array('name'=>'single_loss', 'scale'=>0.001, 'gType'=>'LINE1', 'color'=>'#FF0000',
559 'legend'=>'s:mloss', 'legend_long'=>'Single ping: packet loss (percent of 20 sequential pings, 1s gap)');
560 $rrd_info['ping.gateway']['graph.avg']['label_y'] = 'Seconds';
561 $rrd_info['ping.gateway']['graph.avg']['min_y'] = 0;
562 $rrd_info['ping.gateway']['page.avg']['graph_sub'] = 'avg';
565 $rrd_info['sensors.power']['file'] = 'sensors.power.rrd';
566 $rrd_info['sensors.power']['auto-update'] = true;
567 $rrd_info['sensors.power']['fields'][] = array('name' => 'vcore', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
568 $rrd_info['sensors.power']['fields'][] = array('name' => 'p3x3v', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
569 $rrd_info['sensors.power']['fields'][] = array('name' => 'p5v', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
570 $rrd_info['sensors.power']['fields'][] = array('name' => 'p12v', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
571 $rrd_info['sensors.power']['fields'][] = array('name' => 'avcc', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
572 $rrd_info['sensors.power']['fields'][] = array('name' => 'vsb', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
573 $rrd_info['sensors.power']['fields'][] = array('name' => 'vbat', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
574 $rrd_info['sensors.power']['fields'][] = array('name' => 'memvcc', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
575 $rrd_info['sensors.power']['fields'][] = array('name' => 'pchvcc', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
576 $rrd_info['sensors.power']['fields'][] = array('name' => 'vid', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
577 $rrd_info['sensors.power']['update'] =
579 $sdata = explode("\n", `/usr/bin/sensors -A mysensor-*`);
580 $udata = array("vcore"=>null,"p3x3v"=>null,"p5v"=>null,"p12v"=>null,
581 "avcc"=>null,"vsb"=>null,"vbat"=>null,"memvcc"=>null,
582 "pchvcc"=>null,"vid"=>null);
583 foreach ($sdata as $sline) {
584 if (preg_match("/^Vcore:\s+([+-]?[\d\.]+) V/", $sline, $regs)) { $udata["vcore"] = $regs[1]; }
585 elseif (preg_match("/^\+3\.3V:\s+([+-]?[\d\.]+) V/", $sline, $regs)) { $udata["p3x3v"] = $regs[1]; }
586 elseif (preg_match("/^\+5V:\s+([+-]?[\d\.]+) V/", $sline, $regs)) { $udata["p5v"] = $regs[1]; }
587 elseif (preg_match("/^\+12V:\s+([+-]?[\d\.]+) V/", $sline, $regs)) { $udata["p12v"] = $regs[1]; }
588 elseif (preg_match("/^AVCC:\s+([+-]?[\d\.]+) V/", $sline, $regs)) { $udata["avcc"] = $regs[1]; }
589 elseif (preg_match("/^3VSB:\s+([+-]?[\d\.]+) V/", $sline, $regs)) { $udata["vsb"] = $regs[1]; }
590 elseif (preg_match("/^Vbat:\s+([+-]?[\d\.]+) V/", $sline, $regs)) { $udata["vbat"] = $regs[1]; }
591 elseif (preg_match("/^Memory Vcc:\s+([+-]?[\d\.]+) V/", $sline, $regs)) { $udata["memvcc"] = $regs[1]; }
592 elseif (preg_match("/^PCH Vcc:\s+([+-]?[\d\.]+) V/", $sline, $regs)) { $udata["pchvcc"] = $regs[1]; }
593 elseif (preg_match("/^cpu0_vid:\s+([+-]?[\d\.]+) V/", $sline, $regs)) { $udata["vid"] = $regs[1]; }
598 $rrd_info['sensors.power']['graph']['rows'][] = array('name'=>'vcore', 'gType'=>'LINE1', 'color'=>'#FF0000', 'legend'=>'VCore');
599 $rrd_info['sensors.power']['graph']['rows'][] = array('name'=>'p12v', 'gType'=>'LINE1', 'color'=>'#0000FF', 'legend'=>'+12V');
600 $rrd_info['sensors.power']['graph']['rows'][] = array('name'=>'p5v', 'gType'=>'LINE1', 'color'=>'#008000', 'legend'=>'+5V');
601 $rrd_info['sensors.power']['graph']['rows'][] = array('name'=>'p3x3v', 'gType'=>'LINE1', 'color'=>'#000000', 'legend'=>'+3.3V');
602 $rrd_info['sensors.power']['graph']['rows'][] = array('name'=>'avcc', 'gType'=>'LINE1', 'color'=>'#808080', 'legend'=>'AVCC');
603 $rrd_info['sensors.power']['graph']['rows'][] = array('name'=>'vsb', 'gType'=>'LINE1', 'color'=>'#8080FF', 'legend'=>'3VSB');
604 $rrd_info['sensors.power']['graph']['rows'][] = array('name'=>'vbat', 'gType'=>'LINE1', 'color'=>'#00CC00', 'legend'=>'VBat');
605 $rrd_info['sensors.power']['graph']['rows'][] = array('name'=>'memvcc', 'gType'=>'LINE1', 'color'=>'#808080', 'legend'=>'Memory Vcc');
606 $rrd_info['sensors.power']['graph']['rows'][] = array('name'=>'pchvcc', 'gType'=>'LINE1', 'color'=>'#808080', 'legend'=>'PCH Vcc');
607 $rrd_info['sensors.power']['graph']['rows'][] = array('name'=>'vid', 'gType'=>'LINE1', 'color'=>'#808080', 'legend'=>'CPU0-VID');
608 $rrd_info['sensors.power']['graph']['units_length'] = 4;
609 $rrd_info['sensors.power']['graph']['label_y'] = 'Volt';
610 $rrd_info['sensors.power']['graph']['max_y'] = 13;
611 $rrd_info['sensors.power']['graph']['min_y'] = 0;
612 // $rrd_info['sensors.power']['graph']['force_recreate'] = true;
613 $rrd_info['sensors.power']['graph.rel']['rows'][] = array('name'=>'vcore_tmp', 'dsname'=>'vcore', 'gType'=>'');
614 $rrd_info['sensors.power']['graph.rel']['rows'][] = array('name'=>'p12v_tmp', 'dsname'=>'p12v', 'gType'=>'');
615 $rrd_info['sensors.power']['graph.rel']['rows'][] = array('name'=>'p5v_tmp', 'dsname'=>'p5v', 'gType'=>'');
616 $rrd_info['sensors.power']['graph.rel']['rows'][] = array('name'=>'p3x3v_tmp', 'dsname'=>'p3x3v', 'gType'=>'');
617 $rrd_info['sensors.power']['graph.rel']['rows'][] = array('name'=>'avcc_tmp', 'dsname'=>'vsb', 'gType'=>'');
618 $rrd_info['sensors.power']['graph.rel']['rows'][] = array('name'=>'vsb_tmp', 'dsname'=>'vsb', 'gType'=>'');
619 $rrd_info['sensors.power']['graph.rel']['rows'][] = array('name'=>'vbat_tmp', 'dsname'=>'vbat', 'gType'=>'');
620 $rrd_info['sensors.power']['graph.rel']['rows'][] = array('name'=>'memvcc_tmp', 'dsname'=>'memvcc', 'gType'=>'');
621 $rrd_info['sensors.power']['graph.rel']['rows'][] = array('name'=>'pchvcc_tmp', 'dsname'=>'pchvcc', 'gType'=>'');
622 $rrd_info['sensors.power']['graph.rel']['rows'][] = array('name'=>'vid_tmp', 'dsname'=>'vid', 'gType'=>'');
623 $rrd_info['sensors.power']['graph.rel']['rows'][] = array('dType'=>'CDEF', 'name'=>'vcore',
624 'rpn_expr'=>'vcore_tmp,1,-', 'gType'=>'LINE1', 'color'=>'#FF0000', 'legend'=>'VCore');
625 $rrd_info['sensors.power']['graph.rel']['rows'][] = array('dType'=>'CDEF', 'name'=>'p3x3v',
626 'rpn_expr'=>'p3x3v_tmp,3.3,-', 'gType'=>'LINE1', 'color'=>'#000000', 'legend'=>'+3.3V');
627 $rrd_info['sensors.power']['graph.rel']['rows'][] = array('dType'=>'CDEF', 'name'=>'p5v',
628 'rpn_expr'=>'p5v_tmp,5,-', 'gType'=>'LINE1', 'color'=>'#008000', 'legend'=>'+5V');
629 $rrd_info['sensors.power']['graph.rel']['rows'][] = array('dType'=>'CDEF', 'name'=>'p12v',
630 'rpn_expr'=>'p12v_tmp,12,-', 'gType'=>'LINE1', 'color'=>'#0000FF', 'legend'=>'+12V');
631 $rrd_info['sensors.power']['graph.rel']['rows'][] = array('dType'=>'CDEF', 'name'=>'avcc',
632 'rpn_expr'=>'avcc_tmp,3.3,-', 'gType'=>'LINE1', 'color'=>'#808080', 'legend'=>'AVCC');
633 $rrd_info['sensors.power']['graph.rel']['rows'][] = array('dType'=>'CDEF', 'name'=>'vsb',
634 'rpn_expr'=>'vsb_tmp,3.3,-', 'gType'=>'LINE1', 'color'=>'#8080FF', 'legend'=>'3VSB');
635 $rrd_info['sensors.power']['graph.rel']['rows'][] = array('dType'=>'CDEF', 'name'=>'vbat',
636 'rpn_expr'=>'vbat_tmp,3.3,-', 'gType'=>'LINE1', 'color'=>'#00CC00', 'legend'=>'VBat');
637 $rrd_info['sensors.power']['graph.rel']['rows'][] = array('dType'=>'CDEF', 'name'=>'memvcc',
638 'rpn_expr'=>'memvcc_tmp,1.5,-', 'gType'=>'LINE1', 'color'=>'#808080', 'legend'=>'Memory Vcc');
639 $rrd_info['sensors.power']['graph.rel']['rows'][] = array('dType'=>'CDEF', 'name'=>'pchvcc',
640 'rpn_expr'=>'pchvcc_tmp,1,-', 'gType'=>'LINE1', 'color'=>'#808080', 'legend'=>'PCH Vcc');
641 $rrd_info['sensors.power']['graph.rel']['rows'][] = array('dType'=>'CDEF', 'name'=>'vid',
642 'rpn_expr'=>'vid_tmp,2,-', 'gType'=>'LINE1', 'color'=>'#808080', 'legend'=>'CPU0-VID');
643 $rrd_info['sensors.power']['graph.rel']['units_length'] = 5;
644 $rrd_info['sensors.power']['graph.rel']['units_exponent'] = 0;
645 $rrd_info['sensors.power']['graph.rel']['label_y'] = 'Volts (diff)';
646 $rrd_info['sensors.power']['graph.rel']['max_y'] = +0.3;
647 $rrd_info['sensors.power']['graph.rel']['min_y'] = -0.7;
648 // $rrd_info['sensors.power']['graph.rel']['force_recreate'] = true;
649 $rrd_info['sensors.power']['page.rel']['graph_sub'] = 'rel';
650 $rrd_info['sensors.power']['graph.relpct']['rows'][] = array('name'=>'vcore_tmp', 'dsname'=>'vcore', 'gType'=>'');
651 $rrd_info['sensors.power']['graph.relpct']['rows'][] = array('name'=>'p12v_tmp', 'dsname'=>'p12v', 'gType'=>'');
652 $rrd_info['sensors.power']['graph.relpct']['rows'][] = array('name'=>'p5v_tmp', 'dsname'=>'p5v', 'gType'=>'');
653 $rrd_info['sensors.power']['graph.relpct']['rows'][] = array('name'=>'p3x3v_tmp', 'dsname'=>'p3x3v', 'gType'=>'');
654 $rrd_info['sensors.power']['graph.relpct']['rows'][] = array('name'=>'avcc_tmp', 'dsname'=>'vsb', 'gType'=>'');
655 $rrd_info['sensors.power']['graph.relpct']['rows'][] = array('name'=>'vsb_tmp', 'dsname'=>'vsb', 'gType'=>'');
656 $rrd_info['sensors.power']['graph.relpct']['rows'][] = array('name'=>'vbat_tmp', 'dsname'=>'vbat', 'gType'=>'');
657 $rrd_info['sensors.power']['graph.relpct']['rows'][] = array('name'=>'memvcc_tmp', 'dsname'=>'memvcc', 'gType'=>'');
658 $rrd_info['sensors.power']['graph.relpct']['rows'][] = array('name'=>'pchvcc_tmp', 'dsname'=>'pchvcc', 'gType'=>'');
659 $rrd_info['sensors.power']['graph.relpct']['rows'][] = array('name'=>'vid_tmp', 'dsname'=>'vid', 'gType'=>'');
660 $rrd_info['sensors.power']['graph.relpct']['rows'][] = array('dType'=>'CDEF', 'name'=>'vcore',
661 'rpn_expr'=>'vcore_tmp,1,-,1,/,100,*', 'gType'=>'LINE1', 'color'=>'#FF0000', 'legend'=>'VCore');
662 $rrd_info['sensors.power']['graph.relpct']['rows'][] = array('dType'=>'CDEF', 'name'=>'p3x3v',
663 'rpn_expr'=>'p3x3v_tmp,3.3,-,3.3,/,100,*', 'gType'=>'LINE1', 'color'=>'#000000', 'legend'=>'+3.3V');
664 $rrd_info['sensors.power']['graph.relpct']['rows'][] = array('dType'=>'CDEF', 'name'=>'p5v',
665 'rpn_expr'=>'p5v_tmp,5,-,5,/,100,*', 'gType'=>'LINE1', 'color'=>'#008000', 'legend'=>'+5V');
666 $rrd_info['sensors.power']['graph.relpct']['rows'][] = array('dType'=>'CDEF', 'name'=>'p12v',
667 'rpn_expr'=>'p12v_tmp,12,-,12,/,100,*', 'gType'=>'LINE1', 'color'=>'#0000FF', 'legend'=>'+12V');
668 $rrd_info['sensors.power']['graph.relpct']['rows'][] = array('dType'=>'CDEF', 'name'=>'avcc',
669 'rpn_expr'=>'avcc_tmp,3.3,-,3.3,/,100,*', 'gType'=>'LINE1', 'color'=>'#808080', 'legend'=>'AVCC');
670 $rrd_info['sensors.power']['graph.relpct']['rows'][] = array('dType'=>'CDEF', 'name'=>'vsb',
671 'rpn_expr'=>'vsb_tmp,3.3,-,3.3,/,100,*', 'gType'=>'LINE1', 'color'=>'#8080FF', 'legend'=>'3VSB');
672 $rrd_info['sensors.power']['graph.relpct']['rows'][] = array('dType'=>'CDEF', 'name'=>'vbat',
673 'rpn_expr'=>'vbat_tmp,3.3,-,3.3,/,100,*', 'gType'=>'LINE1', 'color'=>'#00CC00', 'legend'=>'VBat');
674 $rrd_info['sensors.power']['graph.relpct']['rows'][] = array('dType'=>'CDEF', 'name'=>'memvcc',
675 'rpn_expr'=>'memvcc_tmp,1.5,-,1.5,/,100,*', 'gType'=>'LINE1', 'color'=>'#808080', 'legend'=>'Memory Vcc');
676 $rrd_info['sensors.power']['graph.relpct']['rows'][] = array('dType'=>'CDEF', 'name'=>'pchvcc',
677 'rpn_expr'=>'pchvcc_tmp,1,-,1,/,100,*', 'gType'=>'LINE1', 'color'=>'#808080', 'legend'=>'PCH Vcc');
678 $rrd_info['sensors.power']['graph.relpct']['rows'][] = array('dType'=>'CDEF', 'name'=>'vid',
679 'rpn_expr'=>'vid_tmp,2,-,2,/,100,*', 'gType'=>'LINE1', 'color'=>'#808080', 'legend'=>'CPU0-VID');
680 $rrd_info['sensors.power']['graph.relpct']['units_length'] = 5;
681 $rrd_info['sensors.power']['graph.relpct']['units_exponent'] = 0;
682 $rrd_info['sensors.power']['graph.relpct']['label_y'] = 'diff%';
683 $rrd_info['sensors.power']['graph.relpct']['max_y'] = +2;
684 $rrd_info['sensors.power']['graph.relpct']['min_y'] = -6;
685 // $rrd_info['sensors.power']['graph.relpct']['force_recreate'] = true;
686 $rrd_info['sensors.power']['page.relpct']['graph_sub'] = 'relpct';
688 $rrd_info['sensors.fan']['file'] = 'sensors.fan.rrd';
689 $rrd_info['sensors.fan']['auto-update'] = true;
690 $rrd_info['sensors.fan']['fields'][] = array('name' => 'cpu_fan', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
691 $rrd_info['sensors.fan']['fields'][] = array('name' => 'chassis_fan', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
692 $rrd_info['sensors.fan']['fields'][] = array('name' => 'power_fan', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
693 $rrd_info['sensors.fan']['update'] =
695 $sdata = explode("\n", str_replace(":\n", ": ", `/usr/bin/sensors -A mysensor-*`));
696 $udata = array("cpu_fan"=>null,"chassis_fan"=>null,"power_fan"=>null);
697 foreach ($sdata as $sline) {
698 if (preg_match("/^fan2:\s+([+-]?\d+) RPM/", $sline, $regs)) { $udata["cpu_fan"] = $regs[1]; }
699 elseif (preg_match("/^CHASSIS1 FAN Speed:\s+([+-]?\d+) RPM/", $sline, $regs)) { $udata["chassis_fan"] = $regs[1]; }
700 elseif (preg_match("/^POWER FAN Speed:\s+([+-]?\d+) RPM/", $sline, $regs)) { $udata["power_fan"] = $regs[1]; }
704 $rrd_info['sensors.fan']['graph']['rows'][] = array('name'=>'cpu_fan', 'gType'=>'LINE1', 'color'=>'#0000FF', 'legend'=>'CPU Fan');
705 $rrd_info['sensors.fan']['graph']['rows'][] = array('name'=>'chassis_fan', 'gType'=>'LINE1', 'color'=>'#00CC00', 'legend'=>'GPU Fan');
706 $rrd_info['sensors.fan']['graph']['label_y'] = 'Rotations/min';
707 $rrd_info['sensors.fan']['graph']['max_y'] = 2000;
708 $rrd_info['sensors.fan']['graph']['min_y'] = 500;
709 // $rrd_info['sensors.fan']['graph']['force_recreate'] = true;
711 $rrd_info['sensors.temp']['file'] = 'sensors.temp.rrd';
712 $rrd_info['sensors.temp']['auto-update'] = true;
713 $rrd_info['sensors.temp']['fields'][] = array('name' => 'cpu_temp', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
714 $rrd_info['sensors.temp']['fields'][] = array('name' => 'mb_temp', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
715 $rrd_info['sensors.temp']['fields'][] = array('name' => 'power_temp', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
716 $rrd_info['sensors.temp']['update'] =
718 $sdata = explode("\n", `/usr/bin/sensors -A mysensor-*`);
719 $udata = array("cpu_temp"=>null,"mb_temp"=>null,"power_temp"=>null);
720 foreach ($sdata as $sline) {
721 if (preg_match("/^CPUTIN:\s+([+-]?[\d\.]+).+?C/i", $sline, $regs)) { $udata["cpu_temp"] = $regs[1]; }
722 elseif (preg_match("/^SYSTIN:\s+([+-]?[\d\.]+).+?C/i", $sline, $regs)) { $udata["mb_temp"] = $regs[1]; }
723 elseif (preg_match("/^AUXTIN:\s+([+-]?[\d\.]+).+?C/i", $sline, $regs)) { $udata["power_temp"] = $regs[1]; }
727 $rrd_info['sensors.temp']['graph']['rows'][] = array('name'=>'cpu_temp', 'gType'=>'LINE1', 'color'=>'#0000FF', 'legend'=>'CPU Temp');
728 $rrd_info['sensors.temp']['graph']['rows'][] = array('name'=>'mb_temp', 'gType'=>'LINE1', 'color'=>'#008000', 'legend'=>'MB Temp');
729 $rrd_info['sensors.temp']['graph']['label_y'] = '°C';
730 $rrd_info['sensors.temp']['graph']['max_y'] = 55;
731 $rrd_info['sensors.temp']['graph']['min_y'] = 30;
732 // $rrd_info['sensors.temp']['graph']['force_recreate'] = true;
734 /* !!! be sure to call this one _last_ of all auto-update rrd stats */
735 $rrd_info['rrdup']['file'] = 'test.rrdup.rrd';
736 // $rrd_info['rrdup']['auto-update'] = true;
737 $rrd_info['rrdup']['fields'][] = array('name' => 'usertime', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
738 $rrd_info['rrdup']['fields'][] = array('name' => 'systime', 'type' => 'GAUGE', 'heartbeat' => 600, 'min' => 'U', 'max' => 'U');
739 $rrd_info['rrdup']['update'] = 'function { $sdata = posix_times(); return array("usertime"=>$sdata["cutime"],"systime"=>$sdata["cstime"]); }';
740 $rrd_info['rrdup']['graph']['rows'][] = array('name'=>'systime', 'gType'=>'AREA', 'color'=>'#FF0000', 'legend'=>'System CPU time');
741 $rrd_info['rrdup']['graph']['rows'][] = array('name'=>'usertime', 'gType'=>'AREA', 'color'=>'#0000FF', 'legend'=>'User CPU time', 'stack'=>true);
742 $rrd_info['rrdup']['graph']['scale'] = 0.01;
743 $rrd_info['rrdup']['graph']['units_length'] = 4;
744 $rrd_info['rrdup']['graph']['units_exponent'] = 0;
745 $rrd_info['rrdup']['graph']['label_y'] = 'RRD update (seconds)';
746 $rrd_info['rrdup']['graph']['min_y'] = 0;
747 // $rrd_info['rrdup']['graph']['force_recreate'] = true;