Example #1
0
function hosts()
{
    global $config, $device_actions, $item_rows;
    /* ================= input validation and session storage ================= */
    $filters = array('rows' => array('filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '-1'), 'page' => array('filter' => FILTER_VALIDATE_INT, 'default' => '1'), 'filter' => array('filter' => FILTER_CALLBACK, 'pageset' => true, 'default' => '', 'options' => array('options' => 'sanitize_search_string')), 'sort_column' => array('filter' => FILTER_CALLBACK, 'default' => 'description', 'options' => array('options' => 'sanitize_search_string')), 'sort_direction' => array('filter' => FILTER_CALLBACK, 'default' => 'ASC', 'options' => array('options' => 'sanitize_search_string')), 'host_template_id' => array('filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '-1'), 'host_status' => array('filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '-4'));
    validate_store_request_vars($filters, 'sess_thold_hstatus');
    /* ================= input validation ================= */
    /* if the number of rows is -1, set it to the default */
    if (get_request_var('rows') == -1) {
        $rows = read_config_option('num_rows_table');
    } else {
        $rows = get_request_var('rows');
    }
    html_start_box(__('Device Status'), '100%', '', '3', 'center', '');
    form_host_filter();
    html_end_box();
    /* form the 'where' clause for our main sql query */
    $sql_where = '';
    if (get_request_var('filter') != '') {
        $sql_where = "((h.hostname LIKE '%" . get_request_var('filter') . "%' OR h.description LIKE '%" . get_request_var('filter') . "%')";
    }
    if (get_request_var('host_status') == '-1') {
        /* Show all items */
    } elseif (get_request_var('host_status') == '-2') {
        $sql_where .= (strlen($sql_where) ? ' AND ' : '(') . "h.disabled='on'";
    } elseif (get_request_var('host_status') == '-3') {
        $sql_where .= (strlen($sql_where) ? ' AND ' : '(') . "h.disabled=''";
    } elseif (get_request_var('host_status') == '-4') {
        $sql_where .= (strlen($sql_where) ? ' AND ' : '(') . "(h.status!='3' OR h.disabled='on')";
    } elseif (get_request_var('host_status') == '-5') {
        $sql_where .= (strlen($sql_where) ? ' AND ' : '(') . "(h.availability_method=0)";
    } elseif (get_request_var('host_status') == '3') {
        $sql_where .= (strlen($sql_where) ? ' AND ' : '(') . "(h.availability_method!=0 AND h.status=3 AND h.disabled='')";
    } else {
        $sql_where .= (strlen($sql_where) ? ' AND ' : '(') . "(h.status=" . get_request_var('host_status') . " AND h.disabled = '')";
    }
    if (get_request_var('host_template_id') == '-1') {
        /* Show all items */
    } elseif (get_request_var('host_template_id') == '0') {
        $sql_where .= (strlen($sql_where) ? ' AND ' : '(') . "h.host_template_id=0'";
    } elseif (!isempty_request_var('host_template_id')) {
        $sql_where .= (strlen($sql_where) ? ' AND ' : '(') . "h.host_template_id=" . get_request_var('host_template_id');
    }
    $sql_where .= strlen($sql_where) ? ')' : '';
    $sortby = get_request_var('sort_column');
    if ($sortby == 'hostname') {
        $sortby = 'INET_ATON(hostname)';
    }
    $host_graphs = array_rekey(db_fetch_assoc('SELECT host_id, count(*) as graphs FROM graph_local GROUP BY host_id'), 'host_id', 'graphs');
    $host_data_sources = array_rekey(db_fetch_assoc('SELECT host_id, count(*) as data_sources FROM data_local GROUP BY host_id'), 'host_id', 'data_sources');
    $hosts = get_allowed_devices($sql_where, $sortby . ' ' . get_request_var('sort_direction'), $rows * (get_request_var('page') - 1) . ',' . $rows, $total_rows);
    $nav = html_nav_bar('thold_graph.php?action=hoststat', MAX_DISPLAY_PAGES, get_request_var('page'), $rows, $total_rows, 12, __('Devices'), 'page', 'main');
    print $nav;
    html_start_box('', '100%', '', '3', 'center', '');
    $display_text = array('nosort' => array('display' => __('Actions'), 'align' => 'left', 'sort' => '', 'tip' => __('Hover over icons for help')), 'description' => array('display' => __('Description'), 'align' => 'left', 'sort' => 'ASC', 'tip' => __('A description for the Device')), 'id' => array('display' => __('ID'), 'align' => 'right', 'sort' => 'ASC', 'tip' => __('A Cacti unique identifier for the Device')), 'nosort1' => array('display' => __('Graphs'), 'align' => 'right', 'sort' => 'ASC', 'tip' => __('The number of Graphs for this Device')), 'nosort2' => array('display' => __('Data Sources'), 'align' => 'right', 'sort' => 'ASC', 'tip' => __('The number of Data Sources for this Device')), 'status' => array('display' => __('Status'), 'align' => 'center', 'sort' => 'ASC', 'tip' => __('The status for this Device as of the last time it was polled')), 'nosort3' => array('display' => __('In State'), 'align' => 'right', 'sort' => 'ASC', 'tip' => __('The last time Cacti found an issues with this Device.  It can be higher than the Uptime for the the Device, if it was rebooted between Cacti polling cycles')), 'snmp_sysUpTimeInstance' => array('display' => __('Uptime'), 'align' => 'right', 'sort' => 'ASC', 'tip' => __('The official uptime of the Device as reported by SNMP')), 'hostname' => array('display' => __('Hostname'), 'align' => 'right', 'sort' => 'ASC', 'tip' => __('The official hostname for this Device')), 'cur_time' => array('display' => __('Current (ms)'), 'align' => 'right', 'sort' => 'DESC', 'tip' => __('The current response time for the Cacti Availability check')), 'avg_time' => array('display' => __('Average (ms)'), 'align' => 'right', 'sort' => 'DESC', 'tip' => __('The average response time for the Cacti Availability check')), 'availability' => array('display' => __('Availability'), 'align' => 'right', 'sort' => 'ASC', 'tip' => __('The overall Availability of this Device since the last counter reset in Cacti')));
    html_header_sort($display_text, get_request_var('sort_column'), get_request_var('sort_direction'), false, 'thold_graph.php?action=hoststat');
    if (sizeof($hosts)) {
        foreach ($hosts as $host) {
            if ($host['disabled'] == '' && ($host['status'] == HOST_RECOVERING || $host['status'] == HOST_UP) && ($host['availability_method'] != AVAIL_NONE && $host['availability_method'] != AVAIL_PING)) {
                $snmp_uptime = $host['snmp_sysUpTimeInstance'];
                $days = intval($snmp_uptime / (60 * 60 * 24 * 100));
                $remainder = $snmp_uptime % (60 * 60 * 24 * 100);
                $hours = intval($remainder / (60 * 60 * 100));
                $remainder = $remainder % (60 * 60 * 100);
                $minutes = intval($remainder / (60 * 100));
                $uptime = $days . 'd:' . substr('00' . $hours, -2) . 'h:' . substr('00' . $minutes, -2) . 'm';
            } else {
                $uptime = __('N/A');
            }
            if (isset($host_graphs[$host['id']])) {
                $graphs = $host_graphs[$host['id']];
            } else {
                $graphs = 0;
            }
            if (isset($host_data_sources[$host['id']])) {
                $ds = $host_data_sources[$host['id']];
            } else {
                $ds = 0;
            }
            if ($host['availability_method'] != 0) {
                form_host_status_row_color($host['status'], $host['disabled']);
                print "<td width='1%' class='nowrap'>";
                if (api_user_realm_auth('host.php')) {
                    print '<a href="' . htmlspecialchars($config['url_path'] . 'host.php?action=edit&id=' . $host['id']) . '"><img src="' . $config['url_path'] . 'plugins/thold/images/edit_object.png" border="0" alt="" title="' . __('Edit Device') . '"></a>';
                }
                print "<a href='" . htmlspecialchars($config['url_path'] . 'graph_view.php?action=preview&graph_template_id=0&filter=&host_id=' . $host['id']) . "'><img src='" . $config['url_path'] . "plugins/thold/images/view_graphs.gif' border='0' alt='' title='" . __('View Graphs') . "'></a>";
                print '</td>';
                ?>
				<td style='text-align:left'>
					<?php 
                print filter_value($host['description'], get_request_var('filter'));
                ?>
				</td>
				<td style='text-align:right'><?php 
                print round($host['id'], 2);
                ?>
</td>
				<td style='text-align:right'><i><?php 
                print number_format_i18n($graphs);
                ?>
</i></td>
				<td style='text-align:right'><i><?php 
                print number_format_i18n($ds);
                ?>
</i></td>
				<td style='text-align:center'><?php 
                print get_uncolored_device_status($host['disabled'] == 'on' ? true : false, $host['status']);
                ?>
</td>
				<td style='text-align:right'><?php 
                print get_timeinstate($host);
                ?>
</td>
				<td style='text-align:right'><?php 
                print $uptime;
                ?>
</td>
				<td style='text-align:right'><?php 
                print filter_value($host['hostname'], get_request_var('filter'));
                ?>
</td>
				<td style='text-align:right'><?php 
                print round($host['cur_time'], 2);
                ?>
</td>
				<td style='text-align:right'><?php 
                print round($host['avg_time'], 2);
                ?>
</td>
				<td style='text-align:right'><?php 
                print round($host['availability'], 2);
                ?>
 %</td>
				<?php 
            } else {
                print "<tr class='deviceNotMonFull'>\n";
                print "<td width='1%' class='nowrap'>\n";
                if (api_user_realm_auth('host.php')) {
                    print '<a href="' . htmlspecialchars($config['url_path'] . 'host.php?action=edit&id=' . $host["id"]) . '"><img src="' . $config['url_path'] . 'plugins/thold/images/edit_object.png" border="0" alt="" title="' . __('Edit Device') . '"></a>';
                }
                print "<a href='" . htmlspecialchars($config['url_path'] . "graph_view.php?action=preview&graph_template_id=0&filter=&host_id=" . $host["id"]) . "'><img src='" . $config['url_path'] . "plugins/thold/images/view_graphs.gif' border='0' alt='' title='" . __('View Graphs') . "'></a>";
                print "</td>";
                ?>
				<td style='text-align:left'>
					<?php 
                print filter_value($host['description'], get_request_var('filter'));
                ?>
				</td>
				<td style='text-align:right'><?php 
                print $host['id'];
                ?>
</td>
				<td style='text-align:right'><i><?php 
                print number_format_i18n($graphs);
                ?>
</i></td>
				<td style='text-align:right'><i><?php 
                print number_format_i18n($ds);
                ?>
</i></td>
				<td style='text-align:center'><?php 
                print 'Not Monitored';
                ?>
</td>
				<td style='text-align:right'><?php 
                print 'N/A';
                ?>
</td>
				<td style='text-align:right'><?php 
                print $uptime;
                ?>
</td>
				<td style='text-align:right'><?php 
                print filter_value($host['hostname'], get_request_var('filter'));
                ?>
</td>
				<td style='text-align:right'><?php 
                print 'N/A';
                ?>
</td>
				<td style='text-align:right'><?php 
                print 'N/A';
                ?>
</td>
				<td style='text-align:right'><?php 
                print 'N/A';
                ?>
</td>
				<?php 
            }
            form_end_row();
        }
    } else {
        print '<tr><td class="center" colspan="12">' . __('No Devices') . '</td></tr>';
    }
    html_end_box(false);
    if (sizeof($hosts)) {
        print $nav;
    }
    host_legend();
    //thold_display_rusage();
}
Example #2
0
function hosts()
{
    global $config, $colors, $device_actions, $item_rows, $host_colors, $notmon_color;
    /* ================= input validation ================= */
    input_validate_input_number(get_request_var_request("host_template_id"));
    input_validate_input_number(get_request_var_request("page"));
    input_validate_input_number(get_request_var_request("host_status"));
    input_validate_input_number(get_request_var_request("rows"));
    /* ==================================================== */
    /* clean up search string */
    if (isset($_REQUEST["filter"])) {
        $_REQUEST["filter"] = sanitize_search_string(get_request_var("filter"));
    }
    /* clean up sort_column */
    if (isset($_REQUEST["sort_column"])) {
        $_REQUEST["sort_column"] = sanitize_search_string(get_request_var("sort_column"));
    }
    /* clean up search string */
    if (isset($_REQUEST["sort_direction"])) {
        $_REQUEST["sort_direction"] = sanitize_search_string(get_request_var("sort_direction"));
    }
    /* if the user pushed the 'clear' button */
    if (isset($_REQUEST["clear"])) {
        kill_session_var("sess_thold_host_current_page");
        kill_session_var("sess_thold_host_filter");
        kill_session_var("sess_thold_host_host_template_id");
        kill_session_var("sess_thold_host_status");
        kill_session_var("sess_thold_host_rows");
        kill_session_var("sess_thold_host_sort_column");
        kill_session_var("sess_thold_host_sort_direction");
        unset($_REQUEST["page"]);
        unset($_REQUEST["filter"]);
        unset($_REQUEST["host_template_id"]);
        unset($_REQUEST["host_status"]);
        unset($_REQUEST["rows"]);
        unset($_REQUEST["sort_column"]);
        unset($_REQUEST["sort_direction"]);
    } else {
        /* if any of the settings changed, reset the page number */
        $changed = 0;
        $changed += thold_request_check_changed('filter', 'sess_thold_host_filter');
        $changed += thold_request_check_changed('host_template_id', 'sess_thold_host_template_id');
        $changed += thold_request_check_changed('host_status', 'sess_thold_host_status');
        $changed += thold_request_check_changed('rows', 'sess_thold_host_rows');
        $changed += thold_request_check_changed('sort_column', 'sess_thold_log_sort_column');
        $changed += thold_request_check_changed('sort_direction', 'sess_thold_log_sort_direction');
        if ($changed) {
            $_REQUEST['page'] = '1';
        }
    }
    if (!empty($_SESSION["sess_thold_host_status"]) && !empty($_REQUEST["host_status"])) {
        if ($_SESSION["sess_thold_host_status"] != $_REQUEST["host_status"]) {
            $_REQUEST["page"] = 1;
        }
    }
    /* remember these search fields in session vars so we don't have to keep passing them around */
    load_current_session_value("page", "sess_thold_host_current_page", "1");
    load_current_session_value("filter", "sess_thold_host_filter", "");
    load_current_session_value("host_template_id", "sess_thold_host_host_template_id", "-1");
    load_current_session_value("host_status", "sess_thold_host_status", "-4");
    load_current_session_value("rows", "sess_thold_host_rows", read_config_option("num_rows_device"));
    load_current_session_value("sort_column", "sess_thold_host_sort_column", "description");
    load_current_session_value("sort_direction", "sess_thold_host_sort_direction", "ASC");
    /* if the number of rows is -1, set it to the default */
    if ($_REQUEST["rows"] == -1) {
        $_REQUEST["rows"] = read_config_option("num_rows_device");
    }
    ?>
	<script type="text/javascript">
	<!--

	function applyViewDeviceFilterChange(objForm) {
		strURL = '?tab=hoststat&host_status=' + objForm.host_status.value;
		strURL = strURL + '&host_template_id=' + objForm.host_template_id.value;
		strURL = strURL + '&rows=' + objForm.rows.value;
		strURL = strURL + '&filter=' + objForm.filter.value;
		document.location = strURL;
	}

	-->
	</script>
	<?php 
    html_start_box("<strong>Device Status</strong>", "100%", $colors["header"], "3", "center", "");
    form_host_filter();
    html_end_box();
    /* form the 'where' clause for our main sql query */
    $sql_where = "where (host.hostname LIKE '%%" . $_REQUEST["filter"] . "%%' OR host.description LIKE '%%" . $_REQUEST["filter"] . "%%')";
    if ($_REQUEST["host_status"] == "-1") {
        /* Show all items */
    } elseif ($_REQUEST["host_status"] == "-2") {
        $sql_where .= strlen($sql_where) ? " and host.disabled='on'" : "where host.disabled='on'";
    } elseif ($_REQUEST["host_status"] == "-3") {
        $sql_where .= strlen($sql_where) ? " and host.disabled=''" : "where host.disabled=''";
    } elseif ($_REQUEST["host_status"] == "-4") {
        $sql_where .= strlen($sql_where) ? " and (host.status!='3' or host.disabled='on')" : "where (host.status!='3' or host.disabled='on')";
    } elseif ($_REQUEST["host_status"] == "-5") {
        $sql_where .= strlen($sql_where) ? " and (host.availability_method=0)" : "where (host.availability_method=0)";
    } elseif ($_REQUEST["host_status"] == "3") {
        $sql_where .= strlen($sql_where) ? " and (host.availability_method!=0 and host.status=3 and host.disabled='')" : "where (host.availability_method=0 and host.status=3 and host.disabled='')";
    } else {
        $sql_where .= strlen($sql_where) ? " and (host.status=" . $_REQUEST["host_status"] . " AND host.disabled = '')" : "where (host.status=" . $_REQUEST["host_status"] . " AND host.disabled = '')";
    }
    if ($_REQUEST["host_template_id"] == "-1") {
        /* Show all items */
    } elseif ($_REQUEST["host_template_id"] == "0") {
        $sql_where .= strlen($sql_where) ? " and host.host_template_id=0" : "where host.host_template_id=0";
    } elseif (!empty($_REQUEST["host_template_id"])) {
        $sql_where .= strlen($sql_where) ? " and host.host_template_id=" . $_REQUEST["host_template_id"] : "where host.host_template_id=" . $_REQUEST["host_template_id"];
    }
    html_start_box("", "100%", $colors["header"], "3", "center", "");
    $sortby = $_REQUEST["sort_column"];
    if ($sortby == "hostname") {
        $sortby = "INET_ATON(hostname)";
    }
    $host_graphs = array_rekey(db_fetch_assoc("SELECT host_id, count(*) as graphs FROM graph_local GROUP BY host_id"), "host_id", "graphs");
    $host_data_sources = array_rekey(db_fetch_assoc("SELECT host_id, count(*) as data_sources FROM data_local GROUP BY host_id"), "host_id", "data_sources");
    $current_user = db_fetch_row('SELECT * FROM user_auth WHERE id=' . $_SESSION['sess_user_id']);
    $sql_where .= ' AND ' . get_graph_permissions_sql($current_user['policy_graphs'], $current_user['policy_hosts'], $current_user['policy_graph_templates']);
    $total_rows = db_fetch_cell("SELECT\r\n\t\tCOUNT(host.id)\r\n\t\tFROM host\r\n\t\tLEFT JOIN user_auth_perms\r\n\t\tON (host.id=user_auth_perms.item_id\r\n\t\tAND user_auth_perms.type=3\r\n\t\tAND user_auth_perms.user_id=" . $_SESSION['sess_user_id'] . ")\r\n\t\t{$sql_where}");
    $sql_query = "SELECT *\r\n\t\tFROM host\r\n\t\tLEFT JOIN user_auth_perms\r\n\t\tON (host.id=user_auth_perms.item_id\r\n\t\tAND user_auth_perms.type=3\r\n\t\tAND user_auth_perms.user_id=" . $_SESSION['sess_user_id'] . ")\r\n\t\t{$sql_where}\r\n\t\tORDER BY " . $sortby . " " . $_REQUEST["sort_direction"] . "\r\n\t\tLIMIT " . $_REQUEST["rows"] * ($_REQUEST["page"] - 1) . "," . $_REQUEST["rows"];
    //print $sql_query;
    $hosts = db_fetch_assoc($sql_query);
    /* generate page list */
    $url_page_select = get_page_list($_REQUEST["page"], MAX_DISPLAY_PAGES, $_REQUEST["rows"], $total_rows, "thold_graph.php?tab=hoststat");
    if ($total_rows) {
        $nav = "<tr bgcolor='#" . $colors["header"] . "'>\r\n\t\t\t\t<td colspan='11'>\r\n\t\t\t\t\t<table width='100%' cellspacing='0' cellpadding='0' border='0'>\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t<td align='left' class='textHeaderDark'>\r\n\t\t\t\t\t\t\t\t<strong>&lt;&lt; ";
        if ($_REQUEST["page"] > 1) {
            $nav .= "<a class='linkOverDark' href='" . htmlspecialchars("thold_graph.php?filter=" . $_REQUEST["filter"] . "&host_template_id=" . $_REQUEST["host_template_id"] . "&host_status=" . $_REQUEST["host_status"] . "&page=" . ($_REQUEST["page"] - 1)) . "'>";
        }
        $nav .= "Previous";
        if ($_REQUEST["page"] > 1) {
            $nav .= "</a>";
        }
        $nav .= "</strong>\r\n\t\t\t\t\t\t\t</td>\n\r\n\t\t\t\t\t\t\t<td align='center' class='textHeaderDark'>\r\n\t\t\t\t\t\t\t\tShowing Rows " . ($_REQUEST["rows"] * ($_REQUEST["page"] - 1) + 1) . " to " . ($total_rows < read_config_option("num_rows_device") || $total_rows < $_REQUEST["rows"] * $_REQUEST["page"] ? $total_rows : $_REQUEST["rows"] * $_REQUEST["page"]) . " of {$total_rows} [{$url_page_select}]\r\n\t\t\t\t\t\t\t</td>\n\r\n\t\t\t\t\t\t\t<td align='right' class='textHeaderDark'>\r\n\t\t\t\t\t\t\t\t<strong>";
        if ($_REQUEST["page"] * $_REQUEST["rows"] < $total_rows) {
            $nav .= "<a class='linkOverDark' href='" . htmlspecialchars("thold_graph.php?filter=" . $_REQUEST["filter"] . "&host_template_id=" . $_REQUEST["host_template_id"] . "&host_status=" . $_REQUEST["host_status"] . "&page=" . ($_REQUEST["page"] + 1)) . "'>";
        }
        $nav .= "Next";
        if ($_REQUEST["page"] * $_REQUEST["rows"] < $total_rows) {
            $nav .= "</a>";
        }
        $nav .= " &gt;&gt;</strong>\r\n\t\t\t\t\t\t\t</td>\n\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t</table>\r\n\t\t\t\t</td>\r\n\t\t\t</tr>\n";
    } else {
        $nav = "<tr bgcolor='#" . $colors["header"] . "'>\r\n\t\t\t\t<td colspan='11'>\r\n\t\t\t\t\t<table width='100%' cellspacing='0' cellpadding='0' border='0'>\r\n\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t<td align='center' class='textHeaderDark'>\r\n\t\t\t\t\t\t\t\tNo Rows Found\r\n\t\t\t\t\t\t\t</td>\n\r\n\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t</table>\r\n\t\t\t\t</td>\r\n\t\t\t</tr>\n";
    }
    print $nav;
    $display_text = array("nosort" => array("<br>Actions", ""), "description" => array("<br>Description", "ASC"), "id" => array("<br>ID", "ASC"), "nosort1" => array("<br>Graphs", "ASC"), "nosort2" => array("Data<br>Sources", "ASC"), "status" => array("<br>Status", "ASC"), "status_event_count" => array("Event<br>Count", "ASC"), "hostname" => array("<br>Hostname", "ASC"), "cur_time" => array("<br>Current (ms)", "DESC"), "avg_time" => array("<br>Average (ms)", "DESC"), "availability" => array("<br>Availability", "ASC"));
    html_header_sort($display_text, $_REQUEST["sort_column"], $_REQUEST["sort_direction"]);
    $i = 0;
    if (sizeof($hosts)) {
        foreach ($hosts as $host) {
            if (isset($host_graphs[$host["id"]])) {
                $graphs = $host_graphs[$host["id"]];
            } else {
                $graphs = 0;
            }
            if (isset($host_data_sources[$host["id"]])) {
                $ds = $host_data_sources[$host["id"]];
            } else {
                $ds = 0;
            }
            if ($host["availability_method"] != 0) {
                form_host_status_row_color($host["status"], $host["disabled"]);
                $i++;
                print "<td width='1%' style='white-space:nowrap'>";
                if (api_user_realm_auth('host.php')) {
                    print '<a href="' . htmlspecialchars($config['url_path'] . 'host.php?action=edit&id=' . $host["id"]) . '"><img src="' . $config['url_path'] . 'plugins/thold/images/edit_object.png" border="0" alt="" title="Edit Host"></a>';
                }
                print "<a href='" . htmlspecialchars($config['url_path'] . "graph_view.php?action=preview&graph_template_id=0&filter=&host_id=" . $host["id"]) . "'><img src='" . $config['url_path'] . "plugins/thold/images/view_graphs.gif' border='0' alt='' title='View Graphs'></a>";
                print "</td>";
                ?>
				<td>
					<?php 
                print strlen($_REQUEST["filter"]) ? eregi_replace("(" . preg_quote($_REQUEST["filter"]) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", $host["description"]) : $host["description"];
                ?>
				</td>
				<td width='80'><?php 
                print round($host["id"], 2);
                ?>
</td>
				<td width='80'><i><?php 
                print $graphs;
                ?>
</i></td>
				<td width='80'><i><?php 
                print $ds;
                ?>
</i></td>
				<td width='140'><?php 
                print get_uncolored_device_status($host["disabled"] == "on" ? true : false, $host["status"]);
                ?>
</td>
				<td width='100'><?php 
                print round($host["status_event_count"], 2);
                ?>
</td>
				<td><?php 
                print strlen($_REQUEST["filter"]) ? eregi_replace("(" . preg_quote($_REQUEST["filter"]) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", $host["hostname"]) : $host["hostname"];
                ?>
</td>
				<td width='100'><?php 
                print round($host["cur_time"], 2);
                ?>
</td>
				<td width='100'><?php 
                print round($host["avg_time"], 2);
                ?>
</td>
				<td width='100'><?php 
                print round($host["availability"], 2);
                ?>
</td>
				<?php 
            } else {
                form_alternate_row_color($notmon_color, $notmon_color, $i);
                $i++;
                print "<td width='1%' style='white-space:nowrap'>";
                if (api_user_realm_auth('host.php')) {
                    print '<a href="' . htmlspecialchars($config['url_path'] . 'host.php?action=edit&id=' . $host["id"]) . '"><img src="' . $config['url_path'] . 'plugins/thold/images/edit_object.png" border="0" alt="" title="Edit Host"></a>';
                }
                print "<a href='" . htmlspecialchars($config['url_path'] . "graph_view.php?action=preview&graph_template_id=0&filter=&host_id=" . $host["id"]) . "'><img src='" . $config['url_path'] . "plugins/thold/images/view_graphs.gif' border='0' alt='' title='View Graphs'></a>";
                print "</td>";
                ?>
				<td>
					<?php 
                print strlen($_REQUEST["filter"]) ? eregi_replace("(" . preg_quote($_REQUEST["filter"]) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", $host["description"]) : $host["description"];
                ?>
				</td>
				<td width='80'><?php 
                print $host["id"];
                ?>
</td>
				<td width='80'><i><?php 
                print $graphs;
                ?>
</i></td>
				<td width='80'><i><?php 
                print $ds;
                ?>
</i></td>
				<td width='140'><?php 
                print "Not Monitored";
                ?>
</td>
				<td width='100'><?php 
                print "N/A";
                ?>
</td>
				<td><?php 
                print strlen($_REQUEST["filter"]) ? eregi_replace("(" . preg_quote($_REQUEST["filter"]) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", $host["hostname"]) : $host["hostname"];
                ?>
</td>
				<td width='100'><?php 
                print "N/A";
                ?>
</td>
				<td width='100'><?php 
                print "N/A";
                ?>
</td>
				<td width='100'><?php 
                print "N/A";
                ?>
</td>
				<?php 
            }
            form_end_row();
        }
    } else {
        print "<tr><td><em>No Hosts</em></td></tr>";
    }
    /* put the nav bar on the bottom as well */
    print $nav;
    html_end_box(false);
    host_legend();
    //thold_display_rusage();
}