Esempio n. 1
0
function thold_poller_bottom()
{
    /* record the start time */
    list($micro, $seconds) = split(" ", microtime());
    $start = $seconds + $micro;
    /* perform all thold checks */
    $tholds = thold_check_all_thresholds();
    $hosts = thold_update_host_status();
    thold_cleanup_log();
    /* record the end time */
    list($micro, $seconds) = split(" ", microtime());
    $end = $seconds + $micro;
    /* log statistics */
    $thold_stats = sprintf("Time:%01.4f Tholds:%s DownHosts:%s", $end - $start, $tholds, $hosts);
    cacti_log('THOLD STATS: ' . $thold_stats, false, 'SYSTEM');
    db_execute("REPLACE INTO settings (name, value) VALUES ('stats_thold', '{$thold_stats}')");
}
Esempio n. 2
0
function thold_poller_bottom()
{
    if (!read_config_option('thold_daemon_enable')) {
        /* record the start time */
        list($micro, $seconds) = explode(' ', microtime());
        $start = $seconds + $micro;
        /* perform all thold checks */
        $tholds = thold_check_all_thresholds();
        $nhosts = thold_update_host_status();
        thold_cleanup_log();
        /* record the end time */
        list($micro, $seconds) = explode(' ', microtime());
        $end = $seconds + $micro;
        $total_hosts = db_fetch_cell("SELECT count(*) FROM host WHERE disabled=''");
        $down_hosts = db_fetch_cell("SELECT count(*) FROM host WHERE status=1 AND disabled=''");
        /* log statistics */
        $thold_stats = sprintf('Time:%01.4f Tholds:%s TotalDevices:%s DownDevices:%s NewDownDevices:%s', $end - $start, $tholds, $total_hosts, $down_hosts, $nhosts);
        cacti_log('THOLD STATS: ' . $thold_stats, false, 'SYSTEM');
        db_execute("REPLACE INTO settings (name, value) VALUES ('stats_thold', '{$thold_stats}')");
    } else {
        /* collect some stats */
        $current_time = time();
        $max_concurrent_processes = read_config_option('thold_max_concurrent_processes');
        $stats = db_fetch_row('SELECT
			COUNT(*) as completed,
			SUM(processed_items) as processed_items,
			MAX(`end`-`start`) as max_processing_time,
			SUM(`end`-`start`) as total_processing_time
			FROM `plugin_thold_daemon_processes`
			WHERE `start` != 0 AND `end` != 0 AND `end` <=' . $current_time . " AND `processed_items` != '-1'");
        $broken_processes = db_fetch_cell("SELECT COUNT(*) FROM `plugin_thold_daemon_processes` WHERE `processed_items` = '-1'");
        $running_processes = db_fetch_cell("SELECT COUNT(*) FROM `plugin_thold_daemon_processes` WHERE `start` != 0 AND `end` = 0");
        /* system clean up */
        db_execute("DELETE FROM `plugin_thold_daemon_processes` WHERE `end` != 0 AND `end` <=" . $current_time);
        /* host_status processed by thold server */
        $nhosts = thold_update_host_status();
        thold_cleanup_log();
        $total_hosts = db_fetch_cell("SELECT count(*) FROM host WHERE disabled=''");
        $down_hosts = db_fetch_cell("SELECT count(*) FROM host WHERE status=1 AND disabled=''");
        /* log statistics */
        $thold_stats = sprintf('CPUTime:%u MaxRuntime:%u Tholds:%u TotalDevices:%u DownDevices:%u NewDownDevices:%u Processes: %u completed, %u running, %u broken', $stats['total_processing_time'], $stats['max_processing_time'], $stats['processed_items'], $total_hosts, $down_hosts, $nhosts, $stats['completed'], $running_processes, $broken_processes);
        cacti_log('THOLD STATS: ' . $thold_stats, false, 'SYSTEM');
        db_execute("REPLACE INTO settings (name, value) VALUES ('stats_thold', '{$thold_stats}')");
    }
}
Esempio n. 3
0
function thold_poller_bottom()
{
    /* record the start time */
    list($micro, $seconds) = split(" ", microtime());
    $start = $seconds + $micro;
    /* perform all thold checks */
    $tholds = thold_check_all_thresholds();
    $nhosts = thold_update_host_status();
    thold_cleanup_log();
    /* record the end time */
    list($micro, $seconds) = split(" ", microtime());
    $end = $seconds + $micro;
    $total_hosts = db_fetch_cell("SELECT count(*) FROM host WHERE disabled=''");
    $down_hosts = db_fetch_cell("SELECT count(*) FROM host WHERE status=1 AND disabled=''");
    /* log statistics */
    $thold_stats = sprintf("Time:%01.4f Tholds:%s TotalHosts:%s DownHosts:%s NewDownHosts:%s", $end - $start, $tholds, $total_hosts, $down_hosts, $nhosts);
    cacti_log('THOLD STATS: ' . $thold_stats, false, 'SYSTEM');
    db_execute("REPLACE INTO settings (name, value) VALUES ('stats_thold', '{$thold_stats}')");
}