本文整理汇总了PHP中get_colored_device_status函数的典型用法代码示例。如果您正苦于以下问题:PHP get_colored_device_status函数的具体用法?PHP get_colored_device_status怎么用?PHP get_colored_device_status使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_colored_device_status函数的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: host
//.........这里部分代码省略.........
html_start_box("", "100%", $colors["header"], "3", "center", "");
$total_rows = db_fetch_cell("select
COUNT(host.id)
from host
$sql_where");
$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");
$sql_query = "SELECT
host.id,
host.disabled,
host.status,
host.hostname,
host.description,
host.min_time,
host.max_time,
host.cur_time,
host.avg_time,
host.availability
FROM host
$sql_where
ORDER BY " . $sortby . " " . $_REQUEST["sort_direction"] . "
LIMIT " . (read_config_option("num_rows_device")*($_REQUEST["page"]-1)) . "," . read_config_option("num_rows_device");
//print $sql_query;
$hosts = db_fetch_assoc($sql_query);
/* generate page list */
$url_page_select = get_page_list($_REQUEST["page"], MAX_DISPLAY_PAGES, read_config_option("num_rows_device"), $total_rows, "host.php?filter=" . $_REQUEST["filter"] . "&host_template_id=" . $_REQUEST["host_template_id"] . "&host_status=" . $_REQUEST["host_status"]);
$nav = "<tr bgcolor='#" . $colors["header"] . "'>
<td colspan='9'>
<table width='100%' cellspacing='0' cellpadding='0' border='0'>
<tr>
<td align='left' class='textHeaderDark'>
<strong><< "; if ($_REQUEST["page"] > 1) { $nav .= "<a class='linkOverDark' href='host.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>
</td>\n
<td align='center' class='textHeaderDark'>
Showing Rows " . ((read_config_option("num_rows_device")*($_REQUEST["page"]-1))+1) . " to " . ((($total_rows < read_config_option("num_rows_device")) || ($total_rows < (read_config_option("num_rows_device")*$_REQUEST["page"]))) ? $total_rows : (read_config_option("num_rows_device")*$_REQUEST["page"])) . " of $total_rows [$url_page_select]
</td>\n
<td align='right' class='textHeaderDark'>
<strong>"; if (($_REQUEST["page"] * read_config_option("num_rows_device")) < $total_rows) { $nav .= "<a class='linkOverDark' href='host.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"] * read_config_option("num_rows_device")) < $total_rows) { $nav .= "</a>"; } $nav .= " >></strong>
</td>\n
</tr>
</table>
</td>
</tr>\n";
print $nav;
$display_text = array(
"description" => array("Description", "ASC"),
"nosort1" => array("Graphs", "ASC"),
"nosort2" => array("Data Sources", "ASC"),
"status" => array("Status", "ASC"),
"hostname" => array("Hostname", "ASC"),
"cur_time" => array("Current (ms)", "DESC"),
"avg_time" => array("Average (ms)", "DESC"),
"availability" => array("Availability", "ASC"));
html_header_sort_checkbox($display_text, $_REQUEST["sort_column"], $_REQUEST["sort_direction"]);
$i = 0;
if (sizeof($hosts) > 0) {
foreach ($hosts as $host) {
form_alternate_row_color($colors["alternate"], $colors["light"], $i, 'line' . $host["id"]); $i++;
form_selectable_cell("<a class='linkEditMain' href='host.php?action=edit&id=" . $host["id"] . "'>" .
(strlen($_REQUEST["filter"]) ? eregi_replace("(" . preg_quote($_REQUEST["filter"]) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", $host["description"]) : $host["description"]) . "</a>", $host["id"], 250);
form_selectable_cell((isset($host_graphs[$host["id"]]) ? $host_graphs[$host["id"]] : 0), $host["id"]);
form_selectable_cell((isset($host_data_sources[$host["id"]]) ? $host_data_sources[$host["id"]] : 0), $host["id"]);
form_selectable_cell(get_colored_device_status(($host["disabled"] == "on" ? true : false), $host["status"]), $host["id"]);
form_selectable_cell((strlen($_REQUEST["filter"]) ? eregi_replace("(" . preg_quote($_REQUEST["filter"]) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", $host["hostname"]) : $host["hostname"]), $host["id"]);
form_selectable_cell(round(($host["cur_time"]), 2), $host["id"]);
form_selectable_cell(round(($host["avg_time"]), 2), $host["id"]);
form_selectable_cell(round($host["availability"], 2), $host["id"]);
form_checkbox_cell($host["description"], $host["id"]);
form_end_row();
}
/* put the nav bar on the bottom as well */
print $nav;
}else{
print "<tr><td><em>No Hosts</em></td></tr>";
}
html_end_box(false);
/* add a list of tree names to the actions dropdown */
add_tree_names_to_actions_array();
/* draw the dropdown containing a list of available actions for this form */
draw_actions_dropdown($device_actions);
}
开发者ID:songchin,项目名称:Cacti,代码行数:101,代码来源:host.php
示例2: mactrack_format_device_row
function mactrack_format_device_row($device, $actions = false)
{
global $config, $colors, $mactrack_device_types;
/* viewer level */
if ($actions) {
$row = "<a href='" . htmlspecialchars($config['url_path'] . "plugins/mactrack/mactrack_interfaces.php?device_id=" . $device['device_id'] . "&issues=0&page=1") . "'><img src='" . $config['url_path'] . "plugins/mactrack/images/view_interfaces.gif' alt='' onMouseOver='style.cursor=\"pointer\"' title='View Interfaces' align='middle' border='0'></a>";
/* admin level */
if (mactrack_authorized(2121)) {
if ($device["disabled"] == '') {
$row .= "<img id='r_" . $device["device_id"] . "' src='" . $config['url_path'] . "plugins/mactrack/images/rescan_device.gif' alt='' onMouseOver='style.cursor=\"pointer\"' onClick='scan_device(" . $device["device_id"] . ")' title='Rescan Device' align='middle' border='0'>";
} else {
$row .= "<img src='" . $config['url_path'] . "plugins/mactrack/images/view_none.gif' alt='' align='middle' border='0'>";
}
}
print "<td style='width:40px;'>" . $row . "</td>";
//, $device["device_id"]);
}
form_selectable_cell("<a class='linkEditMain' href='mactrack_devices.php?action=edit&device_id=" . $device['device_id'] . "'>" . (strlen($_REQUEST['filter']) ? preg_replace("/(" . preg_quote($_REQUEST['filter']) . ")/i", "<span style='background-color: #F8D93D;'>\\1</span>", $device['device_name']) : $device['device_name']) . "</a>", $device["device_id"]);
form_selectable_cell($device["site_name"], $device["device_id"]);
form_selectable_cell(get_colored_device_status($device["disabled"] == "on" ? true : false, $device["snmp_status"]), $device["device_id"]);
form_selectable_cell(strlen($_REQUEST["filter"]) ? preg_replace("/(" . preg_quote($_REQUEST["filter"]) . ")/i", "<span style='background-color: #F8D93D;'>\\1</span>", $device["hostname"]) : $device["hostname"], $device["device_id"]);
form_selectable_cell($device["device_type"] == '' ? 'Not Detected' : $device["device_type"], $device["device_id"]);
form_selectable_cell($device["scan_type"] == "1" ? "N/A" : $device["ips_total"], $device["device_id"]);
form_selectable_cell($device["scan_type"] == "3" ? "N/A" : $device["ports_total"], $device["device_id"]);
form_selectable_cell($device["scan_type"] == "3" ? "N/A" : $device["ports_active"], $device["device_id"]);
form_selectable_cell($device["scan_type"] == "3" ? "N/A" : $device["ports_trunk"], $device["device_id"]);
form_selectable_cell($device["scan_type"] == "3" ? "N/A" : $device["macs_active"], $device["device_id"]);
form_selectable_cell(number_format($device["last_runduration"], 1), $device["device_id"]);
form_checkbox_cell($device["device_name"], $device["device_id"]);
form_end_row();
}
开发者ID:avillaverdec,项目名称:cacti,代码行数:31,代码来源:mactrack_functions.php
示例3: hosts
//.........这里部分代码省略.........
strURL = '?header=false&action=edit&id=<?php
print get_request_var('id');
?>
'
strURL += '&rows=' + $('#rows').val();
strURL += '&host_template_id=' + $('#host_template_id').val();
strURL += '&associated=' + $('#associated').is(':checked');
strURL += '&filter=' + $('#filter').val();
loadPageNoHeader(strURL);
}
function clearFilter() {
strURL = 'notify_lists.php?header=false&action=edit&id=<?php
print get_request_var('id');
?>
&clearf=true'
loadPageNoHeader(strURL);
}
$(function() {
$('#form_devices').submit(function(event) {
event.preventDefault();
applyFilter();
});
});
</script>
</td>
</tr>
<?php
html_end_box();
/* form the 'where' clause for our main sql query */
if (strlen(get_request_var('filter'))) {
$sql_where = "WHERE (host.hostname LIKE '%" . get_request_var('filter') . "%' OR host.description LIKE '%" . get_request_var('filter') . "%')";
} else {
$sql_where = '';
}
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 ' : 'WHERE ') . ' host.host_template_id=0';
} elseif (!isempty_request_var('host_template_id')) {
$sql_where .= (strlen($sql_where) ? ' AND ' : 'WHERE ') . ' host.host_template_id=' . get_request_var('host_template_id');
}
if (get_request_var('associated') == 'false') {
/* Show all items */
} else {
$sql_where .= (strlen($sql_where) ? ' AND ' : 'WHERE ') . ' (host.thold_send_email>1 AND host.thold_host_email=' . get_request_var('id') . ')';
}
$total_rows = db_fetch_cell("select\n\t\tCOUNT(host.id)\n\t\tfrom host\n\t\t{$sql_where}");
$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');
$sql_query = "SELECT *\n\t\tFROM host {$sql_where}\n\t\tLIMIT " . $rows * (get_request_var('page') - 1) . ',' . $rows;
$hosts = db_fetch_assoc($sql_query);
$nav = html_nav_bar('notify_lists.php?action=edit&id=' . get_request_var('id'), MAX_DISPLAY_PAGES, get_request_var('page'), $rows, $total_rows, 10, __('Devices'), 'page', 'main');
form_start('notify_lists.php', 'chk');
print $nav;
html_start_box('', '100%', '', '3', 'center', '');
$display_text = array(__('Description'), __('ID'), __('Associated Lists'), __('Graphs'), __('Data Sources'), __('Status'), __('Hostname'));
html_header_checkbox($display_text);
if (sizeof($hosts)) {
foreach ($hosts as $host) {
form_alternate_row('line' . $host['id'], true);
form_selectable_cell(filter_value($host['description'], get_request_var('filter')), $host['id'], 250);
form_selectable_cell(round($host['id'], 2), $host['id']);
if ($host['thold_send_email'] == 0) {
form_selectable_cell('<span style="color:blue;font-weight:bold;">' . __('Disabled') . '</span>', $host['id']);
} elseif ($host['thold_send_email'] == 1) {
form_selectable_cell('<span style="color:purple;font-weight:bold;">' . __('Global List') . '</span>', $host['id']);
} elseif ($host['thold_host_email'] == get_request_var('id')) {
if ($host['thold_send_email'] == 2) {
form_selectable_cell('<span style="color:green;font-weight:bold;">' . __('Current List Only') . '</span>', $host['id']);
} else {
form_selectable_cell('<span style="color:green;font-weight:bold;">' . __('Current and Global List(s)') . '</span>', $host['id']);
}
} elseif ($host['thold_host_email'] == '0') {
form_selectable_cell('<span style="color:green;font-weight:bold;">' . __('None') . '</span>', $host['id']);
} else {
form_selectable_cell('<span style="color:red;font-weight:bold;">' . db_fetch_cell('SELECT name FROM plugin_notification_lists WHERE id=' . get_request_var('id')) . '</span>', $host['id']);
}
form_selectable_cell(isset($host_graphs[$host['id']]) ? $host_graphs[$host['id']] : 0, $host['id']);
form_selectable_cell(isset($host_data_sources[$host['id']]) ? $host_data_sources[$host['id']] : 0, $host['id']);
form_selectable_cell(get_colored_device_status($host['disabled'] == 'on' ? true : false, $host['status']), $host['id']);
form_selectable_cell(filter_value($host['hostname'], get_request_var('filter')), $host['id']);
form_checkbox_cell($host['description'], $host['id']);
form_end_row();
}
} else {
print '<tr><td><em>' . __('No Associated Devices Found') . '</em></td></tr>';
}
html_end_box(false);
if (sizeof($hosts)) {
print $nav;
}
form_hidden_box('tab', 'hosts', '');
form_hidden_box('id', get_request_var('id'), '');
form_hidden_box('save_associate', '1', '');
draw_actions_dropdown($assoc_actions);
form_end();
}
开发者ID:Cacti,项目名称:plugin_thold,代码行数:101,代码来源:notify_lists.php
示例4: tholds_old
//.........这里部分代码省略.........
'>
</form>
</td>
</tr>
<?php
html_end_box();
/* form the 'where' clause for our main sql query */
if (strlen(get_request_var_request("filter"))) {
$sql_where = "WHERE (host.hostname LIKE '%%" . get_request_var_request("filter") . "%%' OR host.description LIKE '%%" . get_request_var_request("filter") . "%%')";
} else {
$sql_where = "";
}
if (get_request_var_request("host_template_id") == "-1") {
/* Show all items */
} elseif (get_request_var_request("host_template_id") == "0") {
$sql_where .= (strlen($sql_where) ? " AND " : "WHERE ") . " host.host_template_id=0";
} elseif (!empty($_REQUEST["host_template_id"])) {
$sql_where .= (strlen($sql_where) ? " AND " : "WHERE ") . " host.host_template_id=" . get_request_var_request("host_template_id");
}
if (get_request_var_request("associated") == "false") {
/* Show all items */
} else {
$sql_where .= (strlen($sql_where) ? " AND " : "WHERE ") . " (host.thold_send_email>1 AND host.thold_host_email=" . get_request_var_request("id") . ")";
}
/* print checkbox form for validation */
print "<form name='chk' method='post' action='notify_lists.php?action=edit&tab=hosts&id=" . get_request_var_request("id") . "'>\n";
html_start_box("", "100%", $colors["header"], "3", "center", "");
$total_rows = db_fetch_cell("SELECT\n\t\tCOUNT(*)\n\t\tFROM host\n\t\t{$sql_where}");
$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");
$sql_query = "SELECT * \n\t\tFROM host {$sql_where} \n\t\tLIMIT " . get_request_var_request("rows") * (get_request_var_request("page") - 1) . "," . get_request_var_request("rows");
$hosts = db_fetch_assoc($sql_query);
/* generate page list */
if ($total_rows > 0) {
$url_page_select = get_page_list(get_request_var_request("page"), MAX_DISPLAY_PAGES, get_request_var_request("rows"), $total_rows, "notify_lists.php?action=edit&tab=hosts&id=" . get_request_var_request('id'));
$nav = "<tr bgcolor='#" . $colors["header"] . "'>\n\t\t\t\t<td colspan='8'>\n\t\t\t\t\t<table width='100%' cellspacing='0' cellpadding='0' border='0'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='left' class='textHeaderDark'>\n\t\t\t\t\t\t\t\t<strong><< ";
if (get_request_var_request("page") > 1) {
$nav .= "<a class='linkOverDark' href='" . htmlspecialchars("notify_lists.php?action=edit&id=" . get_request_var_request("id") . "&page=" . (get_request_var_request("page") - 1)) . "'>";
}
$nav .= "Previous";
if (get_request_var_request("page") > 1) {
$nav .= "</a>";
}
$nav .= "</strong>\n\t\t\t\t\t\t\t</td>\n\n\t\t\t\t\t\t\t<td align='center' class='textHeaderDark'>\n\t\t\t\t\t\t\t\tShowing Rows " . (get_request_var_request("rows") * (get_request_var_request("page") - 1) + 1) . " to " . ($total_rows < read_config_option("num_rows_device") || $total_rows < get_request_var_request("rows") * get_request_var_request("page") ? $total_rows : get_request_var_request("rows") * get_request_var_request("page")) . " of {$total_rows} [{$url_page_select}]\n\t\t\t\t\t\t\t</td>\n\n\t\t\t\t\t\t\t<td align='right' class='textHeaderDark'>\n\t\t\t\t\t\t\t\t\t\t<strong>";
if (get_request_var_request("page") * get_request_var_request("rows") < $total_rows) {
$nav .= "<a class='linkOverDark' href='" . htmlspecialchars("notify_lists.php?action=edit&id=" . get_request_var_request("id") . "&page=" . (get_request_var_request("page") + 1)) . "'>";
}
$nav .= "Next";
if (get_request_var_request("page") * get_request_var_request("rows") < $total_rows) {
$nav .= "</a>";
}
$nav .= " >></strong>\n\t\t\t\t\t\t\t</td>\n\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t</td>\n\t\t\t</tr>\n";
} else {
$nav = "<tr bgcolor='#" . $colors["header"] . "'>\n\t\t\t\t<td colspan='8'>\n\t\t\t\t\t<table width='100%' cellspacing='0' cellpadding='0' border='0'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align='center' class='textHeaderDark'>\n\t\t\t\t\t\t\t\tNo Rows Found\n\t\t\t\t\t\t\t</td>\n\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t</td>\n\t\t\t</tr>\n";
}
print $nav;
$display_text = array("Description", "ID", "Associated Lists", "Graphs", "Data Sources", "Status", "Hostname");
html_header_checkbox($display_text);
$i = 0;
if (sizeof($hosts)) {
foreach ($hosts as $host) {
form_alternate_row_color($colors["alternate"], $colors["light"], $i, 'line' . $host["id"]);
$i++;
form_selectable_cell(strlen(get_request_var_request("filter")) ? preg_replace("/(" . preg_quote(get_request_var_request("filter")) . ")/i", "<span style='background-color: #F8D93D;'>\\1</span>", htmlspecialchars($host["description"])) : htmlspecialchars($host["description"]), $host["id"], 250);
form_selectable_cell(round($host["id"], 2), $host["id"]);
if ($host['thold_send_email'] == 0) {
form_selectable_cell('<span style="color:blue;font-weight:bold;">Disabled</span>', $host['id']);
} elseif ($host['thold_send_email'] == 1) {
form_selectable_cell('<span style="color:purple;font-weight:bold;">Global List</span>', $host['id']);
} elseif ($host['thold_host_email'] == get_request_var_request('id')) {
if ($host['thold_send_email'] == 2) {
form_selectable_cell('<span style="color:green;font-weight:bold;">Current List Only</span>', $host['id']);
} else {
form_selectable_cell('<span style="color:green;font-weight:bold;">Current and Global List(s)</span>', $host['id']);
}
} elseif ($host['thold_host_email'] == '0') {
form_selectable_cell('<span style="color:green;font-weight:bold;">None</span>', $host['id']);
} else {
form_selectable_cell('<span style="color:red;font-weight:bold;">' . db_fetch_cell("SELECT name FROM plugin_notification_lists WHERE id=" . get_request_var_request('id')) . '</span>', $host['id']);
}
form_selectable_cell(isset($host_graphs[$host["id"]]) ? $host_graphs[$host["id"]] : 0, $host["id"]);
form_selectable_cell(isset($host_data_sources[$host["id"]]) ? $host_data_sources[$host["id"]] : 0, $host["id"]);
form_selectable_cell(get_colored_device_status($host["disabled"] == "on" ? true : false, $host["status"]), $host["id"]);
form_selectable_cell(strlen(get_request_var_request("filter")) ? preg_replace("/(" . preg_quote(get_request_var_request("filter")) . ")/i", "<span style='background-color: #F8D93D;'>\\1</span>", htmlspecialchars($host["hostname"])) : htmlspecialchars($host["hostname"]), $host["id"]);
form_checkbox_cell($host["description"], $host["id"]);
form_end_row();
}
/* put the nav bar on the bottom as well */
print $nav;
} else {
print "<tr><td><em>No Associated Hosts Found</em></td></tr>";
}
html_end_box(false);
form_hidden_box("action", "edit");
form_hidden_box("id", get_request_var_request("id"));
form_hidden_box("save_associate", "1");
/* draw the dropdown containing a list of available actions for this form */
draw_actions_dropdown($assoc_actions);
print "</form>\n";
}
开发者ID:caiorasec,项目名称:thold,代码行数:101,代码来源:notify_lists.php
示例5: device
//.........这里部分代码省略.........
html_start_box("", "100", $colors["header"], "0", "center", "");
$total_rows = db_fetch_cell("select
COUNT(device.id)
from device
$sql_where");
if (get_request_var_request("rows") == "-1") {
$rows = read_config_option("num_rows_device");
}else{
$rows = get_request_var_request("rows");
}
$sortby = $_REQUEST["sort_column"];
if ($sortby=="hostname") {
$sortby = "INET_ATON(hostname)";
}
$device_graphs = array_rekey(db_fetch_assoc("SELECT device_id, count(*) as graphs FROM graph_local GROUP BY device_id"), "device_id", "graphs");
$device_data_sources = array_rekey(db_fetch_assoc("SELECT device_id, count(*) as data_sources FROM data_local GROUP BY device_id"), "device_id", "data_sources");
$sql_query = "SELECT device.*, poller.description AS poller, sites.name AS site
FROM device
LEFT JOIN poller
ON device.poller_id=poller.id
LEFT JOIN sites
ON device.site_id=sites.id
$sql_where
ORDER BY " . $sortby . " " . get_request_var_request("sort_direction") . "
LIMIT " . ($rows*(get_request_var_request("page")-1)) . "," . $rows;
//print $sql_query;
$devices = db_fetch_assoc($sql_query);
/* generate page list navigation */
$nav = html_create_nav($_REQUEST["page"], MAX_DISPLAY_PAGES, $rows, $total_rows, 13, "devices.php");
print $nav;
html_end_box(false);
$display_text = array(
"description" => array(__("Description"), "ASC"),
"device.hostname" => array(__("Hostname"), "ASC"),
"id" => array(__("ID"), "ASC"),
"nosort1" => array(__("Graphs"), "ASC"),
"nosort2" => array(__("Data Sources"), "ASC"),
"status" => array(__("Status"), "ASC"),
"status_event_count" => array(__("Event Count"), "ASC"),
"cur_time" => array(__("Current (ms)"), "DESC"),
"avg_time" => array(__("Average (ms)"), "DESC"),
"availability" => array(__("Availability"), "ASC"),
"polling_time" => array(__("Poll Time"), "DESC"));
html_header_sort_checkbox($display_text, get_request_var_request("sort_column"), get_request_var_request("sort_direction"));
if (sizeof($devices) > 0) {
foreach ($devices as $device) {
$spanextra = "";
if($device["disabled"] != CHECKED && $device["status"] == DEVICE_DOWN) {
$date = __date("D, " . date_time_format() . " T", strtotime($device['status_fail_date']));
$spanextra = 'title="' . __("Down since %s with error: '%s'", $date, $device['status_last_error']) . '"';
}
form_alternate_row_color('line' . $device["id"], true);
form_selectable_cell("<a style='white-space:nowrap;' class='linkEditMain' href='" . htmlspecialchars("devices.php?action=edit&id=" . $device["id"]) . "'>" .
(strlen($_REQUEST["filter"]) ? preg_replace("/(" . preg_quote($_REQUEST["filter"]) . ")/i", "<span class=\"filter\">\\1</span>", $device["description"]) : $device["description"]) . "</a>", $device["id"]);
form_selectable_cell((strlen($_REQUEST["filter"]) ? preg_replace("/(" . preg_quote($_REQUEST["filter"]) . ")/i", "<span class=\"filter\">\\1</span>", $device["hostname"]) : $device["hostname"]), $device["id"]);
form_selectable_cell(round(($device["id"]), 2), $device["id"]);
form_selectable_cell((isset($device_graphs[$device["id"]]) ? $device_graphs[$device["id"]] : 0), $device["id"]);
form_selectable_cell((isset($device_data_sources[$device["id"]]) ? $device_data_sources[$device["id"]] : 0), $device["id"]);
form_selectable_cell( "<span $spanextra>".get_colored_device_status(($device["disabled"] == CHECKED ? true : false), $device["status"]) . "</span>", $device["id"]);
form_selectable_cell(round(($device["status_event_count"]), 2), $device["id"]);
form_selectable_cell(round(($device["cur_time"]), 2), $device["id"]);
form_selectable_cell(round(($device["avg_time"]), 2), $device["id"]);
form_selectable_cell(round($device["availability"], 2), $device["id"]);
form_selectable_cell(round($device["polling_time"], 2), $device["id"]);
form_checkbox_cell($device["description"], $device["id"]);
form_end_row();
}
form_end_table();
/* put the nav bar on the bottom as well */
print $nav;
}else{
print "<tr><td><em>" . __("No Hosts") . "</em></td></tr>";
}
print "</table>\n";
/* add a list of tree names to the actions dropdown */
$device_actions = array_merge($device_actions, api_tree_add_tree_names_to_actions_array());
/* draw the dropdown containing a list of available actions for this form */
draw_actions_dropdown($device_actions);
print "</form>\n";
}
开发者ID:songchin,项目名称:Cacti,代码行数:101,代码来源:device_form.php
示例6: mactrack_view_devices
//.........这里部分代码省略.........
}else{
$nav = "<tr bgcolor='#" . $colors["header"] . "' class='noprint'>
<td colspan='22'>
<table width='100%' cellspacing='0' cellpadding='0' border='0'>
<tr>
<td align='center' class='textHeaderDark'>
No Rows Found
</td>\n
</tr>
</table>
</td>
</tr>\n";
}
}else{
$nav = html_create_nav($_REQUEST["page"], MAX_DISPLAY_PAGES, $row_limit, $total_rows, 13, "mactrack_view_sites.php");
}
print $nav;
$display_text = array(
"nosort" => array("Actions", ""),
"device_name" => array("Device Name", "ASC"),
"site_name" => array("Site Name", "ASC"),
"snmp_status" => array("Status", "ASC"),
"hostname" => array("Hostname", "ASC"),
"device_type" => array("Device Type", "ASC"),
"ips_total" => array("Total IP's", "DESC"),
"ports_total" => array("User Ports", "DESC"),
"ports_active" => array("User Ports Up", "DESC"),
"ports_trunk" => array("Trunk Ports", "DESC"),
"macs_active" => array("Active Macs", "DESC"),
"vlans_total" => array("Total VLAN's", "DESC"),
"last_runduration" => array("Last Duration", "DESC"));
html_header_sort($display_text, $_REQUEST["sort_column"], $_REQUEST["sort_direction"]);
$i = 0;
if (sizeof($devices) > 0) {
foreach ($devices as $device) {
$hostinfo["hostname"] = $device["hostname"];
$hostinfo["user"] = $device["user_name"];
switch($device["term_type"]) {
case 0:
$hostinfo["transport"] = "none";
break;
case 1:
$hostinfo["transport"] = "telnet";
break;
case 2:
$hostinfo["transport"] = "ssh";
break;
case 3:
$hostinfo["transport"] = "http";
break;
case 4:
$hostinfo["transport"] = "https";
break;
}
form_alternate_row_color($colors["alternate"],$colors["light"],$i); $i++;
?>
<td width=100>
<?php if (mactrack_authorized(2121)) {?>
<a href='<?php print $webroot . "plugins/mactrack/mactrack_devices.php?action=edit&device_id=" . $device['device_id'];?>' title='Edit Device'><img border='0' src='<?php print $webroot;?>plugins/mactrack/images/edit_object.png'></a>
<?php api_plugin_hook_function('remote_link', $hostinfo); } ?>
<?php if ($device["host_id"] > 0) {?>
<a href='<?php print $webroot . "plugins/mactrack/mactrack_view_graphs.php?action=preview&report=graphs&style=selective&graph_list=&host_id=" . $device["host_id"] . "&graph_template_id=0&filter=";?>' title='View Graphs'><img border='0' src='<?php print $webroot;?>plugins/mactrack/images/view_graphs.gif'></a>
<?php }else{?>
<img title='Device Not Mapped to Cacti Device' border='0' src='<?php print $webroot;?>plugins/mactrack/images/view_graphs_disabled.gif'>
<?php }?>
<a href='<?php print $webroot . "plugins/mactrack/mactrack_view_macs.php?report=macs&reset&device_id=-1&scan_date=3&site_id=" . $_REQUEST["site_id"] . "&device_id=" . $device['device_id'];?>' title='View MAC Addresses'><img border='0' src='<?php print $webroot;?>plugins/mactrack/images/view_macs.gif'></a>
<a href='<?php print $webroot . "plugins/mactrack/mactrack_view_interfaces.php?report=interfaces&reset&site=" . $_REQUEST["site_id"] . "&device=" . $device['device_id'];?>' title='View Interfaces'><img border='0' src='<?php print $webroot;?>plugins/mactrack/images/view_interfaces.gif'></a>
</td>
<td width=150>
<?php print "<strong>" . (strlen($_REQUEST["filter"]) ? preg_replace("/(" . preg_quote($_REQUEST["filter"]) . ")/i", "<span style='background-color: #F8D93D;'>\\1</span>", $device["device_name"]) : $device["device_name"]) . "</strong>";?>
</td>
<td><?php print (strlen($_REQUEST["filter"]) ? preg_replace("/(" . preg_quote($_REQUEST["filter"]) . ")/i", "<span style='background-color: #F8D93D;'>\\1</span>", $device["site_name"]) : $device["site_name"]);?></td>
<td><?php print get_colored_device_status(($device["disabled"] == "on" ? true : false), $device["snmp_status"]);?></td>
<td><?php print (strlen($_REQUEST["filter"]) ? preg_replace("/(" . preg_quote($_REQUEST["filter"]) . ")/i", "<span style='background-color: #F8D93D;'>\\1</span>", $device["hostname"]) : $device["hostname"]);?></td>
<td><?php print $device["device_type"];?></td>
<td><?php print ($device["scan_type"] == "1" ? "N/A" : $device["ips_total"]);?></td>
<td><?php print ($device["scan_type"] == "3" ? "N/A" : $device["ports_total"]);?></td>
<td><?php print ($device["scan_type"] == "3" ? "N/A" : $device["ports_active"]);?></td>
<td><?php print ($device["scan_type"] == "3" ? "N/A" : $device["ports_trunk"]);?></td>
<td><?php print ($device["scan_type"] == "3" ? "N/A" : $device["macs_active"]);?></td>
<td><?php print ($device["scan_type"] == "3" ? "N/A" : $device["vlans_total"]);?></td>
<td><?php print number_format($device["last_runduration"], 1);?></td>
</tr>
<?php
}
}else{
print "<tr><td colspan='10'><em>No MacTrack Devices</em></td></tr>";
}
print $nav;
html_end_box(false);
mactrack_display_stats();
}
开发者ID:avillaverdec,项目名称:cacti,代码行数:101,代码来源:mactrack_view_devices.php
示例7: hmib_devices
//.........这里部分代码省略.........
<?php
html_end_box();
if (get_request_var('rows') == '-1') {
$num_rows = read_config_option('num_rows_table');
} else {
$num_rows = get_request_var('rows');
}
$limit = ' LIMIT ' . $num_rows * (get_request_var('page') - 1) . ',' . $num_rows;
$sql_where = '';
if (get_request_var('template') != '-1') {
$sql_where .= (strlen($sql_where) ? ' AND' : 'WHERE') . ' host.host_template_id=' . get_request_var('template');
}
if (get_request_var('status') != '-1') {
$sql_where .= (strlen($sql_where) ? ' AND' : 'WHERE') . ' hrs.host_status=' . get_request_var('status');
}
if (get_request_var('type') != '-1') {
$sql_where .= (strlen($sql_where) ? ' AND' : 'WHERE') . ' hrs.host_type=' . get_request_var('type');
}
if (get_request_var('process') != '' && get_request_var('process') != '-1') {
$sql_join = 'INNER JOIN plugin_hmib_hrSWRun AS hrswr ON host.id=hrswr.host_id';
$sql_where .= (strlen($sql_where) ? ' AND' : 'WHERE') . " hrswr.name='" . get_request_var('process') . "'";
} else {
$sql_join = '';
}
if (get_request_var('filter') != '') {
$sql_where .= (strlen($sql_where) ? ' AND' : 'WHERE') . " host.description LIKE '%" . get_request_var('filter') . "%' OR\n\t\t\thost.hostname LIKE '%" . get_request_var('filter') . "%'";
}
$sql = "SELECT hrs.*, host.hostname, host.description, host.disabled\n\t\tFROM plugin_hmib_hrSystem AS hrs\n\t\tINNER JOIN host ON host.id=hrs.host_id\n\t\t{$sql_join}\n\t\t{$sql_where}\n\t\tORDER BY " . get_request_var('sort_column') . ' ' . get_request_var('sort_direction') . ' ' . $limit;
$rows = db_fetch_assoc($sql);
$total_rows = db_fetch_cell("SELECT COUNT(*)\n\t\tFROM plugin_hmib_hrSystem AS hrs\n\t\tINNER JOIN host ON host.id=hrs.host_id\n\t\t{$sql_join}\n\t\t{$sql_where}");
$nav = html_nav_bar('hmib.php?action=devices', MAX_DISPLAY_PAGES, get_request_var('page'), $num_rows, $total_rows, 16, __('Devices'), 'page', 'main');
print $nav;
html_start_box('', '100%', '', '3', 'center', '');
$display_text = array('nosort' => array('display' => __('Actions'), 'sort' => 'ASC', 'align' => 'left'), 'description' => array('display' => __('Hostname'), 'sort' => 'ASC', 'align' => 'left'), 'host_status' => array('display' => __('Status'), 'sort' => 'DESC', 'align' => 'right'), 'uptime' => array('display' => __('Uptime(d:h:m)'), 'sort' => 'DESC', 'align' => 'right'), 'users' => array('display' => __('Users'), 'sort' => 'DESC', 'align' => 'right'), 'cpuPercent' => array('display' => __('CPU %'), 'sort' => 'DESC', 'align' => 'right'), 'numCpus' => array('display' => __('CPUs'), 'sort' => 'DESC', 'align' => 'right'), 'processes' => array('display' => __('Processes'), 'sort' => 'DESC', 'align' => 'right'), 'memSize' => array('display' => __('Total Mem'), 'sort' => 'DESC', 'align' => 'right'), 'memUsed' => array('display' => __('Used Mem'), 'sort' => 'DESC', 'align' => 'right'), 'swapSize' => array('display' => __('Total Swap'), 'sort' => 'DESC', 'align' => 'right'), 'swapUsed' => array('display' => __('Used Swap'), 'sort' => 'DESC', 'align' => 'right'));
html_header_sort($display_text, get_request_var('sort_column'), get_request_var('sort_direction'), false, 'hmib.php?action=devices');
/* set some defaults */
$url = $config['url_path'] . 'plugins/hmib/hmib.php';
$proc = $config['url_path'] . 'plugins/hmib/images/cog.png';
$host = $config['url_path'] . 'plugins/hmib/images/server.png';
$hardw = $config['url_path'] . 'plugins/hmib/images/view_hardware.gif';
$inven = $config['url_path'] . 'plugins/hmib/images/view_inventory.gif';
$storage = $config['url_path'] . 'plugins/hmib/images/drive.png';
$dashboard = $config['url_path'] . 'plugins/hmib/images/view_dashboard.gif';
$graphs = $config['url_path'] . 'plugins/hmib/images/view_graphs.gif';
$nographs = $config['url_path'] . 'plugins/hmib/images/view_graphs_disabled.gif';
$htdq = db_fetch_cell("SELECT id \n\t\tFROM snmp_query \n\t\tWHERE hash='137aeab842986a76cf5bdef41b96c9a3'");
$hcpudq = db_fetch_cell("SELECT id \n\t\tFROM snmp_query \n\t\tWHERE hash='0d1ab53fe37487a5d0b9e1d3ee8c1d0d'");
$hugt = db_fetch_cell("SELECT id \n\t\tFROM graph_templates \n\t\tWHERE hash='e8462bbe094e4e9e814d4e681671ea82'");
$hpgt = db_fetch_cell("SELECT id \n\t\tFROM graph_templates \n\t\tWHERE hash='62205afbd4066e5c4700338841e3901e'");
if (sizeof($rows)) {
foreach ($rows as $row) {
$days = intval($row['uptime'] / (60 * 60 * 24 * 100));
$remainder = $row['uptime'] % (60 * 60 * 24 * 100);
$hours = intval($remainder / (60 * 60 * 100));
$remainder = $remainder % (60 * 60 * 100);
$minutes = intval($remainder / (60 * 100));
$found = db_fetch_cell('SELECT COUNT(*) FROM graph_local WHERE host_id=' . $row['host_id']);
form_alternate_row();
echo "<td width='120'>";
//echo "<a style='padding:1px;' href='" . htmlspecialchars("$url?action=dashboard&reset=1&device=" . $row["host_id"]) . "'><img src='$dashboard' title='View Dashboard' align='absmiddle'></a>";
echo "<a style='padding:1px;' href='" . htmlspecialchars("{$url}?action=storage&reset=1&device=" . $row['host_id']) . "'><img src='{$storage}' title='" . __('View Storage') . "' align='absmiddle' alt=''></a>";
echo "<a style='padding:1px;' href='" . htmlspecialchars("{$url}?action=hardware&reset=1&device=" . $row['host_id']) . "'><img src='{$hardw}' title='" . __('View Hardware') . "' align='absmiddle' alt=''></a>";
echo "<a style='padding:1px;' href='" . htmlspecialchars("{$url}?action=running&reset=1&device=" . $row['host_id']) . "'><img src='{$proc}' title='" . __('View Processes') . "' align='absmiddle' alt=''></a>";
echo "<a style='padding:1px;' href='" . htmlspecialchars("{$url}?action=software&reset=1&device=" . $row['host_id']) . "'><img src='{$inven}' title='" . __('View Software Inventory') . "' align='absmiddle' alt=''></a>";
if ($found) {
echo "<a style='padding:1px;' href='" . htmlspecialchars("{$url}?action=graphs&reset=1&host_id=" . $row['host_id'] . "&style=selective&graph_add=&graph_list=&graph_template_id=0&filter=") . "'><img src='{$graphs}' title='" . __('View Graphs') . "' align='absmiddle' alt=''></a>";
} else {
echo "<img src='{$nographs}' title='" . __('No Graphs Defined') . "' align='absmiddle' alt=''>";
}
$graph_cpu = hmib_get_graph_url($hcpudq, 0, $row['host_id'], '', $row['numCpus'], false);
$graph_cpup = hmib_get_graph_url($hcpudq, 0, $row['host_id'], '', round($row['cpuPercent'], 2) . ' %', false);
$graph_users = hmib_get_graph_template_url($hugt, 0, $row['host_id'], $row['host_status'] < 2 ? 'N/A' : $row['users'], false);
$graph_aproc = hmib_get_graph_template_url($hpgt, 0, $row['host_id'], $row['host_status'] < 2 ? 'N/A' : $row['processes'], false);
if (api_plugin_user_realm_auth('host.php')) {
$host_url = "<a href='" . htmlspecialchars($config['url_path'] . 'host.php?action=edit&id=' . $row['host_id']) . "' title='" . __('Edit Device') . "'>" . $row['hostname'] . '</a>';
} else {
$host_url = $row['hostname'];
}
echo '</td>';
echo "<td class='nowrap left'>" . $row['description'] . ' [' . $host_url . ']' . '</td>';
echo "<td class='nowrap right'>" . get_colored_device_status($row['disabled'] == 'on' ? true : false, $row['host_status']) . '</td>';
echo "<td class='nowrap right'>" . hmib_format_uptime($days, $hours, $minutes) . '</td>';
echo "<td class='nowrap right'>" . $graph_users . '</td>';
echo "<td class='nowrap right'>" . ($row['host_status'] < 2 ? 'N/A' : $graph_cpup) . '</td>';
echo "<td class='nowrap right'>" . ($row['host_status'] < 2 ? 'N/A' : $graph_cpu) . '</td>';
echo "<td class='nowrap right'>" . $graph_aproc . '</td>';
echo "<td class='nowrap right'>" . hmib_memory($row['memSize']) . '</td>';
echo "<td class='nowrap right'>" . ($row['host_status'] < 2 ? 'N/A' : round($row['memUsed'], 0)) . ' %</td>';
echo "<td class='nowrap right'>" . hmib_memory($row['swapSize']) . '</td>';
echo "<td class='nowrap right'>" . ($row['host_status'] < 2 ? 'N/A' : round($row['swapUsed'], 0)) . ' %</td>';
}
echo '</tr>';
} else {
print '<tr><td><em>' . __('No Devices Found') . '</em></td></tr>';
}
html_end_box(false);
if (sizeof($rows)) {
print $nav;
}
}
开发者ID:Cacti,项目名称:plugin_hmib,代码行数:101,代码来源:hmib.php
示例8: thold_hosts
//.........这里部分代码省略.........
'>
</td>
</tr>
</table>
<input type='hidden' id='page' value='<?php
print get_request_var('page');
?>
'>
<input type='hidden' id='id' value='<?php
print get_request_var('id');
?>
'>
</form>
</td>
</tr>
<?php
html_end_box();
/* form the 'where' clause for our main sql query */
if (strlen(get_request_var('filter'))) {
$sql_where = "WHERE (h.hostname LIKE '%" . get_request_var('filter') . "%' \n\t\t\tOR h.description LIKE '%" . get_request_var('filter') . "%')";
} else {
$sql_where = '';
}
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 ' : 'WHERE ') . ' h.host_template_id=0';
} elseif (!isempty_request_var('host_template_id')) {
$sql_where .= (strlen($sql_where) ? ' AND ' : 'WHERE ') . ' h.host_template_id=' . get_request_var('host_template_id');
}
if (get_request_var('associated') == 'false') {
/* Show all items */
} else {
$sql_where .= (strlen($sql_where) ? ' AND ' : 'WHERE ') . ' type=1 AND schedule=' . get_request_var('id');
}
if (get_request_var('id')) {
$total_rows = db_fetch_cell("SELECT\n\t\t\tCOUNT(DISTINCT h.id)\n\t\t\tFROM host AS h\n\t\t\tLEFT JOIN (SELECT DISTINCT host_id FROM thold_data) AS td \n\t\t\tON h.id=td.host_id\n\t\t\tLEFT JOIN plugin_maint_hosts AS pmh\n\t\t\tON h.id=pmh.host\n\t\t\tAND pmh.schedule=" . get_request_var('id') . "\n\t\t\t{$sql_where}");
} else {
$total_rows = 0;
}
$sortby = get_request_var('sort_column');
if ($sortby == 'hostname') {
$sortby = 'INET_ATON(hostname)';
}
if (get_request_var('id')) {
$sql_query = 'SELECT h.*, pmh.type, graphs, data_sources, tholds,
(SELECT schedule FROM plugin_maint_hosts WHERE host=h.id AND schedule=' . get_request_var('id') . ") AS associated \n\t\t\tFROM host as h\n\t\t\tLEFT JOIN (SELECT COUNT(id) AS tholds, host_id FROM thold_data GROUP BY host_id) AS td\n\t\t\tON td.host_id=h.id\n\t\t\tLEFT JOIN (SELECT COUNT(id) AS graphs, host_id FROM graph_local GROUP BY host_id) AS gl\n\t\t\tON gl.host_id=h.id\n\t\t\tLEFT JOIN (SELECT COUNT(id) AS data_sources, host_id FROM data_local GROUP BY host_id) AS dl\n\t\t\ton dl.host_id=h.id\n\t\t\tLEFT JOIN plugin_maint_hosts AS pmh\n\t\t\tON pmh.host=h.id\n\t\t\tAND pmh.schedule=" . get_request_var('id') . "\n\t\t\t{$sql_where} \n\t\t\tGROUP BY h.id\n\t ORDER BY " . $sortby . ' ' . get_request_var('sort_direction') . '
LIMIT ' . $rows * (get_request_var('page') - 1) . ',' . $rows;
$hosts = db_fetch_assoc($sql_query);
} else {
$hosts = array();
}
$display_text = array('description' => array('display' => __('Description'), 'align' => 'left', 'sort' => 'ASC'), 'id' => array('display' => __('ID'), 'align' => 'right', 'sort' => 'asc'), 'nosort' => array('display' => __('Associated Schedules'), 'align' => 'left', 'sort' => ''), 'graphs' => array('display' => __('Graphs'), 'align' => 'right', 'sort' => 'desc'), 'data_sources' => array('display' => __('Data Sources'), 'align' => 'right', 'sort' => 'desc'), 'tholds' => array('display' => __('Thresholds'), 'align' => 'right', 'sort' => 'desc'), 'nosort1' => array('display' => __('Status'), 'align' => 'center', 'sort' => ''), 'hostname' => array('display' => __('Hostname'), 'align' => 'left', 'sort' => 'desc'));
/* generate page list */
$nav = html_nav_bar('maint.php?action=edit&tab=hosts&id=' . get_request_var('id'), MAX_DISPLAY_PAGES, get_request_var('page'), $rows, $total_rows, 13, __('Devices'), 'page', 'main');
form_start('maint.php', 'chk');
print $nav;
|
请发表评论