aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--conf/config.php3
-rw-r--r--inc/html.inc.php2
-rw-r--r--inc/rrdtool.class.php13
-rw-r--r--layout/style.css5
-rw-r--r--plugin/cpu.php2
-rw-r--r--plugin/df.php2
-rw-r--r--plugin/disk.php2
-rw-r--r--plugin/entropy.php2
-rw-r--r--plugin/interface.php2
-rw-r--r--plugin/irq.php2
-rw-r--r--plugin/load.php2
-rw-r--r--plugin/memory.php2
-rw-r--r--plugin/processes.php2
-rw-r--r--plugin/sensors.php2
-rw-r--r--plugin/swap.php4
-rw-r--r--plugin/users.php2
-rw-r--r--type/Default.class.php9
17 files changed, 40 insertions, 18 deletions
diff --git a/conf/config.php b/conf/config.php
index 149348a..d904751 100644
--- a/conf/config.php
+++ b/conf/config.php
@@ -6,6 +6,9 @@ $CONFIG['version'] = 4;
6# collectd's datadir 6# collectd's datadir
7$CONFIG['datadir'] = '/var/lib/collectd/rrd'; 7$CONFIG['datadir'] = '/var/lib/collectd/rrd';
8 8
9# rrdtool executable
10$CONFIG['rrdtool'] = '/usr/bin/rrdtool';
11
9# category of hosts to show on main page 12# category of hosts to show on main page
10#$CONFIG['cat']['category1'] = array('host1', 'host2'); 13#$CONFIG['cat']['category1'] = array('host1', 'host2');
11 14
diff --git a/inc/html.inc.php b/inc/html.inc.php
index e38ca8e..6ab84d9 100644
--- a/inc/html.inc.php
+++ b/inc/html.inc.php
@@ -62,7 +62,7 @@ function plugin_header($host, $plugin, $status) {
62function host_summary($hosts) { 62function host_summary($hosts) {
63 global $CONFIG; 63 global $CONFIG;
64 64
65 $rrd = new RRDTool; 65 $rrd = new RRDTool($CONFIG['rrdtool']);
66 66
67 echo "<table class=\"summary\">\n"; 67 echo "<table class=\"summary\">\n";
68 68
diff --git a/inc/rrdtool.class.php b/inc/rrdtool.class.php
index 7dcbc2a..f7907ec 100644
--- a/inc/rrdtool.class.php
+++ b/inc/rrdtool.class.php
@@ -1,9 +1,20 @@
1<?php 1<?php
2 2
3class RRDTool { 3class RRDTool {
4 var $rrdtool = '/usr/bin/rrdtool';
5
6 function __construct($rrdtool) {
7 if (file_exists($rrdtool)) {
8 $this->rrdtool = $rrdtool;
9 } else {
10 printf('<p class="warn">Error: RRDTool (<em>%s</em>) is not executable. Please install RRDTool it and configure <em>$CONFIG[\'rrdtool\'].</em></p>', $rrdtool);
11 die();
12 }
13 }
14
4 function rrd_info($rrdfile) { 15 function rrd_info($rrdfile) {
5 if (file_exists($rrdfile)) { 16 if (file_exists($rrdfile)) {
6 $raw_info = shell_exec('/usr/bin/rrdtool info '.$rrdfile); 17 $raw_info = shell_exec($this->rrdtool.' info '.$rrdfile);
7 $raw_array = explode("\n", $raw_info); 18 $raw_array = explode("\n", $raw_info);
8 foreach ($raw_array as $key => $info) { 19 foreach ($raw_array as $key => $info) {
9 if ($info != "") { 20 if ($info != "") {
diff --git a/layout/style.css b/layout/style.css
index 2e2003e..83664a4 100644
--- a/layout/style.css
+++ b/layout/style.css
@@ -81,3 +81,8 @@ hr {
81.small { 81.small {
82 font-size: 0.7em; 82 font-size: 0.7em;
83} 83}
84
85.warn {
86 font-weight: bold;
87 color: #D50100;
88}
diff --git a/plugin/cpu.php b/plugin/cpu.php
index d4097b0..081427f 100644
--- a/plugin/cpu.php
+++ b/plugin/cpu.php
@@ -17,7 +17,7 @@ require_once 'inc/collectd.inc.php';
17# cpu-X/cpu-user.rrd 17# cpu-X/cpu-user.rrd
18# cpu-X/cpu-wait.rrd 18# cpu-X/cpu-wait.rrd
19 19
20$obj = new Type_GenericStacked($CONFIG['datadir']); 20$obj = new Type_GenericStacked($CONFIG);
21$obj->data_sources = array('value'); 21$obj->data_sources = array('value');
22$obj->order = array('idle', 'nice', 'user', 'wait', 'system', 'softirq', 'interrupt', 'steal'); 22$obj->order = array('idle', 'nice', 'user', 'wait', 'system', 'softirq', 'interrupt', 'steal');
23$obj->ds_names = array( 23$obj->ds_names = array(
diff --git a/plugin/df.php b/plugin/df.php
index 79c5cb5..b3bba84 100644
--- a/plugin/df.php
+++ b/plugin/df.php
@@ -11,7 +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($CONFIG['datadir']); 14$obj = new Type_GenericStacked($CONFIG);
15$obj->data_sources = array('free', 'used'); 15$obj->data_sources = array('free', 'used');
16$obj->ds_names = array( 16$obj->ds_names = array(
17 'free' => 'Free', 17 'free' => 'Free',
diff --git a/plugin/disk.php b/plugin/disk.php
index f1100d6..0f7a11a 100644
--- a/plugin/disk.php
+++ b/plugin/disk.php
@@ -13,7 +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($CONFIG['datadir']); 16$obj = new Type_GenericIO($CONFIG);
17$obj->data_sources = array('read', 'write'); 17$obj->data_sources = array('read', 'write');
18$obj->ds_names = array( 18$obj->ds_names = array(
19 'read' => 'Read ', 19 'read' => 'Read ',
diff --git a/plugin/entropy.php b/plugin/entropy.php
index 8705894..3583550 100644
--- a/plugin/entropy.php
+++ b/plugin/entropy.php
@@ -9,7 +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($CONFIG['datadir']); 12$obj = new Type_Default($CONFIG);
13$obj->data_sources = array('entropy'); 13$obj->data_sources = array('entropy');
14$obj->ds_names = array( 14$obj->ds_names = array(
15 'entropy' => 'Entropy bits', 15 'entropy' => 'Entropy bits',
diff --git a/plugin/interface.php b/plugin/interface.php
index 89e4280..833de38 100644
--- a/plugin/interface.php
+++ b/plugin/interface.php
@@ -12,7 +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($CONFIG['datadir']); 15$obj = new Type_GenericIO($CONFIG);
16$obj->data_sources = array('rx', 'tx'); 16$obj->data_sources = array('rx', 'tx');
17$obj->ds_names = array( 17$obj->ds_names = array(
18 'rx' => 'Receive ', 18 'rx' => 'Receive ',
diff --git a/plugin/irq.php b/plugin/irq.php
index ba0e7cb..10c6393 100644
--- a/plugin/irq.php
+++ b/plugin/irq.php
@@ -10,7 +10,7 @@ require_once 'inc/collectd.inc.php';
10# irq/ 10# irq/
11# irq/irq-XX.rrd 11# irq/irq-XX.rrd
12 12
13$obj = new Type_GenericStacked($CONFIG['datadir']); 13$obj = new Type_GenericStacked($CONFIG);
14$obj->width = $width; 14$obj->width = $width;
15$obj->heigth = $heigth; 15$obj->heigth = $heigth;
16 16
diff --git a/plugin/load.php b/plugin/load.php
index 44baf45..b33739e 100644
--- a/plugin/load.php
+++ b/plugin/load.php
@@ -9,7 +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($CONFIG['datadir']); 12$obj = new Type_Default($CONFIG);
13$obj->data_sources = array('shortterm', 'midterm', 'longterm'); 13$obj->data_sources = array('shortterm', 'midterm', 'longterm');
14$obj->ds_names = array( 14$obj->ds_names = array(
15 'shortterm' => ' 1 min', 15 'shortterm' => ' 1 min',
diff --git a/plugin/memory.php b/plugin/memory.php
index ade242c..48a3048 100644
--- a/plugin/memory.php
+++ b/plugin/memory.php
@@ -13,7 +13,7 @@ require_once 'inc/collectd.inc.php';
13# memory/memory-free.rrd 13# memory/memory-free.rrd
14# memory/memory-used.rrd 14# memory/memory-used.rrd
15 15
16$obj = new Type_GenericStacked($CONFIG['datadir']); 16$obj = new Type_GenericStacked($CONFIG);
17$obj->order = array('free', 'buffered', 'cached', 'used'); 17$obj->order = array('free', 'buffered', 'cached', 'used');
18$obj->ds_names = array( 18$obj->ds_names = array(
19 'free' => 'Free ', 19 'free' => 'Free ',
diff --git a/plugin/processes.php b/plugin/processes.php
index 1487568..a560b13 100644
--- a/plugin/processes.php
+++ b/plugin/processes.php
@@ -15,7 +15,7 @@ require_once 'inc/collectd.inc.php';
15# processes/ps_state-running.rrd 15# processes/ps_state-running.rrd
16# processes/ps_state-sleeping.rrd 16# processes/ps_state-sleeping.rrd
17 17
18$obj = new Type_GenericStacked($CONFIG['datadir']); 18$obj = new Type_GenericStacked($CONFIG);
19$obj->ds_names = array( 19$obj->ds_names = array(
20 'paging' => 'Paging ', 20 'paging' => 'Paging ',
21 'blocked' => 'Blocked ', 21 'blocked' => 'Blocked ',
diff --git a/plugin/sensors.php b/plugin/sensors.php
index fda5432..29110f1 100644
--- a/plugin/sensors.php
+++ b/plugin/sensors.php
@@ -12,7 +12,7 @@ require_once 'inc/collectd.inc.php';
12# disk-XXXX/temerature-XXXX.rrd 12# disk-XXXX/temerature-XXXX.rrd
13# disk-XXXX/voltage-XXXX.rrd 13# disk-XXXX/voltage-XXXX.rrd
14 14
15$obj = new Type_Default($CONFIG['datadir']); 15$obj = new Type_Default($CONFIG);
16$obj->ds_names = array( 16$obj->ds_names = array(
17 'value' => 'Value ', 17 'value' => 'Value ',
18); 18);
diff --git a/plugin/swap.php b/plugin/swap.php
index 27bf7f9..e1fa3f6 100644
--- a/plugin/swap.php
+++ b/plugin/swap.php
@@ -14,7 +14,7 @@ require_once 'inc/collectd.inc.php';
14switch($_GET['t']) { 14switch($_GET['t']) {
15 case 'swap': 15 case 'swap':
16 require_once 'type/GenericStacked.class.php'; 16 require_once 'type/GenericStacked.class.php';
17 $obj = new Type_GenericStacked($CONFIG['datadir']); 17 $obj = new Type_GenericStacked($CONFIG);
18 $obj->order = array('free', 'cached', 'used'); 18 $obj->order = array('free', 'cached', 'used');
19 $obj->ds_names = array( 19 $obj->ds_names = array(
20 'free' => 'Free ', 20 'free' => 'Free ',
@@ -31,7 +31,7 @@ switch($_GET['t']) {
31 break; 31 break;
32 case 'swap_io': 32 case 'swap_io':
33 require_once 'type/GenericIO.class.php'; 33 require_once 'type/GenericIO.class.php';
34 $obj = new Type_GenericIO($CONFIG['datadir']); 34 $obj = new Type_GenericIO($CONFIG);
35 $obj->order = array('out', 'in'); 35 $obj->order = array('out', 'in');
36 $obj->ds_names = array( 36 $obj->ds_names = array(
37 'out' => 'Out', 37 'out' => 'Out',
diff --git a/plugin/users.php b/plugin/users.php
index d94a8c1..5df16bc 100644
--- a/plugin/users.php
+++ b/plugin/users.php
@@ -9,7 +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($CONFIG['datadir']); 12$obj = new Type_Default($CONFIG);
13$obj->data_sources = array('users'); 13$obj->data_sources = array('users');
14$obj->ds_names = array( 14$obj->ds_names = array(
15 'users' => 'Users', 15 'users' => 'Users',
diff --git a/type/Default.class.php b/type/Default.class.php
index 0c992e2..ad880b3 100644
--- a/type/Default.class.php
+++ b/type/Default.class.php
@@ -4,6 +4,7 @@
4 4
5class Type_Default { 5class Type_Default {
6 var $datadir; 6 var $datadir;
7 var $rrdtool;
7 var $args; 8 var $args;
8 var $seconds; 9 var $seconds;
9 var $data_sources = array('value'); 10 var $data_sources = array('value');
@@ -21,8 +22,9 @@ class Type_Default {
21 var $tinstances; 22 var $tinstances;
22 var $identifiers; 23 var $identifiers;
23 24
24 function __construct($datadir) { 25 function __construct($config) {
25 $this->datadir = $datadir; 26 $this->datadir = $config['datadir'];
27 $this->rrdtool = $config['rrdtool'];
26 $this->parse_get(); 28 $this->parse_get();
27 $this->rrd_files(); 29 $this->rrd_files();
28 $this->identifiers = $this->file2identifier($this->files); 30 $this->identifiers = $this->file2identifier($this->files);
@@ -124,7 +126,8 @@ class Type_Default {
124 } 126 }
125 127
126 function rrd_options() { 128 function rrd_options() {
127 $rrdgraph[] = '/usr/bin/rrdtool graph - -a PNG'; 129 $rrdgraph[] = $this->rrdtool;
130 $rrdgraph[] = 'graph - -a PNG';
128 $rrdgraph[] = sprintf('-w %d', is_numeric($this->width) ? $this->width : 400); 131 $rrdgraph[] = sprintf('-w %d', is_numeric($this->width) ? $this->width : 400);
129 $rrdgraph[] = sprintf('-h %d', is_numeric($this->heigth) ? $this->heigth : 175); 132 $rrdgraph[] = sprintf('-h %d', is_numeric($this->heigth) ? $this->heigth : 175);
130 $rrdgraph[] = '-l 0'; 133 $rrdgraph[] = '-l 0';