diff options
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/cpu.php | 21 | ||||
-rw-r--r-- | plugin/df.php | 16 | ||||
-rw-r--r-- | plugin/disk.php | 24 | ||||
-rw-r--r-- | plugin/entropy.php | 14 | ||||
-rw-r--r-- | plugin/interface.php | 23 | ||||
-rw-r--r-- | plugin/irq.php | 23 | ||||
-rw-r--r-- | plugin/load.php | 14 | ||||
-rw-r--r-- | plugin/memory.php | 20 | ||||
-rw-r--r-- | plugin/processes.php | 20 | ||||
-rw-r--r-- | plugin/sensors.php | 28 | ||||
-rw-r--r-- | plugin/swap.php | 22 | ||||
-rw-r--r-- | plugin/users.php | 14 |
12 files changed, 47 insertions, 192 deletions
diff --git a/plugin/cpu.php b/plugin/cpu.php index 4cc74f6..d4097b0 100644 --- a/plugin/cpu.php +++ b/plugin/cpu.php | |||
@@ -4,6 +4,7 @@ | |||
4 | 4 | ||
5 | require_once 'conf/common.inc.php'; | 5 | require_once 'conf/common.inc.php'; |
6 | require_once 'type/GenericStacked.class.php'; | 6 | require_once 'type/GenericStacked.class.php'; |
7 | require_once 'inc/collectd.inc.php'; | ||
7 | 8 | ||
8 | ## LAYOUT | 9 | ## LAYOUT |
9 | # cpu-X/ | 10 | # cpu-X/ |
@@ -16,19 +17,7 @@ require_once 'type/GenericStacked.class.php'; | |||
16 | # cpu-X/cpu-user.rrd | 17 | # cpu-X/cpu-user.rrd |
17 | # cpu-X/cpu-wait.rrd | 18 | # cpu-X/cpu-wait.rrd |
18 | 19 | ||
19 | # grouped | 20 | $obj = new Type_GenericStacked($CONFIG['datadir']); |
20 | require_once 'inc/collectd.inc.php'; | ||
21 | $tinstance = collectd_plugindetail($host, $plugin, 'ti'); | ||
22 | |||
23 | $obj = new Type_GenericStacked; | ||
24 | $obj->datadir = $CONFIG['datadir']; | ||
25 | $obj->args = array( | ||
26 | 'host' => $host, | ||
27 | 'plugin' => $plugin, | ||
28 | 'pinstance' => $pinstance, | ||
29 | 'type' => $type, | ||
30 | 'tinstance' => $tinstance, | ||
31 | ); | ||
32 | $obj->data_sources = array('value'); | 21 | $obj->data_sources = array('value'); |
33 | $obj->order = array('idle', 'nice', 'user', 'wait', 'system', 'softirq', 'interrupt', 'steal'); | 22 | $obj->order = array('idle', 'nice', 'user', 'wait', 'system', 'softirq', 'interrupt', 'steal'); |
34 | $obj->ds_names = array( | 23 | $obj->ds_names = array( |
@@ -53,14 +42,12 @@ $obj->colors = array( | |||
53 | ); | 42 | ); |
54 | $obj->width = $width; | 43 | $obj->width = $width; |
55 | $obj->heigth = $heigth; | 44 | $obj->heigth = $heigth; |
56 | $obj->seconds = $seconds; | ||
57 | 45 | ||
58 | $obj->rrd_title = sprintf('CPU-%s usage', $pinstance); | 46 | $obj->rrd_title = sprintf('CPU-%s usage', $obj->args['pinstance']); |
59 | $obj->rrd_vertical = 'Jiffies'; | 47 | $obj->rrd_vertical = 'Jiffies'; |
60 | $obj->rrd_format = '%5.2lf'; | 48 | $obj->rrd_format = '%5.2lf'; |
61 | 49 | ||
62 | collectd_flush(ident_from_args($obj->args)); | 50 | collectd_flush($obj->identifiers); |
63 | |||
64 | $obj->rrd_graph(); | 51 | $obj->rrd_graph(); |
65 | 52 | ||
66 | ?> | 53 | ?> |
diff --git a/plugin/df.php b/plugin/df.php index bf9b850..79c5cb5 100644 --- a/plugin/df.php +++ b/plugin/df.php | |||
@@ -11,15 +11,7 @@ require_once 'inc/collectd.inc.php'; | |||
11 | # df/ | 11 | # df/ |
12 | # df/df-XXXX.rrd | 12 | # df/df-XXXX.rrd |
13 | 13 | ||
14 | $obj = new Type_GenericStacked; | 14 | $obj = new Type_GenericStacked($CONFIG['datadir']); |
15 | $obj->datadir = $CONFIG['datadir']; | ||
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'); | 15 | $obj->data_sources = array('free', 'used'); |
24 | $obj->ds_names = array( | 16 | $obj->ds_names = array( |
25 | 'free' => 'Free', | 17 | 'free' => 'Free', |
@@ -31,14 +23,12 @@ $obj->colors = array( | |||
31 | ); | 23 | ); |
32 | $obj->width = $width; | 24 | $obj->width = $width; |
33 | $obj->heigth = $heigth; | 25 | $obj->heigth = $heigth; |
34 | $obj->seconds = $seconds; | ||
35 | 26 | ||
36 | $obj->rrd_title = sprintf('Free space (%s)', $tinstance); | 27 | $obj->rrd_title = sprintf('Free space (%s)', $obj->args['tinstance']); |
37 | $obj->rrd_vertical = 'Bytes'; | 28 | $obj->rrd_vertical = 'Bytes'; |
38 | $obj->rrd_format = '%5.1lf%sB'; | 29 | $obj->rrd_format = '%5.1lf%sB'; |
39 | 30 | ||
40 | collectd_flush(ident_from_args($obj->args)); | 31 | collectd_flush($obj->identifiers); |
41 | |||
42 | $obj->rrd_graph(); | 32 | $obj->rrd_graph(); |
43 | 33 | ||
44 | ?> | 34 | ?> |
diff --git a/plugin/disk.php b/plugin/disk.php index 620b188..f1100d6 100644 --- a/plugin/disk.php +++ b/plugin/disk.php | |||
@@ -13,15 +13,7 @@ require_once 'inc/collectd.inc.php'; | |||
13 | # disk-XXXX/disk_ops.rrd | 13 | # disk-XXXX/disk_ops.rrd |
14 | # disk-XXXX/disk_time.rrd | 14 | # disk-XXXX/disk_time.rrd |
15 | 15 | ||
16 | $obj = new Type_GenericIO; | 16 | $obj = new Type_GenericIO($CONFIG['datadir']); |
17 | $obj->datadir = $CONFIG['datadir']; | ||
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'); | 17 | $obj->data_sources = array('read', 'write'); |
26 | $obj->ds_names = array( | 18 | $obj->ds_names = array( |
27 | 'read' => 'Read ', | 19 | 'read' => 'Read ', |
@@ -33,33 +25,31 @@ $obj->colors = array( | |||
33 | ); | 25 | ); |
34 | $obj->width = $width; | 26 | $obj->width = $width; |
35 | $obj->heigth = $heigth; | 27 | $obj->heigth = $heigth; |
36 | $obj->seconds = $seconds; | 28 | switch($obj->args['type']) { |
37 | switch($type) { | ||
38 | case 'disk_merged': | 29 | case 'disk_merged': |
39 | $obj->rrd_title = sprintf('Disk Merged Operations (%s)', $pinstance); | 30 | $obj->rrd_title = sprintf('Disk Merged Operations (%s)', $obj->args['pinstance']); |
40 | $obj->rrd_vertical = 'Merged operations/s'; | 31 | $obj->rrd_vertical = 'Merged operations/s'; |
41 | $obj->rrd_format = '%5.1lf'; | 32 | $obj->rrd_format = '%5.1lf'; |
42 | break; | 33 | break; |
43 | case 'disk_octets': | 34 | case 'disk_octets': |
44 | $obj->rrd_title = sprintf('Disk Traffic (%s)', $pinstance); | 35 | $obj->rrd_title = sprintf('Disk Traffic (%s)', $obj->args['pinstance']); |
45 | $obj->rrd_vertical = 'Bytes per second'; | 36 | $obj->rrd_vertical = 'Bytes per second'; |
46 | $obj->rrd_format = '%5.1lf%s'; | 37 | $obj->rrd_format = '%5.1lf%s'; |
47 | break; | 38 | break; |
48 | case 'disk_ops': | 39 | case 'disk_ops': |
49 | $obj->rrd_title = sprintf('Disk Operations (%s)', $pinstance); | 40 | $obj->rrd_title = sprintf('Disk Operations (%s)', $obj->args['pinstance']); |
50 | $obj->rrd_vertical = 'Ops per second'; | 41 | $obj->rrd_vertical = 'Ops per second'; |
51 | $obj->rrd_format = '%5.1lf'; | 42 | $obj->rrd_format = '%5.1lf'; |
52 | break; | 43 | break; |
53 | case 'disk_time': | 44 | case 'disk_time': |
54 | $obj->rrd_title = sprintf('Disk time per operation (%s)', $pinstance); | 45 | $obj->rrd_title = sprintf('Disk time per operation (%s)', $obj->args['pinstance']); |
55 | $obj->rrd_vertical = 'Avg. Time/Op'; | 46 | $obj->rrd_vertical = 'Avg. Time/Op'; |
56 | $obj->rrd_format = '%5.1lf%ss'; | 47 | $obj->rrd_format = '%5.1lf%ss'; |
57 | $obj->scale = '0.001'; | 48 | $obj->scale = '0.001'; |
58 | break; | 49 | break; |
59 | } | 50 | } |
60 | 51 | ||
61 | collectd_flush(ident_from_args($obj->args)); | 52 | collectd_flush($obj->identifiers); |
62 | |||
63 | $obj->rrd_graph(); | 53 | $obj->rrd_graph(); |
64 | 54 | ||
65 | ?> | 55 | ?> |
diff --git a/plugin/entropy.php b/plugin/entropy.php index 6ee96aa..8705894 100644 --- a/plugin/entropy.php +++ b/plugin/entropy.php | |||
@@ -9,15 +9,7 @@ require_once 'inc/collectd.inc.php'; | |||
9 | ## LAYOUT | 9 | ## LAYOUT |
10 | # entropy/entropy.rrd | 10 | # entropy/entropy.rrd |
11 | 11 | ||
12 | $obj = new Type_Default; | 12 | $obj = new Type_Default($CONFIG['datadir']); |
13 | $obj->datadir = $CONFIG['datadir']; | ||
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'); | 13 | $obj->data_sources = array('entropy'); |
22 | $obj->ds_names = array( | 14 | $obj->ds_names = array( |
23 | 'entropy' => 'Entropy bits', | 15 | 'entropy' => 'Entropy bits', |
@@ -27,13 +19,11 @@ $obj->colors = array( | |||
27 | ); | 19 | ); |
28 | $obj->width = $width; | 20 | $obj->width = $width; |
29 | $obj->heigth = $heigth; | 21 | $obj->heigth = $heigth; |
30 | $obj->seconds = $seconds; | ||
31 | $obj->rrd_title = 'Available entropy'; | 22 | $obj->rrd_title = 'Available entropy'; |
32 | $obj->rrd_vertical = 'Bits'; | 23 | $obj->rrd_vertical = 'Bits'; |
33 | $obj->rrd_format = '%4.0lf'; | 24 | $obj->rrd_format = '%4.0lf'; |
34 | 25 | ||
35 | collectd_flush(ident_from_args($obj->args)); | 26 | collectd_flush($obj->identifiers); |
36 | |||
37 | $obj->rrd_graph(); | 27 | $obj->rrd_graph(); |
38 | 28 | ||
39 | ?> | 29 | ?> |
diff --git a/plugin/interface.php b/plugin/interface.php index 7d8d929..89e4280 100644 --- a/plugin/interface.php +++ b/plugin/interface.php | |||
@@ -12,15 +12,7 @@ require_once 'inc/collectd.inc.php'; | |||
12 | # interface/if_octets-XXXX.rrd | 12 | # interface/if_octets-XXXX.rrd |
13 | # interface/if_packets-XXXX.rrd | 13 | # interface/if_packets-XXXX.rrd |
14 | 14 | ||
15 | $obj = new Type_GenericIO; | 15 | $obj = new Type_GenericIO($CONFIG['datadir']); |
16 | $obj->datadir = $CONFIG['datadir']; | ||
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'); | 16 | $obj->data_sources = array('rx', 'tx'); |
25 | $obj->ds_names = array( | 17 | $obj->ds_names = array( |
26 | 'rx' => 'Receive ', | 18 | 'rx' => 'Receive ', |
@@ -32,25 +24,24 @@ $obj->colors = array( | |||
32 | ); | 24 | ); |
33 | $obj->width = $width; | 25 | $obj->width = $width; |
34 | $obj->heigth = $heigth; | 26 | $obj->heigth = $heigth; |
35 | $obj->seconds = $seconds; | ||
36 | $obj->rrd_format = '%5.1lf%s'; | 27 | $obj->rrd_format = '%5.1lf%s'; |
37 | switch($type) { | 28 | |
29 | switch($obj->args['type']) { | ||
38 | case 'if_errors': | 30 | case 'if_errors': |
39 | $obj->rrd_title = sprintf('Interface Errors (%s)', $tinstance); | 31 | $obj->rrd_title = sprintf('Interface Errors (%s)', $obj->args['tinstance']); |
40 | $obj->rrd_vertical = 'Errors per second'; | 32 | $obj->rrd_vertical = 'Errors per second'; |
41 | break; | 33 | break; |
42 | case 'if_octets': | 34 | case 'if_octets': |
43 | $obj->rrd_title = sprintf('Interface Traffic (%s)', $tinstance); | 35 | $obj->rrd_title = sprintf('Interface Traffic (%s)', $obj->args['tinstance']); |
44 | $obj->rrd_vertical = 'Bits per second'; | 36 | $obj->rrd_vertical = 'Bits per second'; |
45 | break; | 37 | break; |
46 | case 'if_packets': | 38 | case 'if_packets': |
47 | $obj->rrd_title = sprintf('Interface Packets (%s)', $tinstance); | 39 | $obj->rrd_title = sprintf('Interface Packets (%s)', $obj->args['tinstance']); |
48 | $obj->rrd_vertical = 'Packets per second'; | 40 | $obj->rrd_vertical = 'Packets per second'; |
49 | break; | 41 | break; |
50 | } | 42 | } |
51 | 43 | ||
52 | collectd_flush(ident_from_args($obj->args)); | 44 | collectd_flush($obj->identifiers); |
53 | |||
54 | $obj->rrd_graph(); | 45 | $obj->rrd_graph(); |
55 | 46 | ||
56 | ?> | 47 | ?> |
diff --git a/plugin/irq.php b/plugin/irq.php index d6b1e72..ba0e7cb 100644 --- a/plugin/irq.php +++ b/plugin/irq.php | |||
@@ -4,38 +4,21 @@ | |||
4 | 4 | ||
5 | require_once 'conf/common.inc.php'; | 5 | require_once 'conf/common.inc.php'; |
6 | require_once 'type/GenericStacked.class.php'; | 6 | require_once 'type/GenericStacked.class.php'; |
7 | require_once 'inc/collectd.inc.php'; | ||
7 | 8 | ||
8 | ## LAYOUT | 9 | ## LAYOUT |
9 | # irq/ | 10 | # irq/ |
10 | # irq/irq-XX.rrd | 11 | # irq/irq-XX.rrd |
11 | 12 | ||
12 | # grouped | 13 | $obj = new Type_GenericStacked($CONFIG['datadir']); |
13 | require_once '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->args = array( | ||
20 | 'host' => $host, | ||
21 | 'plugin' => $plugin, | ||
22 | 'pinstance' => $pinstance, | ||
23 | 'type' => $type, | ||
24 | 'tinstance' => $tinstance, | ||
25 | ); | ||
26 | $obj->data_sources = array('value'); | ||
27 | $obj->ds_names = NULL; | ||
28 | $obj->colors = NULL; | ||
29 | $obj->width = $width; | 14 | $obj->width = $width; |
30 | $obj->heigth = $heigth; | 15 | $obj->heigth = $heigth; |
31 | $obj->seconds = $seconds; | ||
32 | 16 | ||
33 | $obj->rrd_title = 'Interrupts'; | 17 | $obj->rrd_title = 'Interrupts'; |
34 | $obj->rrd_vertical = 'IRQs/s'; | 18 | $obj->rrd_vertical = 'IRQs/s'; |
35 | $obj->rrd_format = '%6.1lf'; | 19 | $obj->rrd_format = '%6.1lf'; |
36 | 20 | ||
37 | collectd_flush(ident_from_args($obj->args)); | 21 | collectd_flush($obj->identifiers); |
38 | |||
39 | $obj->rrd_graph(); | 22 | $obj->rrd_graph(); |
40 | 23 | ||
41 | ?> | 24 | ?> |
diff --git a/plugin/load.php b/plugin/load.php index 523f14c..44baf45 100644 --- a/plugin/load.php +++ b/plugin/load.php | |||
@@ -9,15 +9,7 @@ require_once 'inc/collectd.inc.php'; | |||
9 | ## LAYOUT | 9 | ## LAYOUT |
10 | # load/load.rrd | 10 | # load/load.rrd |
11 | 11 | ||
12 | $obj = new Type_Default; | 12 | $obj = new Type_Default($CONFIG['datadir']); |
13 | $obj->datadir = $CONFIG['datadir']; | ||
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'); | 13 | $obj->data_sources = array('shortterm', 'midterm', 'longterm'); |
22 | $obj->ds_names = array( | 14 | $obj->ds_names = array( |
23 | 'shortterm' => ' 1 min', | 15 | 'shortterm' => ' 1 min', |
@@ -31,13 +23,11 @@ $obj->colors = array( | |||
31 | ); | 23 | ); |
32 | $obj->width = $width; | 24 | $obj->width = $width; |
33 | $obj->heigth = $heigth; | 25 | $obj->heigth = $heigth; |
34 | $obj->seconds = $seconds; | ||
35 | $obj->rrd_title = 'System load'; | 26 | $obj->rrd_title = 'System load'; |
36 | $obj->rrd_vertical = 'System load'; | 27 | $obj->rrd_vertical = 'System load'; |
37 | $obj->rrd_format = '%.2lf'; | 28 | $obj->rrd_format = '%.2lf'; |
38 | 29 | ||
39 | collectd_flush(ident_from_args($obj->args)); | 30 | collectd_flush($obj->identifiers); |
40 | |||
41 | $obj->rrd_graph(); | 31 | $obj->rrd_graph(); |
42 | 32 | ||
43 | ?> | 33 | ?> |
diff --git a/plugin/memory.php b/plugin/memory.php index b0f6b73..ade242c 100644 --- a/plugin/memory.php +++ b/plugin/memory.php | |||
@@ -4,6 +4,7 @@ | |||
4 | 4 | ||
5 | require_once 'conf/common.inc.php'; | 5 | require_once 'conf/common.inc.php'; |
6 | require_once 'type/GenericStacked.class.php'; | 6 | require_once 'type/GenericStacked.class.php'; |
7 | require_once 'inc/collectd.inc.php'; | ||
7 | 8 | ||
8 | ## LAYOUT | 9 | ## LAYOUT |
9 | # memory/ | 10 | # memory/ |
@@ -12,20 +13,7 @@ require_once 'type/GenericStacked.class.php'; | |||
12 | # memory/memory-free.rrd | 13 | # memory/memory-free.rrd |
13 | # memory/memory-used.rrd | 14 | # memory/memory-used.rrd |
14 | 15 | ||
15 | # grouped | 16 | $obj = new Type_GenericStacked($CONFIG['datadir']); |
16 | require_once 'inc/collectd.inc.php'; | ||
17 | $tinstance = collectd_plugindetail($host, $plugin, 'ti'); | ||
18 | |||
19 | $obj = new Type_GenericStacked; | ||
20 | $obj->datadir = $CONFIG['datadir']; | ||
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', 'buffered', 'cached', 'used'); | 17 | $obj->order = array('free', 'buffered', 'cached', 'used'); |
30 | $obj->ds_names = array( | 18 | $obj->ds_names = array( |
31 | 'free' => 'Free ', | 19 | 'free' => 'Free ', |
@@ -41,14 +29,12 @@ $obj->colors = array( | |||
41 | ); | 29 | ); |
42 | $obj->width = $width; | 30 | $obj->width = $width; |
43 | $obj->heigth = $heigth; | 31 | $obj->heigth = $heigth; |
44 | $obj->seconds = $seconds; | ||
45 | 32 | ||
46 | $obj->rrd_title = 'Physical memory utilization'; | 33 | $obj->rrd_title = 'Physical memory utilization'; |
47 | $obj->rrd_vertical = 'Bytes'; | 34 | $obj->rrd_vertical = 'Bytes'; |
48 | $obj->rrd_format = '%5.1lf%s'; | 35 | $obj->rrd_format = '%5.1lf%s'; |
49 | 36 | ||
50 | collectd_flush(ident_from_args($obj->args)); | 37 | collectd_flush($obj->identifiers); |
51 | |||
52 | $obj->rrd_graph(); | 38 | $obj->rrd_graph(); |
53 | 39 | ||
54 | ?> | 40 | ?> |
diff --git a/plugin/processes.php b/plugin/processes.php index 65e1ddd..1487568 100644 --- a/plugin/processes.php +++ b/plugin/processes.php | |||
@@ -4,6 +4,7 @@ | |||
4 | 4 | ||
5 | require_once 'conf/common.inc.php'; | 5 | require_once 'conf/common.inc.php'; |
6 | require_once 'type/GenericStacked.class.php'; | 6 | require_once 'type/GenericStacked.class.php'; |
7 | require_once 'inc/collectd.inc.php'; | ||
7 | 8 | ||
8 | ## LAYOUT | 9 | ## LAYOUT |
9 | # processes/ | 10 | # processes/ |
@@ -14,20 +15,7 @@ require_once 'type/GenericStacked.class.php'; | |||
14 | # processes/ps_state-running.rrd | 15 | # processes/ps_state-running.rrd |
15 | # processes/ps_state-sleeping.rrd | 16 | # processes/ps_state-sleeping.rrd |
16 | 17 | ||
17 | # grouped | 18 | $obj = new Type_GenericStacked($CONFIG['datadir']); |
18 | require_once 'inc/collectd.inc.php'; | ||
19 | $tinstance = collectd_plugindetail($host, $plugin, 'ti'); | ||
20 | |||
21 | $obj = new Type_GenericStacked; | ||
22 | $obj->datadir = $CONFIG['datadir']; | ||
23 | $obj->args = array( | ||
24 | 'host' => $host, | ||
25 | 'plugin' => $plugin, | ||
26 | 'pinstance' => $pinstance, | ||
27 | 'type' => $type, | ||
28 | 'tinstance' => $tinstance, | ||
29 | ); | ||
30 | $obj->data_sources = array('value'); | ||
31 | $obj->ds_names = array( | 19 | $obj->ds_names = array( |
32 | 'paging' => 'Paging ', | 20 | 'paging' => 'Paging ', |
33 | 'blocked' => 'Blocked ', | 21 | 'blocked' => 'Blocked ', |
@@ -46,14 +34,12 @@ $obj->colors = array( | |||
46 | ); | 34 | ); |
47 | $obj->width = $width; | 35 | $obj->width = $width; |
48 | $obj->heigth = $heigth; | 36 | $obj->heigth = $heigth; |
49 | $obj->seconds = $seconds; | ||
50 | 37 | ||
51 | $obj->rrd_title = 'Processes'; | 38 | $obj->rrd_title = 'Processes'; |
52 | $obj->rrd_vertical = 'Processes'; | 39 | $obj->rrd_vertical = 'Processes'; |
53 | $obj->rrd_format = '%5.1lf%s'; | 40 | $obj->rrd_format = '%5.1lf%s'; |
54 | 41 | ||
55 | collectd_flush(ident_from_args($obj->args)); | 42 | collectd_flush($obj->identifiers); |
56 | |||
57 | $obj->rrd_graph(); | 43 | $obj->rrd_graph(); |
58 | 44 | ||
59 | ?> | 45 | ?> |
diff --git a/plugin/sensors.php b/plugin/sensors.php index 048f9f1..fda5432 100644 --- a/plugin/sensors.php +++ b/plugin/sensors.php | |||
@@ -4,6 +4,7 @@ | |||
4 | 4 | ||
5 | require_once 'conf/common.inc.php'; | 5 | require_once 'conf/common.inc.php'; |
6 | require_once 'type/Default.class.php'; | 6 | require_once 'type/Default.class.php'; |
7 | require_once 'inc/collectd.inc.php'; | ||
7 | 8 | ||
8 | ## LAYOUT | 9 | ## LAYOUT |
9 | # disk-XXXX/ | 10 | # disk-XXXX/ |
@@ -11,49 +12,34 @@ require_once 'type/Default.class.php'; | |||
11 | # disk-XXXX/temerature-XXXX.rrd | 12 | # disk-XXXX/temerature-XXXX.rrd |
12 | # disk-XXXX/voltage-XXXX.rrd | 13 | # disk-XXXX/voltage-XXXX.rrd |
13 | 14 | ||
14 | # grouped | 15 | $obj = new Type_Default($CONFIG['datadir']); |
15 | require_once '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->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 = array( | 16 | $obj->ds_names = array( |
29 | 'value' => 'Value ', | 17 | 'value' => 'Value ', |
30 | ); | 18 | ); |
31 | $obj->width = $width; | 19 | $obj->width = $width; |
32 | $obj->heigth = $heigth; | 20 | $obj->heigth = $heigth; |
33 | $obj->seconds = $seconds; | 21 | switch($obj->args['type']) { |
34 | switch($type) { | ||
35 | case 'fanspeed': | 22 | case 'fanspeed': |
36 | $obj->colors = '00ff00'; | 23 | $obj->colors = '00ff00'; |
37 | $obj->rrd_title = sprintf('Fanspeed (%s)', $pinstance); | 24 | $obj->rrd_title = sprintf('Fanspeed (%s)', $obj->args['pinstance']); |
38 | $obj->rrd_vertical = 'RPM'; | 25 | $obj->rrd_vertical = 'RPM'; |
39 | $obj->rrd_format = '%5.1lf'; | 26 | $obj->rrd_format = '%5.1lf'; |
40 | break; | 27 | break; |
41 | case 'temperature': | 28 | case 'temperature': |
42 | $obj->colors = '0000ff'; | 29 | $obj->colors = '0000ff'; |
43 | $obj->rrd_title = sprintf('Temperature (%s)', $pinstance); | 30 | $obj->rrd_title = sprintf('Temperature (%s)', $obj->args['pinstance']); |
44 | $obj->rrd_vertical = 'Celius'; | 31 | $obj->rrd_vertical = 'Celius'; |
45 | $obj->rrd_format = '%5.1lf%s'; | 32 | $obj->rrd_format = '%5.1lf%s'; |
46 | break; | 33 | break; |
47 | case 'voltage': | 34 | case 'voltage': |
48 | $obj->colors = 'ff0000'; | 35 | $obj->colors = 'ff0000'; |
49 | $obj->rrd_title = sprintf('Voltage (%s)', $pinstance); | 36 | $obj->rrd_title = sprintf('Voltage (%s)', $obj->args['pinstance']); |
50 | $obj->rrd_vertical = 'Volt'; | 37 | $obj->rrd_vertical = 'Volt'; |
51 | $obj->rrd_format = '%5.1lf'; | 38 | $obj->rrd_format = '%5.1lf'; |
52 | break; | 39 | break; |
53 | } | 40 | } |
54 | 41 | ||
55 | collectd_flush(ident_from_args($obj->args)); | 42 | collectd_flush($obj->identifiers); |
56 | |||
57 | $obj->rrd_graph(); | 43 | $obj->rrd_graph(); |
58 | 44 | ||
59 | ?> | 45 | ?> |
diff --git a/plugin/swap.php b/plugin/swap.php index 638ddc3..e1527cc 100644 --- a/plugin/swap.php +++ b/plugin/swap.php | |||
@@ -4,6 +4,7 @@ | |||
4 | 4 | ||
5 | require_once 'conf/common.inc.php'; | 5 | require_once 'conf/common.inc.php'; |
6 | require_once 'type/GenericStacked.class.php'; | 6 | require_once 'type/GenericStacked.class.php'; |
7 | require_once 'inc/collectd.inc.php'; | ||
7 | 8 | ||
8 | ## LAYOUT | 9 | ## LAYOUT |
9 | # swap/ | 10 | # swap/ |
@@ -11,25 +12,12 @@ require_once 'type/GenericStacked.class.php'; | |||
11 | # swap/swap-free.rrd | 12 | # swap/swap-free.rrd |
12 | # swap/swap-used.rrd | 13 | # swap/swap-used.rrd |
13 | 14 | ||
14 | if ($type == 'swap_io') { | 15 | if ($_GET['t'] == 'swap_io') { |
15 | die_img('Error: swap_io not supported yet'); | 16 | die_img('Error: swap_io not supported yet'); |
16 | exit; | 17 | exit; |
17 | } | 18 | } |
18 | 19 | ||
19 | # grouped | 20 | $obj = new Type_GenericStacked($CONFIG['datadir']); |
20 | require_once 'inc/collectd.inc.php'; | ||
21 | $tinstance = collectd_plugindetail($host, $plugin, 'ti', array('t' => $type)); | ||
22 | |||
23 | $obj = new Type_GenericStacked; | ||
24 | $obj->datadir = $CONFIG['datadir']; | ||
25 | $obj->args = array( | ||
26 | 'host' => $host, | ||
27 | 'plugin' => $plugin, | ||
28 | 'pinstance' => $pinstance, | ||
29 | 'type' => $type, | ||
30 | 'tinstance' => $tinstance, | ||
31 | ); | ||
32 | $obj->data_sources = array('value'); | ||
33 | $obj->order = array('free', 'cached', 'used'); | 21 | $obj->order = array('free', 'cached', 'used'); |
34 | $obj->ds_names = array( | 22 | $obj->ds_names = array( |
35 | 'free' => 'Free ', | 23 | 'free' => 'Free ', |
@@ -43,14 +31,12 @@ $obj->colors = array( | |||
43 | ); | 31 | ); |
44 | $obj->width = $width; | 32 | $obj->width = $width; |
45 | $obj->heigth = $heigth; | 33 | $obj->heigth = $heigth; |
46 | $obj->seconds = $seconds; | ||
47 | 34 | ||
48 | $obj->rrd_title = 'Swap utilization'; | 35 | $obj->rrd_title = 'Swap utilization'; |
49 | $obj->rrd_vertical = 'Bytes'; | 36 | $obj->rrd_vertical = 'Bytes'; |
50 | $obj->rrd_format = '%5.1lf%s'; | 37 | $obj->rrd_format = '%5.1lf%s'; |
51 | 38 | ||
52 | collectd_flush(ident_from_args($obj->args)); | 39 | collectd_flush($obj->identifiers); |
53 | |||
54 | $obj->rrd_graph(); | 40 | $obj->rrd_graph(); |
55 | 41 | ||
56 | ?> | 42 | ?> |
diff --git a/plugin/users.php b/plugin/users.php index 5ebee43..d94a8c1 100644 --- a/plugin/users.php +++ b/plugin/users.php | |||
@@ -9,15 +9,7 @@ require_once 'inc/collectd.inc.php'; | |||
9 | ## LAYOUT | 9 | ## LAYOUT |
10 | # users/users.rrd | 10 | # users/users.rrd |
11 | 11 | ||
12 | $obj = new Type_Default; | 12 | $obj = new Type_Default($CONFIG['datadir']); |
13 | $obj->datadir = $CONFIG['datadir']; | ||
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'); | 13 | $obj->data_sources = array('users'); |
22 | $obj->ds_names = array( | 14 | $obj->ds_names = array( |
23 | 'users' => 'Users', | 15 | 'users' => 'Users', |
@@ -27,13 +19,11 @@ $obj->colors = array( | |||
27 | ); | 19 | ); |
28 | $obj->width = $width; | 20 | $obj->width = $width; |
29 | $obj->heigth = $heigth; | 21 | $obj->heigth = $heigth; |
30 | $obj->seconds = $seconds; | ||
31 | $obj->rrd_title = 'Users'; | 22 | $obj->rrd_title = 'Users'; |
32 | $obj->rrd_vertical = 'Users'; | 23 | $obj->rrd_vertical = 'Users'; |
33 | $obj->rrd_format = '%.1lf'; | 24 | $obj->rrd_format = '%.1lf'; |
34 | 25 | ||
35 | collectd_flush(ident_from_args($obj->args)); | 26 | collectd_flush($obj->identifiers); |
36 | |||
37 | $obj->rrd_graph(); | 27 | $obj->rrd_graph(); |
38 | 28 | ||
39 | ?> | 29 | ?> |