aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/plugin/cpu.php
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/cpu.php')
-rw-r--r--plugin/cpu.php65
1 files changed, 65 insertions, 0 deletions
diff --git a/plugin/cpu.php b/plugin/cpu.php
new file mode 100644
index 0000000..10fbf56
--- /dev/null
+++ b/plugin/cpu.php
@@ -0,0 +1,65 @@
1<?php
2
3# Collectd CPU plugin
4
5require_once $CONFIG['webdir'].'/conf/config.php';
6require_once $CONFIG['webdir'].'/type/GenericStacked.class.php';
7
8## LAYOUT
9# cpu-X/
10# cpu-X/cpu-idle.rrd
11# cpu-X/cpu-interrupt.rrd
12# cpu-X/cpu-nice.rrd
13# cpu-X/cpu-softirq.rrd
14# cpu-X/cpu-steal.rrd
15# cpu-X/cpu-system.rrd
16# cpu-X/cpu-user.rrd
17# cpu-X/cpu-wait.rrd
18
19# grouped
20require_once $CONFIG['webdir'].'/inc/collectd.inc.php';
21$tinstance = collectd_plugindetail($host, $plugin, 'ti');
22
23$obj = new Type_GenericStacked;
24$obj->datadir = $CONFIG['datadir'];
25$obj->path_format = '{host}/{plugin}-{pinstance}/{type}-{tinstance}.rrd';
26$obj->args = array(
27 'host' => $host,
28 'plugin' => $plugin,
29 'pinstance' => $pinstance,
30 'type' => $type,
31 'tinstance' => $tinstance,
32);
33$obj->data_sources = array('value');
34$obj->order = array('idle', 'nice', 'user', 'wait', 'system', 'softirq', 'interrupt', 'steal');
35$obj->ds_names = array(
36 'idle' => 'Idle ',
37 'nice' => 'Nice ',
38 'user' => 'User ',
39 'wait' => 'Wait-IO',
40 'system' => 'System ',
41 'softirq' => 'SoftIRQ',
42 'interrupt' => 'IRQ ',
43 'steal' => 'Steal ',
44);
45$obj->colors = array(
46 'idle' => 'e8e8e8',
47 'nice' => '00e000',
48 'user' => '0000ff',
49 'wait' => 'ffb000',
50 'system' => 'ff0000',
51 'softirq' => 'ff00ff',
52 'interrupt' => 'a000a0',
53 'steal' => '000000',
54);
55$obj->width = $width;
56$obj->heigth = $heigth;
57$obj->seconds = $seconds;
58
59$obj->rrd_title = "CPU-$pinstance usage on $host";
60$obj->rrd_vertical = 'Jiffies';
61$obj->rrd_format = '%5.2lf';
62
63$obj->rrd_graph();
64
65?>