aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorPim van den Berg2009-09-28 19:53:38 +0200
committerPim van den Berg2009-09-28 20:05:29 +0200
commitdb5bc6fbd9a568bd3267fecff076da455d5e23f7 (patch)
tree7d215ed55f1aee8a41172def9707e58e9d91c003
parentadd a footer to each page (diff)
downloadapt-panopticon_cgp-db5bc6fbd9a568bd3267fecff076da455d5e23f7.zip
apt-panopticon_cgp-db5bc6fbd9a568bd3267fecff076da455d5e23f7.tar.gz
apt-panopticon_cgp-db5bc6fbd9a568bd3267fecff076da455d5e23f7.tar.bz2
apt-panopticon_cgp-db5bc6fbd9a568bd3267fecff076da455d5e23f7.tar.xz
change webdir/weburl and include/require usage
- Don't depend on includes from files that are included. - Don't use webdir with includes/requires (also because webdir couldn't be available in some cases). - Use common.inc.php instead of config.php in all plugins to have all configuration settings available.
Diffstat (limited to '')
-rw-r--r--detail.php1
-rw-r--r--host.php1
-rw-r--r--inc/html.inc.php8
-rw-r--r--plugin/cpu.php6
-rw-r--r--plugin/df.php4
-rw-r--r--plugin/disk.php4
-rw-r--r--plugin/entropy.php4
-rw-r--r--plugin/interface.php4
-rw-r--r--plugin/irq.php6
-rw-r--r--plugin/load.php4
-rw-r--r--plugin/memory.php6
-rw-r--r--plugin/processes.php6
-rw-r--r--plugin/sensors.php6
-rw-r--r--plugin/swap.php6
-rw-r--r--plugin/users.php4
15 files changed, 37 insertions, 33 deletions
diff --git a/detail.php b/detail.php
index d1f2126..3512716 100644
--- a/detail.php
+++ b/detail.php
@@ -1,5 +1,6 @@
1<?php 1<?php
2 2
3require_once 'conf/common.inc.php';
3require_once 'inc/html.inc.php'; 4require_once 'inc/html.inc.php';
4require_once 'inc/collectd.inc.php'; 5require_once 'inc/collectd.inc.php';
5 6
diff --git a/host.php b/host.php
index 22112e6..aee29d8 100644
--- a/host.php
+++ b/host.php
@@ -1,5 +1,6 @@
1<?php 1<?php
2 2
3require_once 'conf/common.inc.php';
3require_once 'inc/html.inc.php'; 4require_once 'inc/html.inc.php';
4require_once 'inc/collectd.inc.php'; 5require_once 'inc/collectd.inc.php';
5 6
diff --git a/inc/html.inc.php b/inc/html.inc.php
index 1001381..0a5b342 100644
--- a/inc/html.inc.php
+++ b/inc/html.inc.php
@@ -1,13 +1,17 @@
1<?php 1<?php
2 2
3require_once 'conf/common.inc.php';
4require_once 'inc/rrdtool.class.php';
5
3function html_start() { 6function html_start() {
7 global $CONFIG;
4 echo <<<EOT 8 echo <<<EOT
5<!DOCTYPE HTML> 9<!DOCTYPE HTML>
6<html> 10<html>
7<head> 11<head>
8 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 12 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
9 <title>Collectd Graph Panel</title> 13 <title>Collectd Graph Panel</title>
10 <link rel="stylesheet" href="layout/style.css" type="text/css"> 14 <link rel="stylesheet" href="{$CONFIG['weburl']}/layout/style.css" type="text/css">
11</head> 15</head>
12<body> 16<body>
13 17
@@ -22,8 +26,6 @@ function html_end() {
22EOT; 26EOT;
23} 27}
24 28
25require_once 'conf/common.inc.php';
26require_once 'inc/rrdtool.class.php';
27function host_summary($hosts) { 29function host_summary($hosts) {
28 global $CONFIG; 30 global $CONFIG;
29 31
diff --git a/plugin/cpu.php b/plugin/cpu.php
index 10fbf56..04ef3a4 100644
--- a/plugin/cpu.php
+++ b/plugin/cpu.php
@@ -2,8 +2,8 @@
2 2
3# Collectd CPU plugin 3# Collectd CPU plugin
4 4
5require_once $CONFIG['webdir'].'/conf/config.php'; 5require_once 'conf/common.inc.php';
6require_once $CONFIG['webdir'].'/type/GenericStacked.class.php'; 6require_once 'type/GenericStacked.class.php';
7 7
8## LAYOUT 8## LAYOUT
9# cpu-X/ 9# cpu-X/
@@ -17,7 +17,7 @@ require_once $CONFIG['webdir'].'/type/GenericStacked.class.php';
17# cpu-X/cpu-wait.rrd 17# cpu-X/cpu-wait.rrd
18 18
19# grouped 19# grouped
20require_once $CONFIG['webdir'].'/inc/collectd.inc.php'; 20require_once 'inc/collectd.inc.php';
21$tinstance = collectd_plugindetail($host, $plugin, 'ti'); 21$tinstance = collectd_plugindetail($host, $plugin, 'ti');
22 22
23$obj = new Type_GenericStacked; 23$obj = new Type_GenericStacked;
diff --git a/plugin/df.php b/plugin/df.php
index 6398249..780ca0c 100644
--- a/plugin/df.php
+++ b/plugin/df.php
@@ -2,8 +2,8 @@
2 2
3# Collectd Df plugin 3# Collectd Df plugin
4 4
5require_once $CONFIG['webdir'].'/conf/config.php'; 5require_once 'conf/common.inc.php';
6require_once $CONFIG['webdir'].'/type/GenericStacked.class.php'; 6require_once 'type/GenericStacked.class.php';
7 7
8# LAYOUT 8# LAYOUT
9# 9#
diff --git a/plugin/disk.php b/plugin/disk.php
index 298c179..e73cbac 100644
--- a/plugin/disk.php
+++ b/plugin/disk.php
@@ -2,8 +2,8 @@
2 2
3# Collectd Disk plugin 3# Collectd Disk plugin
4 4
5require_once $CONFIG['webdir'].'/conf/config.php'; 5require_once 'conf/common.inc.php';
6require_once $CONFIG['webdir'].'/type/GenericIO.class.php'; 6require_once 'type/GenericIO.class.php';
7 7
8## LAYOUT 8## LAYOUT
9# disk-XXXX/ 9# disk-XXXX/
diff --git a/plugin/entropy.php b/plugin/entropy.php
index 55159dc..58d810b 100644
--- a/plugin/entropy.php
+++ b/plugin/entropy.php
@@ -2,8 +2,8 @@
2 2
3# Collectd Entropy plugin 3# Collectd Entropy plugin
4 4
5require_once $CONFIG['webdir'].'/conf/config.php'; 5require_once 'conf/common.inc.php';
6require_once $CONFIG['webdir'].'/type/Default.class.php'; 6require_once 'type/Default.class.php';
7 7
8## LAYOUT 8## LAYOUT
9# entropy/entropy.rrd 9# entropy/entropy.rrd
diff --git a/plugin/interface.php b/plugin/interface.php
index 2f345f9..bda0550 100644
--- a/plugin/interface.php
+++ b/plugin/interface.php
@@ -2,8 +2,8 @@
2 2
3# Collectd Interface plugin 3# Collectd Interface plugin
4 4
5require_once $CONFIG['webdir'].'/conf/config.php'; 5require_once 'conf/common.inc.php';
6require_once $CONFIG['webdir'].'/type/GenericIO.class.php'; 6require_once 'type/GenericIO.class.php';
7 7
8# LAYOUT 8# LAYOUT
9# interface/ 9# interface/
diff --git a/plugin/irq.php b/plugin/irq.php
index 2759c0e..6a05245 100644
--- a/plugin/irq.php
+++ b/plugin/irq.php
@@ -2,15 +2,15 @@
2 2
3# Collectd IRQ plugin 3# Collectd IRQ plugin
4 4
5require_once $CONFIG['webdir'].'/conf/config.php'; 5require_once 'conf/common.inc.php';
6require_once $CONFIG['webdir'].'/type/GenericStacked.class.php'; 6require_once 'type/GenericStacked.class.php';
7 7
8## LAYOUT 8## LAYOUT
9# irq/ 9# irq/
10# irq/irq-XX.rrd 10# irq/irq-XX.rrd
11 11
12# grouped 12# grouped
13require_once $CONFIG['webdir'].'/inc/collectd.inc.php'; 13require_once 'inc/collectd.inc.php';
14$tinstance = collectd_plugindetail($host, $plugin, 'ti'); 14$tinstance = collectd_plugindetail($host, $plugin, 'ti');
15sort($tinstance); 15sort($tinstance);
16 16
diff --git a/plugin/load.php b/plugin/load.php
index d7db740..17002ea 100644
--- a/plugin/load.php
+++ b/plugin/load.php
@@ -2,8 +2,8 @@
2 2
3# Collectd Load plugin 3# Collectd Load plugin
4 4
5require_once $CONFIG['webdir'].'/conf/config.php'; 5require_once 'conf/common.inc.php';
6require_once $CONFIG['webdir'].'/type/Default.class.php'; 6require_once 'type/Default.class.php';
7 7
8## LAYOUT 8## LAYOUT
9# load/load.rrd 9# load/load.rrd
diff --git a/plugin/memory.php b/plugin/memory.php
index 7944238..29f93fe 100644
--- a/plugin/memory.php
+++ b/plugin/memory.php
@@ -2,8 +2,8 @@
2 2
3# Collectd Memory plugin 3# Collectd Memory plugin
4 4
5require_once $CONFIG['webdir'].'/conf/config.php'; 5require_once 'conf/common.inc.php';
6require_once $CONFIG['webdir'].'/type/GenericStacked.class.php'; 6require_once 'type/GenericStacked.class.php';
7 7
8## LAYOUT 8## LAYOUT
9# memory/ 9# memory/
@@ -13,7 +13,7 @@ require_once $CONFIG['webdir'].'/type/GenericStacked.class.php';
13# memory/memory-used.rrd 13# memory/memory-used.rrd
14 14
15# grouped 15# grouped
16require_once $CONFIG['webdir'].'/inc/collectd.inc.php'; 16require_once 'inc/collectd.inc.php';
17$tinstance = collectd_plugindetail($host, $plugin, 'ti'); 17$tinstance = collectd_plugindetail($host, $plugin, 'ti');
18 18
19$obj = new Type_GenericStacked; 19$obj = new Type_GenericStacked;
diff --git a/plugin/processes.php b/plugin/processes.php
index 445e1e4..32a925d 100644
--- a/plugin/processes.php
+++ b/plugin/processes.php
@@ -2,8 +2,8 @@
2 2
3# Collectd CPU plugin 3# Collectd CPU plugin
4 4
5require_once $CONFIG['webdir'].'/conf/config.php'; 5require_once 'conf/common.inc.php';
6require_once $CONFIG['webdir'].'/type/GenericStacked.class.php'; 6require_once 'type/GenericStacked.class.php';
7 7
8## LAYOUT 8## LAYOUT
9# processes/ 9# processes/
@@ -15,7 +15,7 @@ require_once $CONFIG['webdir'].'/type/GenericStacked.class.php';
15# processes/ps_state-sleeping.rrd 15# processes/ps_state-sleeping.rrd
16 16
17# grouped 17# grouped
18require_once $CONFIG['webdir'].'/inc/collectd.inc.php'; 18require_once 'inc/collectd.inc.php';
19$tinstance = collectd_plugindetail($host, $plugin, 'ti'); 19$tinstance = collectd_plugindetail($host, $plugin, 'ti');
20 20
21$obj = new Type_GenericStacked; 21$obj = new Type_GenericStacked;
diff --git a/plugin/sensors.php b/plugin/sensors.php
index ad43378..c7f038b 100644
--- a/plugin/sensors.php
+++ b/plugin/sensors.php
@@ -2,8 +2,8 @@
2 2
3# Collectd Sensors plugin 3# Collectd Sensors plugin
4 4
5require_once $CONFIG['webdir'].'/conf/config.php'; 5require_once 'conf/common.inc.php';
6require_once $CONFIG['webdir'].'/type/Default.class.php'; 6require_once 'type/Default.class.php';
7 7
8## LAYOUT 8## LAYOUT
9# disk-XXXX/ 9# disk-XXXX/
@@ -12,7 +12,7 @@ require_once $CONFIG['webdir'].'/type/Default.class.php';
12# disk-XXXX/voltage-XXXX.rrd 12# disk-XXXX/voltage-XXXX.rrd
13 13
14# grouped 14# grouped
15require_once $CONFIG['webdir'].'/inc/collectd.inc.php'; 15require_once 'inc/collectd.inc.php';
16$tinstance = collectd_plugindetail($host, $plugin, 'ti', array('t' => $type)); 16$tinstance = collectd_plugindetail($host, $plugin, 'ti', array('t' => $type));
17 17
18$obj = new Type_Default; 18$obj = new Type_Default;
diff --git a/plugin/swap.php b/plugin/swap.php
index dfd9ba1..d1ba823 100644
--- a/plugin/swap.php
+++ b/plugin/swap.php
@@ -2,8 +2,8 @@
2 2
3# Collectd Swap plugin 3# Collectd Swap plugin
4 4
5require_once $CONFIG['webdir'].'/conf/config.php'; 5require_once 'conf/common.inc.php';
6require_once $CONFIG['webdir'].'/type/GenericStacked.class.php'; 6require_once 'type/GenericStacked.class.php';
7 7
8## LAYOUT 8## LAYOUT
9# swap/ 9# swap/
@@ -12,7 +12,7 @@ require_once $CONFIG['webdir'].'/type/GenericStacked.class.php';
12# swap/swap-used.rrd 12# swap/swap-used.rrd
13 13
14# grouped 14# grouped
15require_once $CONFIG['webdir'].'/inc/collectd.inc.php'; 15require_once 'inc/collectd.inc.php';
16$tinstance = collectd_plugindetail($host, $plugin, 'ti'); 16$tinstance = collectd_plugindetail($host, $plugin, 'ti');
17 17
18$obj = new Type_GenericStacked; 18$obj = new Type_GenericStacked;
diff --git a/plugin/users.php b/plugin/users.php
index dfcaee3..41d4c25 100644
--- a/plugin/users.php
+++ b/plugin/users.php
@@ -2,8 +2,8 @@
2 2
3# Collectd Users plugin 3# Collectd Users plugin
4 4
5require_once $CONFIG['webdir'].'/conf/config.php'; 5require_once 'conf/common.inc.php';
6require_once $CONFIG['webdir'].'/type/Default.class.php'; 6require_once 'type/Default.class.php';
7 7
8## LAYOUT 8## LAYOUT
9# users/users.rrd 9# users/users.rrd