update rrd config for new sensors
[php-utility-classes.git] / testbed / rrd / rrd-update.php
CommitLineData
4a778b7e 1<?php
2$myfile = $_SERVER['SCRIPT_FILENAME'];
3while (is_link($myfile)) { $myfile = readlink($myfile); }
4if (getcwd() != dirname($myfile)) {
5 // change to directory of the script if called from different directory
6 $orig_workingdir = getcwd();
7 chdir(dirname($myfile));
8}
9
10include_once('rrdstat.php-class');
11include_once('rrd-config.inc.php');
12
13if (php_sapi_name() == 'cli') {
14 // automated updates
15 $autoupdate = array();
16 foreach ($rrd_info as $iname=>$rinfo) {
17 if (isset($rinfo['auto-update']) && $rinfo['auto-update']) {
18 $autoupdate[] = $iname;
19 }
20 }
21 $autoupdate[] = 'rrdup';
22 foreach ($autoupdate as $rrdname) {
23 $rrd = new rrdstat($rrd_info, $rrdname);
24 $rrd->update();
25 }
26}
27else {
28 print('this is a commandline app.');
29}
30?>