diff options
Diffstat (limited to 'inc/rrdtool.class.php')
| -rw-r--r-- | inc/rrdtool.class.php | 13 | 
1 files changed, 12 insertions, 1 deletions
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 != "") { | 
