コード例 #1
0
ファイル: poller_dsstats.php プロジェクト: MrWnn/cacti
            print 'ERROR: Invalid Parameter ' . $parameter . "\n\n";
            display_help();
            exit;
    }
}
/* install signal handlers for UNIX only */
if (function_exists('pcntl_signal')) {
    pcntl_signal(SIGTERM, 'sig_handler');
    pcntl_signal(SIGINT, 'sig_handler');
}
/* take time and log performance data */
list($micro, $seconds) = split(' ', microtime());
$start = $seconds + $micro;
/* let's give this script lot of time to run for ever */
ini_set('max_execution_time', '0');
dsstats_memory_limit();
/* send a gentle message to the log and stdout */
dsstats_debug('Polling Starting');
/* only run if enabled, or forced */
if (read_config_option('dsstats_enable') == 'on' || $forcerun) {
    /* read some important settings relative to timing from the database */
    $major_time = date('H:i:s', strtotime(read_config_option('dsstats_major_update_time')));
    $daily_interval = read_config_option('dsstats_daily_interval');
    $hourly_window = date('Y-m-d H:i:s', time() - read_config_option('dsstats_hourly_duration') * 60);
    /* check to see when the daily averages were updated last */
    $last_run_daily = read_config_option('dsstats_last_daily_run_time');
    $last_run_major = read_config_option('dsstats_last_major_run_time');
    /* remove old records from the cache first */
    if (db_fetch_cell("SELECT count(*) FROM data_source_stats_hourly_cache WHERE time < '{$hourly_window}'")) {
        db_execute("DELETE FROM data_source_stats_hourly_cache WHERE time < '{$hourly_window}'");
    }
コード例 #2
0
ファイル: dsstats.php プロジェクト: MrWnn/cacti
function dsstats_poller_command_args()
{
    dsstats_memory_limit();
}