diff options
Diffstat (limited to 'inc')
-rw-r--r-- | inc/html.inc.php | 2 | ||||
-rw-r--r-- | inc/rrdtool.class.php | 13 |
2 files changed, 13 insertions, 2 deletions
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) { | |||
62 | function host_summary($hosts) { | 62 | function 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 | ||
3 | class RRDTool { | 3 | class 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 != "") { |