diff options
| author | Pim van den Berg | 2010-01-12 19:58:47 +0100 |
|---|---|---|
| committer | Pim van den Berg | 2010-01-12 20:19:47 +0100 |
| commit | 924495bb2d732548083de9e54bf93eebe7f0d910 (patch) | |
| tree | 1f9deb6f85c00cf568d6738752bb21a6a3658521 /inc/rrdtool.class.php | |
| parent | update changelog to v0.2 (diff) | |
| download | apt-panopticon_cgp-924495bb2d732548083de9e54bf93eebe7f0d910.zip apt-panopticon_cgp-924495bb2d732548083de9e54bf93eebe7f0d910.tar.gz apt-panopticon_cgp-924495bb2d732548083de9e54bf93eebe7f0d910.tar.bz2 apt-panopticon_cgp-924495bb2d732548083de9e54bf93eebe7f0d910.tar.xz | |
make rrdtool executable configurable
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 != "") { |
