diff options
author | Pim van den Berg | 2009-09-20 13:36:25 +0200 |
---|---|---|
committer | Pim van den Berg | 2009-09-20 13:45:26 +0200 |
commit | cd94ef34134d8f06af83ec97119018b4e80346a0 (patch) | |
tree | b01a57617cb5528554b1909583bdf110d8acb631 /plugin | |
download | apt-panopticon_cgp-cd94ef34134d8f06af83ec97119018b4e80346a0.zip apt-panopticon_cgp-cd94ef34134d8f06af83ec97119018b4e80346a0.tar.gz apt-panopticon_cgp-cd94ef34134d8f06af83ec97119018b4e80346a0.tar.bz2 apt-panopticon_cgp-cd94ef34134d8f06af83ec97119018b4e80346a0.tar.xz |
initial import of cgp
Collectd Graph Panel is a frontend for Collectd written in PHP.
The goal of CGP is to provide an easy-to-use frontend for Collectd,
starting with page that shows an overview of all the hosts you are
managing with Collectd.
In this initial import there is support for the plugins that are default
enabled in Collectd. The supported plugins are located in the plugin
directory.
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/cpu.php | 65 | ||||
-rw-r--r-- | plugin/df.php | 42 | ||||
-rw-r--r-- | plugin/disk.php | 63 | ||||
-rw-r--r-- | plugin/entropy.php | 37 | ||||
-rw-r--r-- | plugin/interface.php | 54 | ||||
-rw-r--r-- | plugin/irq.php | 40 | ||||
-rw-r--r-- | plugin/load.php | 41 | ||||
-rw-r--r-- | plugin/memory.php | 53 | ||||
-rw-r--r-- | plugin/processes.php | 58 | ||||
-rw-r--r-- | plugin/sensors.php | 58 | ||||
-rw-r--r-- | plugin/swap.php | 50 | ||||
-rw-r--r-- | plugin/users.php | 37 |
12 files changed, 598 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 | |||
5 | require_once $CONFIG['webdir'].'/conf/config.php'; | ||
6 | require_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 | ||
20 | require_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 | ?> | ||
diff --git a/plugin/df.php b/plugin/df.php new file mode 100644 index 0000000..6398249 --- /dev/null +++ b/plugin/df.php | |||
@@ -0,0 +1,42 @@ | |||
1 | <?php | ||
2 | |||
3 | # Collectd Df plugin | ||
4 | |||
5 | require_once $CONFIG['webdir'].'/conf/config.php'; | ||
6 | require_once $CONFIG['webdir'].'/type/GenericStacked.class.php'; | ||
7 | |||
8 | # LAYOUT | ||
9 | # | ||
10 | # df/ | ||
11 | # df/df-XXXX.rrd | ||
12 | |||
13 | $obj = new Type_GenericStacked; | ||
14 | $obj->datadir = $CONFIG['datadir']; | ||
15 | $obj->path_format = '{host}/{plugin}/{type}-{tinstance}.rrd'; | ||
16 | $obj->args = array( | ||
17 | 'host' => $host, | ||
18 | 'plugin' => $plugin, | ||
19 | 'pinstance' => $pinstance, | ||
20 | 'type' => $type, | ||
21 | 'tinstance' => $tinstance, | ||
22 | ); | ||
23 | $obj->data_sources = array('free', 'used'); | ||
24 | $obj->ds_names = array( | ||
25 | 'free' => 'Free', | ||
26 | 'used' => 'Used', | ||
27 | ); | ||
28 | $obj->colors = array( | ||
29 | 'free' => '00ff00', | ||
30 | 'used' => 'ff0000', | ||
31 | ); | ||
32 | $obj->width = $width; | ||
33 | $obj->heigth = $heigth; | ||
34 | $obj->seconds = $seconds; | ||
35 | |||
36 | $obj->rrd_title = "Free space ($tinstance) on $host"; | ||
37 | $obj->rrd_vertical = 'Bytes'; | ||
38 | $obj->rrd_format = '%5.1lf%sB'; | ||
39 | |||
40 | $obj->rrd_graph(); | ||
41 | |||
42 | ?> | ||
diff --git a/plugin/disk.php b/plugin/disk.php new file mode 100644 index 0000000..298c179 --- /dev/null +++ b/plugin/disk.php | |||
@@ -0,0 +1,63 @@ | |||
1 | <?php | ||
2 | |||
3 | # Collectd Disk plugin | ||
4 | |||
5 | require_once $CONFIG['webdir'].'/conf/config.php'; | ||
6 | require_once $CONFIG['webdir'].'/type/GenericIO.class.php'; | ||
7 | |||
8 | ## LAYOUT | ||
9 | # disk-XXXX/ | ||
10 | # disk-XXXX/disk_merged.rrd | ||
11 | # disk-XXXX/disk_octets.rrd | ||
12 | # disk-XXXX/disk_ops.rrd | ||
13 | # disk-XXXX/disk_time.rrd | ||
14 | |||
15 | $obj = new Type_GenericIO; | ||
16 | $obj->datadir = $CONFIG['datadir']; | ||
17 | $obj->path_format = '{host}/{plugin}-{pinstance}/{type}.rrd'; | ||
18 | $obj->args = array( | ||
19 | 'host' => $host, | ||
20 | 'plugin' => $plugin, | ||
21 | 'pinstance' => $pinstance, | ||
22 | 'type' => $type, | ||
23 | 'tinstance' => $tinstance, | ||
24 | ); | ||
25 | $obj->data_sources = array('read', 'write'); | ||
26 | $obj->ds_names = array( | ||
27 | 'read' => 'Read ', | ||
28 | 'write' => 'Written', | ||
29 | ); | ||
30 | $obj->colors = array( | ||
31 | 'read' => '0000ff', | ||
32 | 'write' => '00b000', | ||
33 | ); | ||
34 | $obj->width = $width; | ||
35 | $obj->heigth = $heigth; | ||
36 | $obj->seconds = $seconds; | ||
37 | switch($type) { | ||
38 | case 'disk_merged': | ||
39 | $obj->rrd_title = "Disk Merged Operations ($pinstance) on $host"; | ||
40 | $obj->rrd_vertical = 'Merged operations/s'; | ||
41 | $obj->rrd_format = '%5.1lf'; | ||
42 | break; | ||
43 | case 'disk_octets': | ||
44 | $obj->rrd_title = "Disk Traffic ($pinstance) on $host"; | ||
45 | $obj->rrd_vertical = 'Bytes per second'; | ||
46 | $obj->rrd_format = '%5.1lf%s'; | ||
47 | break; | ||
48 | case 'disk_ops': | ||
49 | $obj->rrd_title = "Disk Operations ($pinstance) on $host"; | ||
50 | $obj->rrd_vertical = 'Ops per second'; | ||
51 | $obj->rrd_format = '%5.1lf'; | ||
52 | break; | ||
53 | case 'disk_time': | ||
54 | $obj->rrd_title = "Disk time per operation ($pinstance) on $host"; | ||
55 | $obj->rrd_vertical = 'Avg. Time/Op'; | ||
56 | $obj->rrd_format = '%5.1lf%ss'; | ||
57 | $obj->scale = '0.001'; | ||
58 | break; | ||
59 | } | ||
60 | |||
61 | $obj->rrd_graph(); | ||
62 | |||
63 | ?> | ||
diff --git a/plugin/entropy.php b/plugin/entropy.php new file mode 100644 index 0000000..55159dc --- /dev/null +++ b/plugin/entropy.php | |||
@@ -0,0 +1,37 @@ | |||
1 | <?php | ||
2 | |||
3 | # Collectd Entropy plugin | ||
4 | |||
5 | require_once $CONFIG['webdir'].'/conf/config.php'; | ||
6 | require_once $CONFIG['webdir'].'/type/Default.class.php'; | ||
7 | |||
8 | ## LAYOUT | ||
9 | # entropy/entropy.rrd | ||
10 | |||
11 | $obj = new Type_Default; | ||
12 | $obj->datadir = $CONFIG['datadir']; | ||
13 | $obj->path_format = '{host}/{plugin}/{type}.rrd'; | ||
14 | $obj->args = array( | ||
15 | 'host' => $host, | ||
16 | 'plugin' => $plugin, | ||
17 | 'pinstance' => $pinstance, | ||
18 | 'type' => $type, | ||
19 | 'tinstance' => $tinstance, | ||
20 | ); | ||
21 | $obj->data_sources = array('entropy'); | ||
22 | $obj->ds_names = array( | ||
23 | 'entropy' => 'Entropy bits', | ||
24 | ); | ||
25 | $obj->colors = array( | ||
26 | 'entropy' => '0000f0', | ||
27 | ); | ||
28 | $obj->width = $width; | ||
29 | $obj->heigth = $heigth; | ||
30 | $obj->seconds = $seconds; | ||
31 | $obj->rrd_title = "Available entropy on $host"; | ||
32 | $obj->rrd_vertical = 'Bits'; | ||
33 | $obj->rrd_format = '%4.0lf'; | ||
34 | |||
35 | $obj->rrd_graph(); | ||
36 | |||
37 | ?> | ||
diff --git a/plugin/interface.php b/plugin/interface.php new file mode 100644 index 0000000..2f345f9 --- /dev/null +++ b/plugin/interface.php | |||
@@ -0,0 +1,54 @@ | |||
1 | <?php | ||
2 | |||
3 | # Collectd Interface plugin | ||
4 | |||
5 | require_once $CONFIG['webdir'].'/conf/config.php'; | ||
6 | require_once $CONFIG['webdir'].'/type/GenericIO.class.php'; | ||
7 | |||
8 | # LAYOUT | ||
9 | # interface/ | ||
10 | # interface/if_errors-XXXX.rrd | ||
11 | # interface/if_octets-XXXX.rrd | ||
12 | # interface/if_packets-XXXX.rrd | ||
13 | |||
14 | $obj = new Type_GenericIO; | ||
15 | $obj->datadir = $CONFIG['datadir']; | ||
16 | $obj->path_format = '{host}/{plugin}/{type}-{tinstance}.rrd'; | ||
17 | $obj->args = array( | ||
18 | 'host' => $host, | ||
19 | 'plugin' => $plugin, | ||
20 | 'pinstance' => $pinstance, | ||
21 | 'type' => $type, | ||
22 | 'tinstance' => $tinstance, | ||
23 | ); | ||
24 | $obj->data_sources = array('rx', 'tx'); | ||
25 | $obj->ds_names = array( | ||
26 | 'rx' => 'Receive ', | ||
27 | 'tx' => 'Transmit', | ||
28 | ); | ||
29 | $obj->colors = array( | ||
30 | 'rx' => '0000ff', | ||
31 | 'tx' => '00b000', | ||
32 | ); | ||
33 | $obj->width = $width; | ||
34 | $obj->heigth = $heigth; | ||
35 | $obj->seconds = $seconds; | ||
36 | $obj->rrd_format = '%5.1lf%s'; | ||
37 | switch($type) { | ||
38 | case 'if_errors': | ||
39 | $obj->rrd_title = "Interface Errors ($tinstance) on $host"; | ||
40 | $obj->rrd_vertical = 'Errors per second'; | ||
41 | break; | ||
42 | case 'if_octets': | ||
43 | $obj->rrd_title = "Interface Traffic ($tinstance) on $host"; | ||
44 | $obj->rrd_vertical = 'Bits per second'; | ||
45 | break; | ||
46 | case 'if_packets': | ||
47 | $obj->rrd_title = "Interface Packets ($tinstance) on $host"; | ||
48 | $obj->rrd_vertical = 'Packets per second'; | ||
49 | break; | ||
50 | } | ||
51 | |||
52 | $obj->rrd_graph(); | ||
53 | |||
54 | ?> | ||
diff --git a/plugin/irq.php b/plugin/irq.php new file mode 100644 index 0000000..2759c0e --- /dev/null +++ b/plugin/irq.php | |||
@@ -0,0 +1,40 @@ | |||
1 | <?php | ||
2 | |||
3 | # Collectd IRQ plugin | ||
4 | |||
5 | require_once $CONFIG['webdir'].'/conf/config.php'; | ||
6 | require_once $CONFIG['webdir'].'/type/GenericStacked.class.php'; | ||
7 | |||
8 | ## LAYOUT | ||
9 | # irq/ | ||
10 | # irq/irq-XX.rrd | ||
11 | |||
12 | # grouped | ||
13 | require_once $CONFIG['webdir'].'/inc/collectd.inc.php'; | ||
14 | $tinstance = collectd_plugindetail($host, $plugin, 'ti'); | ||
15 | sort($tinstance); | ||
16 | |||
17 | $obj = new Type_GenericStacked; | ||
18 | $obj->datadir = $CONFIG['datadir']; | ||
19 | $obj->path_format = '{host}/{plugin}/{type}-{tinstance}.rrd'; | ||
20 | $obj->args = array( | ||
21 | 'host' => $host, | ||
22 | 'plugin' => $plugin, | ||
23 | 'pinstance' => $pinstance, | ||
24 | 'type' => $type, | ||
25 | 'tinstance' => $tinstance, | ||
26 | ); | ||
27 | $obj->data_sources = array('value'); | ||
28 | $obj->ds_names = NULL; | ||
29 | $obj->colors = NULL; | ||
30 | $obj->width = $width; | ||
31 | $obj->heigth = $heigth; | ||
32 | $obj->seconds = $seconds; | ||
33 | |||
34 | $obj->rrd_title = "Interrupts on $host"; | ||
35 | $obj->rrd_vertical = 'IRQs/s'; | ||
36 | $obj->rrd_format = '%6.1lf'; | ||
37 | |||
38 | $obj->rrd_graph(); | ||
39 | |||
40 | ?> | ||
diff --git a/plugin/load.php b/plugin/load.php new file mode 100644 index 0000000..d7db740 --- /dev/null +++ b/plugin/load.php | |||
@@ -0,0 +1,41 @@ | |||
1 | <?php | ||
2 | |||
3 | # Collectd Load plugin | ||
4 | |||
5 | require_once $CONFIG['webdir'].'/conf/config.php'; | ||
6 | require_once $CONFIG['webdir'].'/type/Default.class.php'; | ||
7 | |||
8 | ## LAYOUT | ||
9 | # load/load.rrd | ||
10 | |||
11 | $obj = new Type_Default; | ||
12 | $obj->datadir = $CONFIG['datadir']; | ||
13 | $obj->path_format = '{host}/{plugin}/{type}.rrd'; | ||
14 | $obj->args = array( | ||
15 | 'host' => $host, | ||
16 | 'plugin' => $plugin, | ||
17 | 'pinstance' => $pinstance, | ||
18 | 'type' => $type, | ||
19 | 'tinstance' => $tinstance, | ||
20 | ); | ||
21 | $obj->data_sources = array('shortterm', 'midterm', 'longterm'); | ||
22 | $obj->ds_names = array( | ||
23 | 'shortterm' => ' 1 min', | ||
24 | 'midterm' => ' 5 min', | ||
25 | 'longterm' => '15 min', | ||
26 | ); | ||
27 | $obj->colors = array( | ||
28 | 'shortterm' => '00ff00', | ||
29 | 'midterm' => '0000ff', | ||
30 | 'longterm' => 'ff0000', | ||
31 | ); | ||
32 | $obj->width = $width; | ||
33 | $obj->heigth = $heigth; | ||
34 | $obj->seconds = $seconds; | ||
35 | $obj->rrd_title = "System load on $host"; | ||
36 | $obj->rrd_vertical = 'System load'; | ||
37 | $obj->rrd_format = '%.2lf'; | ||
38 | |||
39 | $obj->rrd_graph(); | ||
40 | |||
41 | ?> | ||
diff --git a/plugin/memory.php b/plugin/memory.php new file mode 100644 index 0000000..7944238 --- /dev/null +++ b/plugin/memory.php | |||
@@ -0,0 +1,53 @@ | |||
1 | <?php | ||
2 | |||
3 | # Collectd Memory plugin | ||
4 | |||
5 | require_once $CONFIG['webdir'].'/conf/config.php'; | ||
6 | require_once $CONFIG['webdir'].'/type/GenericStacked.class.php'; | ||
7 | |||
8 | ## LAYOUT | ||
9 | # memory/ | ||
10 | # memory/memory-buffered.rrd | ||
11 | # memory/memory-cached.rrd | ||
12 | # memory/memory-free.rrd | ||
13 | # memory/memory-used.rrd | ||
14 | |||
15 | # grouped | ||
16 | require_once $CONFIG['webdir'].'/inc/collectd.inc.php'; | ||
17 | $tinstance = collectd_plugindetail($host, $plugin, 'ti'); | ||
18 | |||
19 | $obj = new Type_GenericStacked; | ||
20 | $obj->datadir = $CONFIG['datadir']; | ||
21 | $obj->path_format = '{host}/{plugin}/{type}-{tinstance}.rrd'; | ||
22 | $obj->args = array( | ||
23 | 'host' => $host, | ||
24 | 'plugin' => $plugin, | ||
25 | 'pinstance' => $pinstance, | ||
26 | 'type' => $type, | ||
27 | 'tinstance' => $tinstance, | ||
28 | ); | ||
29 | $obj->data_sources = array('value'); | ||
30 | $obj->order = array('free', 'buffered', 'cached', 'used'); | ||
31 | $obj->ds_names = array( | ||
32 | 'free' => 'Free ', | ||
33 | 'cached' => 'Cached ', | ||
34 | 'buffered' => 'Buffered', | ||
35 | 'used' => 'Used ', | ||
36 | ); | ||
37 | $obj->colors = array( | ||
38 | 'free' => '00e000', | ||
39 | 'cached' => '0000ff', | ||
40 | 'buffered' => 'ffb000', | ||
41 | 'used' => 'ff0000', | ||
42 | ); | ||
43 | $obj->width = $width; | ||
44 | $obj->heigth = $heigth; | ||
45 | $obj->seconds = $seconds; | ||
46 | |||
47 | $obj->rrd_title = "Physical memory utilization on $host"; | ||
48 | $obj->rrd_vertical = 'Bytes'; | ||
49 | $obj->rrd_format = '%5.1lf%s'; | ||
50 | |||
51 | $obj->rrd_graph(); | ||
52 | |||
53 | ?> | ||
diff --git a/plugin/processes.php b/plugin/processes.php new file mode 100644 index 0000000..445e1e4 --- /dev/null +++ b/plugin/processes.php | |||
@@ -0,0 +1,58 @@ | |||
1 | <?php | ||
2 | |||
3 | # Collectd CPU plugin | ||
4 | |||
5 | require_once $CONFIG['webdir'].'/conf/config.php'; | ||
6 | require_once $CONFIG['webdir'].'/type/GenericStacked.class.php'; | ||
7 | |||
8 | ## LAYOUT | ||
9 | # processes/ | ||
10 | # processes/ps_state-paging.rrd | ||
11 | # processes/ps_state-blocked.rrd | ||
12 | # processes/ps_state-zombies.rrd | ||
13 | # processes/ps_state-stopped.rrd | ||
14 | # processes/ps_state-running.rrd | ||
15 | # processes/ps_state-sleeping.rrd | ||
16 | |||
17 | # grouped | ||
18 | require_once $CONFIG['webdir'].'/inc/collectd.inc.php'; | ||
19 | $tinstance = collectd_plugindetail($host, $plugin, 'ti'); | ||
20 | |||
21 | $obj = new Type_GenericStacked; | ||
22 | $obj->datadir = $CONFIG['datadir']; | ||
23 | $obj->path_format = '{host}/{plugin}/{type}-{tinstance}.rrd'; | ||
24 | $obj->args = array( | ||
25 | 'host' => $host, | ||
26 | 'plugin' => $plugin, | ||
27 | 'pinstance' => $pinstance, | ||
28 | 'type' => $type, | ||
29 | 'tinstance' => $tinstance, | ||
30 | ); | ||
31 | $obj->data_sources = array('value'); | ||
32 | $obj->ds_names = array( | ||
33 | 'paging' => 'Paging ', | ||
34 | 'blocked' => 'Blocked ', | ||
35 | 'zombies' => 'Zombies ', | ||
36 | 'stopped' => 'Stopped ', | ||
37 | 'running' => 'Running ', | ||
38 | 'sleeping' => 'Sleeping', | ||
39 | ); | ||
40 | $obj->colors = array( | ||
41 | 'paging' => 'ffb000', | ||
42 | 'blocked' => 'ff00ff', | ||
43 | 'zombies' => 'ff0000', | ||
44 | 'stopped' => 'a000a0', | ||
45 | 'running' => '00e000', | ||
46 | 'sleeping' => '0000ff', | ||
47 | ); | ||
48 | $obj->width = $width; | ||
49 | $obj->heigth = $heigth; | ||
50 | $obj->seconds = $seconds; | ||
51 | |||
52 | $obj->rrd_title = "Processes on $host"; | ||
53 | $obj->rrd_vertical = 'Processes'; | ||
54 | $obj->rrd_format = '%5.1lf%s'; | ||
55 | |||
56 | $obj->rrd_graph(); | ||
57 | |||
58 | ?> | ||
diff --git a/plugin/sensors.php b/plugin/sensors.php new file mode 100644 index 0000000..ad43378 --- /dev/null +++ b/plugin/sensors.php | |||
@@ -0,0 +1,58 @@ | |||
1 | <?php | ||
2 | |||
3 | # Collectd Sensors plugin | ||
4 | |||
5 | require_once $CONFIG['webdir'].'/conf/config.php'; | ||
6 | require_once $CONFIG['webdir'].'/type/Default.class.php'; | ||
7 | |||
8 | ## LAYOUT | ||
9 | # disk-XXXX/ | ||
10 | # disk-XXXX/fanspeed-XXXX.rrd | ||
11 | # disk-XXXX/temerature-XXXX.rrd | ||
12 | # disk-XXXX/voltage-XXXX.rrd | ||
13 | |||
14 | # grouped | ||
15 | require_once $CONFIG['webdir'].'/inc/collectd.inc.php'; | ||
16 | $tinstance = collectd_plugindetail($host, $plugin, 'ti', array('t' => $type)); | ||
17 | |||
18 | $obj = new Type_Default; | ||
19 | $obj->datadir = $CONFIG['datadir']; | ||
20 | $obj->path_format = '{host}/{plugin}-{pinstance}/{type}-{tinstance}.rrd'; | ||
21 | $obj->args = array( | ||
22 | 'host' => $host, | ||
23 | 'plugin' => $plugin, | ||
24 | 'pinstance' => $pinstance, | ||
25 | 'type' => $type, | ||
26 | 'tinstance' => $tinstance, | ||
27 | ); | ||
28 | $obj->data_sources = array('value'); | ||
29 | $obj->ds_names = array( | ||
30 | 'value' => 'Value ', | ||
31 | ); | ||
32 | $obj->width = $width; | ||
33 | $obj->heigth = $heigth; | ||
34 | $obj->seconds = $seconds; | ||
35 | switch($type) { | ||
36 | case 'fanspeed': | ||
37 | $obj->colors = '00ff00'; | ||
38 | $obj->rrd_title = "Fanspeed ($pinstance) on $host"; | ||
39 | $obj->rrd_vertical = 'RPM'; | ||
40 | $obj->rrd_format = '%5.1lf'; | ||
41 | break; | ||
42 | case 'temperature': | ||
43 | $obj->colors = '0000ff'; | ||
44 | $obj->rrd_title = "Temperature ($pinstance) on $host"; | ||
45 | $obj->rrd_vertical = 'Celius'; | ||
46 | $obj->rrd_format = '%5.1lf%s'; | ||
47 | break; | ||
48 | case 'voltage': | ||
49 | $obj->colors = 'ff0000'; | ||
50 | $obj->rrd_title = "Voltage ($pinstance) on $host"; | ||
51 | $obj->rrd_vertical = 'Volt'; | ||
52 | $obj->rrd_format = '%5.1lf'; | ||
53 | break; | ||
54 | } | ||
55 | |||
56 | $obj->rrd_graph(); | ||
57 | |||
58 | ?> | ||
diff --git a/plugin/swap.php b/plugin/swap.php new file mode 100644 index 0000000..dfd9ba1 --- /dev/null +++ b/plugin/swap.php | |||
@@ -0,0 +1,50 @@ | |||
1 | <?php | ||
2 | |||
3 | # Collectd Swap plugin | ||
4 | |||
5 | require_once $CONFIG['webdir'].'/conf/config.php'; | ||
6 | require_once $CONFIG['webdir'].'/type/GenericStacked.class.php'; | ||
7 | |||
8 | ## LAYOUT | ||
9 | # swap/ | ||
10 | # swap/swap-cached.rrd | ||
11 | # swap/swap-free.rrd | ||
12 | # swap/swap-used.rrd | ||
13 | |||
14 | # grouped | ||
15 | require_once $CONFIG['webdir'].'/inc/collectd.inc.php'; | ||
16 | $tinstance = collectd_plugindetail($host, $plugin, 'ti'); | ||
17 | |||
18 | $obj = new Type_GenericStacked; | ||
19 | $obj->datadir = $CONFIG['datadir']; | ||
20 | $obj->path_format = '{host}/{plugin}/{type}-{tinstance}.rrd'; | ||
21 | $obj->args = array( | ||
22 | 'host' => $host, | ||
23 | 'plugin' => $plugin, | ||
24 | 'pinstance' => $pinstance, | ||
25 | 'type' => $type, | ||
26 | 'tinstance' => $tinstance, | ||
27 | ); | ||
28 | $obj->data_sources = array('value'); | ||
29 | $obj->order = array('free', 'cached', 'used'); | ||
30 | $obj->ds_names = array( | ||
31 | 'free' => 'Free ', | ||
32 | 'cached' => 'Cached ', | ||
33 | 'used' => 'Used ', | ||
34 | ); | ||
35 | $obj->colors = array( | ||
36 | 'free' => '00e000', | ||
37 | 'cached' => '0000ff', | ||
38 | 'used' => 'ff0000', | ||
39 | ); | ||
40 | $obj->width = $width; | ||
41 | $obj->heigth = $heigth; | ||
42 | $obj->seconds = $seconds; | ||
43 | |||
44 | $obj->rrd_title = "Swap utilization on $host"; | ||
45 | $obj->rrd_vertical = 'Bytes'; | ||
46 | $obj->rrd_format = '%5.1lf%s'; | ||
47 | |||
48 | $obj->rrd_graph(); | ||
49 | |||
50 | ?> | ||
diff --git a/plugin/users.php b/plugin/users.php new file mode 100644 index 0000000..dfcaee3 --- /dev/null +++ b/plugin/users.php | |||
@@ -0,0 +1,37 @@ | |||
1 | <?php | ||
2 | |||
3 | # Collectd Users plugin | ||
4 | |||
5 | require_once $CONFIG['webdir'].'/conf/config.php'; | ||
6 | require_once $CONFIG['webdir'].'/type/Default.class.php'; | ||
7 | |||
8 | ## LAYOUT | ||
9 | # users/users.rrd | ||
10 | |||
11 | $obj = new Type_Default; | ||
12 | $obj->datadir = $CONFIG['datadir']; | ||
13 | $obj->path_format = '{host}/{plugin}/{type}.rrd'; | ||
14 | $obj->args = array( | ||
15 | 'host' => $host, | ||
16 | 'plugin' => $plugin, | ||
17 | 'pinstance' => $pinstance, | ||
18 | 'type' => $type, | ||
19 | 'tinstance' => $tinstance, | ||
20 | ); | ||
21 | $obj->data_sources = array('users'); | ||
22 | $obj->ds_names = array( | ||
23 | 'users' => 'Users', | ||
24 | ); | ||
25 | $obj->colors = array( | ||
26 | 'users' => '0000f0', | ||
27 | ); | ||
28 | $obj->width = $width; | ||
29 | $obj->heigth = $heigth; | ||
30 | $obj->seconds = $seconds; | ||
31 | $obj->rrd_title = "Users on $host"; | ||
32 | $obj->rrd_vertical = 'Users'; | ||
33 | $obj->rrd_format = '%.1lf'; | ||
34 | |||
35 | $obj->rrd_graph(); | ||
36 | |||
37 | ?> | ||