Beispiel #1
0
    <div class="dash_wrapper">
        <table class="dash_table">
            <?php 
$query = "select service.host_name,service.service_description,service.last_hard_state,service.output,service.last_hard_state_change,service.last_check from service,host where host.host_name = service.host_name and service.last_hard_state in (1,2,3) and service.problem_has_been_acknowledged = 0 and service.host_name not in (select distinct host_name from scheduled_downtime where start_time < unix_timestamp() and end_time > unix_timestamp() and downtime_type=2) and service.service_description not in (select distinct service_description from scheduled_downtime where host_name = service.host_name and start_time < unix_timestamp() and end_time > unix_timestamp() and downtime_type=1) order by service.last_hard_state;";
$result = mysql_query($query);
$save = "";
$output = "";
while ($row = mysql_fetch_array($result)) {
    if ($row[2] == 2) {
        $class = "critical";
    } elseif ($row[2] == 1) {
        $class = "warning";
    } elseif ($row[2] == 3) {
        $class = "unknown";
    }
    $duration = _print_duration($row[4], time());
    $date = date("Y-m-d H:i:s", $row[5]);
    $output .= "<tr class=\"" . $class . "\"><td>" . $row[0] . "</td><td>" . $row[1] . "</td>";
    $output .= "<td>" . $row[3] . "</td>";
    $output .= "<td class=\"date date_statechange\">" . $duration . "</td>";
    $output .= "<td class=\"date date_lastcheck\">" . $date . "</td></tr>\n";
    $save .= $row[0];
}
if ($save) {
    ?>
            <tr class="dash_table_head">
                <th>
                    Host
                </th>
                <th>
                    Service
#### Unhandled Services
$services_limit = 200;
$unhandled_services = "";
$uh_services_count = api_count("{$server}/api/filter/count?query=" . $uh_services . $uh_services_filter);
if ($uh_services_count > 0) {
    $services = api_query("{$server}/api/filter/query?query=" . $uh_services . $uh_services_filter . "&columns=host.name,description,state,plugin_output,last_hard_state_change,last_check&limit={$services_limit}");
    usort($services, "sort_by_state");
    while (list(, $row) = each($services)) {
        if ($row['state'] == 2) {
            $class = "critical";
        } elseif ($row['state'] == 1) {
            $class = "warning";
        } elseif ($row['state'] == 3) {
            $class = "unknown";
        }
        $duration = _print_duration($row['last_hard_state_change'], time());
        $date = date("Y-m-d H:i:s", $row['last_check']);
        $unhandled_services .= "<tr class=\"" . $class . "\"><td>" . $row['host']['name'] . "</td><td>" . $row['description'] . "</td><td>" . $row['plugin_output'] . "</td><td class=\"date date_statechange\">" . $duration . "</td><td class=\"date date_lastcheck\">" . $date . "</td></tr>\n";
    }
}
?>

<div class="dash_tactical_overview">
    <h2>Tactical overview</h2>
    <div class="dash_wrapper">
        <table class="dash_table_tactical_overview">
            <tr class="dash_table_head"><th>Type</th><th>Totals</th><th>%</th></tr>
            <tr class="ok">
                <td>Hosts up</td>
                <td><?php 
print $hosts_up;