本文整理汇总了PHP中generate_box_open函数的典型用法代码示例。如果您正苦于以下问题:PHP generate_box_open函数的具体用法?PHP generate_box_open怎么用?PHP generate_box_open使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了generate_box_open函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: print_neighbours
/**
* Display neighbours.
*
* Display pages with device neighbours in some formats.
* Examples:
* print_neighbours() - display all neighbours from all devices
* print_neighbours(array('pagesize' => 99)) - display 99 neighbours from all device
* print_neighbours(array('pagesize' => 10, 'pageno' => 3, 'pagination' => TRUE)) - display 10 neighbours from page 3 with pagination header
* print_neighbours(array('pagesize' => 10, 'device' = 4)) - display 10 neighbours for device_id 4
*
* @param array $vars
* @return none
*
*/
function print_neighbours($vars)
{
// Get neighbours array
$neighbours = get_neighbours_array($vars);
if (!$neighbours['count']) {
// There have been no entries returned. Print the warning.
print_warning('<h4>No neighbours found!</h4>');
} else {
// Entries have been returned. Print the table.
$list = array('device' => FALSE);
if ($vars['page'] != 'device') {
$list['device'] = TRUE;
}
if (in_array($vars['graph'], array('bits', 'upkts', 'nupkts', 'pktsize', 'percent', 'errors', 'etherlike', 'fdb_count'))) {
$graph_types = array($vars['graph']);
} else {
$graph_types = array('bits', 'upkts', 'errors');
}
$string = generate_box_open($vars['header']);
$string .= '<table class="table table-striped table-hover table-condensed">' . PHP_EOL;
$cols = array(array(NULL, 'class="state-marker"'), 'device_a' => 'Local Device', 'port_a' => 'Local Port', 'NONE' => NULL, 'device_b' => 'Remote Device', 'port_b' => 'Remote Port', 'protocol' => 'Protocol');
if (!$list['device']) {
unset($cols[0], $cols['device_a']);
}
$string .= get_table_header($cols, $vars);
$string .= ' <tbody>' . PHP_EOL;
foreach ($neighbours['entries'] as $entry) {
$string .= ' <tr class="' . $entry['row_class'] . '">' . PHP_EOL;
if ($list['device']) {
$string .= ' <td class="state-marker"></td>';
$string .= ' <td class="entity">' . generate_device_link($entry, NULL, array('tab' => 'ports', 'view' => 'neighbours')) . '</td>' . PHP_EOL;
}
$string .= ' <td><span class="entity">' . generate_port_link($entry) . '</span><br />' . $entry['ifAlias'] . '</td>' . PHP_EOL;
$string .= ' <td><i class="icon-resize-horizontal text-success"></i></td>' . PHP_EOL;
if (is_numeric($entry['remote_port_id']) && $entry['remote_port_id']) {
$remote_port = get_port_by_id_cache($entry['remote_port_id']);
$remote_device = device_by_id_cache($remote_port['device_id']);
$string .= ' <td><span class="entity">' . generate_device_link($remote_device) . '</span><br />' . $remote_device['hardware'] . '</td>' . PHP_EOL;
$string .= ' <td><span class="entity">' . generate_port_link($remote_port) . '</span><br />' . $remote_port['ifAlias'] . '</td>' . PHP_EOL;
} else {
$string .= ' <td><span class="entity">' . $entry['remote_hostname'] . '</span><br />' . $entry['remote_platform'] . '</td>' . PHP_EOL;
$string .= ' <td><span class="entity">' . $entry['remote_port'] . '</span></td>' . PHP_EOL;
}
$string .= ' <td>' . strtoupper($entry['protocol']) . '</td>' . PHP_EOL;
$string .= ' </tr>' . PHP_EOL;
}
$string .= ' </tbody>' . PHP_EOL;
$string .= '</table>';
$string .= generate_box_close();
// Print pagination header
if ($neighbours['pagination_html']) {
$string = $neighbours['pagination_html'] . $string . $neighbours['pagination_html'];
}
// Print
echo $string;
}
}
开发者ID:Natolumin,项目名称:observium,代码行数:71,代码来源:neighbours.inc.php
示例2: print_mempool_table
function print_mempool_table($vars)
{
global $cache;
$sql = build_mempool_query($vars);
$mempools = array();
foreach (dbFetchRows($sql) as $mempool) {
if (isset($cache['devices']['id'][$mempool['device_id']])) {
$mempool['hostname'] = $cache['devices']['id'][$mempool['device_id']]['hostname'];
$mempool['html_row_class'] = $cache['devices']['id'][$mempool['device_id']]['html_row_class'];
$mempools[] = $mempool;
}
}
// Sorting
// FIXME. Sorting can be as function, but in must before print_table_header and after get table from db
switch ($vars['sort_order']) {
case 'desc':
$sort_order = SORT_DESC;
$sort_neg = SORT_ASC;
break;
case 'reset':
unset($vars['sort'], $vars['sort_order']);
// no break here
// no break here
default:
$sort_order = SORT_ASC;
$sort_neg = SORT_DESC;
}
switch ($vars['sort']) {
case 'usage':
$mempools = array_sort_by($mempools, 'mempool_perc', $sort_neg, SORT_NUMERIC);
break;
case 'used':
$mempools = array_sort_by($mempools, 'mempool_' . $vars['sort'], $sort_neg, SORT_NUMERIC);
break;
default:
$mempools = array_sort_by($mempools, 'hostname', $sort_order, SORT_STRING, 'mempool_descr', $sort_order, SORT_STRING);
break;
}
$mempools_count = count($mempools);
// Pagination
$pagination_html = pagination($vars, $mempools_count);
echo $pagination_html;
if ($vars['pageno']) {
$mempools = array_chunk($mempools, $vars['pagesize']);
$mempools = $mempools[$vars['pageno'] - 1];
}
// End Pagination
echo generate_box_open();
print_mempool_table_header($vars);
foreach ($mempools as $mempool) {
print_mempool_row($mempool, $vars);
}
echo "</tbody></table>";
echo generate_box_close();
echo $pagination_html;
}
开发者ID:Natolumin,项目名称:observium,代码行数:56,代码来源:mempool.inc.php
示例3: print_authlog
/**
* Display authentication log.
*
* @param array $vars
* @return none
*
*/
function print_authlog($vars)
{
$authlog = get_authlog_array($vars);
if (!$authlog['count']) {
// There have been no entries returned. Print the warning. Shouldn't happen, how did you get here without auth?!
print_warning('<h4>No authentication entries found!</h4>');
} else {
$string = generate_box_open($vars['header']);
// Entries have been returned. Print the table.
$string .= '<table class="' . OBS_CLASS_TABLE_STRIPED_MORE . '">' . PHP_EOL;
$cols = array('date' => array('Date', 'style="width: 150px;"'), 'user' => 'User', 'from' => 'From', 'ua' => array('User-Agent', 'style="width: 200px;"'), 'NONE' => 'Action');
if ($vars['page'] == 'preferences') {
unset($cols['user']);
}
$string .= get_table_header($cols);
//, $vars); // Currently sorting is not available
$string .= '<tbody>' . PHP_EOL;
foreach ($authlog['entries'] as $entry) {
if (strlen($entry['user_agent']) > 1) {
$entry['detect_browser'] = detect_browser($entry['user_agent']);
//r($entry['detect_browser']);
$entry['user_agent'] = '<i class="' . $entry['detect_browser']['icon'] . '"></i> ' . $entry['detect_browser']['browser_full'];
if ($entry['detect_browser']['platform']) {
$entry['user_agent'] .= ' (' . $entry['detect_browser']['platform'] . ')';
}
}
if (strstr(strtolower($entry['result']), 'fail', true)) {
$class = " class=\"error\"";
} else {
$class = "";
}
$string .= '
<tr' . $class . '>
<td>' . $entry['datetime'] . '</td>';
if (isset($cols['user'])) {
$string .= '
<td>' . escape_html($entry['user']) . '</td>';
}
$string .= '
<td>' . ($_SESSION['userlevel'] > 5 ? generate_popup_link('ip', $entry['address']) : preg_replace('/^\\d+/', '*', $entry['address'])) . '</td>
<td>' . $entry['user_agent'] . '</td>
<td>' . $entry['result'] . '</td>
</tr>' . PHP_EOL;
}
$string .= ' </tbody>' . PHP_EOL;
$string .= '</table>';
$string .= generate_box_close();
// Add pagination header
if ($authlog['pagination_html']) {
$string = $authlog['pagination_html'] . $string . $authlog['pagination_html'];
}
// Print authlog
echo $string;
}
}
开发者ID:Natolumin,项目名称:observium,代码行数:62,代码来源:authlog.inc.php
示例4: print_printersupplies_table
function print_printersupplies_table($vars)
{
$supplies = array();
foreach (dbFetchRows(build_printersupplies_query($vars)) as $supply) {
global $cache;
if (isset($cache['devices']['id'][$supply['device_id']])) {
$supply['hostname'] = $cache['devices']['id'][$supply['device_id']]['hostname'];
$supply['html_row_class'] = $cache['devices']['id'][$supply['device_id']]['html_row_class'];
$supplies[] = $supply;
}
}
$supplies = array_sort_by($supplies, 'hostname', SORT_ASC, SORT_STRING, 'supply_descr', SORT_ASC, SORT_STRING);
$supplies_count = count($supplies);
echo generate_box_open();
// Pagination
$pagination_html = pagination($vars, $supplies_count);
echo $pagination_html;
if ($vars['pageno']) {
$supplies = array_chunk($supplies, $vars['pagesize']);
$supplies = $supplies[$vars['pageno'] - 1];
}
// End Pagination
if ($vars['view'] == "graphs") {
$stripe_class = "table-striped-two";
} else {
$stripe_class = "table-striped";
}
// Allow the table to be printed headerless for use in some places.
if ($vars['headerless'] != TRUE) {
echo '<table class="table ' . $stripe_class . ' table-condensed">';
echo ' <thead>';
echo '<tr class="strong">';
echo '<th class="state-marker"></th>';
echo '<th></th>';
if ($vars['page'] != "device" && $vars['popup'] != TRUE) {
echo ' <th style="width: 250px;">Device</th>';
}
echo '<th>Toner</th>';
if (!isset($vars['supply'])) {
echo '<th>Type</th>';
}
echo '<th></th>';
echo '<th>Level</th>';
echo '<th>Remaining</th>';
echo '</tr>';
echo '</thead>';
}
foreach ($supplies as $supply) {
print_printersupplies_row($supply, $vars);
}
echo "</table>";
echo generate_box_close();
echo $pagination_html;
}
开发者ID:Natolumin,项目名称:observium,代码行数:54,代码来源:printersupply.inc.php
示例5: print_p2pradio_table
function print_p2pradio_table($vars)
{
if ($vars['view'] == "graphs" || isset($vars['graph'])) {
$stripe_class = "table-striped-two";
} else {
$stripe_class = "table-striped";
}
echo generate_box_open();
echo '<table class="table table-hover ' . $stripe_class . ' table-condensed">';
print_p2pradio_table_header($vars);
$sql = generate_p2pradio_query($vars);
$radios = dbFetchRows($sql);
foreach ($radios as $radio) {
print_p2pradio_row($radio, $vars);
}
echo '</table>';
echo generate_box_close();
}
开发者ID:Natolumin,项目名称:observium,代码行数:18,代码来源:p2pradio.inc.php
示例6: device_by_id_cache
$device = device_by_id_cache($port['device_id']);
echo '<tr><td style="width: 1px;"></td>
<td style="width: 200px; overflow: hidden;"><i class="' . $config['entities']['device']['icon'] . '"></i> ' . generate_entity_link('device', $device) . '</td>
<td style="overflow: hidden;"><i class="' . $config['entities']['port']['icon'] . '"></i> ' . generate_entity_link('port', $port) . '
<small>' . $port['ifDescr'] . '</small></td>
</tr>';
}
echo '</table>' . PHP_EOL;
} else {
echo '<p class="text-center text-warning bg-warning" style="padding: 10px; margin: 0px;"><strong>This user currently has no permitted ports</strong></p>';
//print_warning('This user currently has no permitted ports');
}
echo generate_box_close();
// End port permissions
// Start sensor permissions
echo generate_box_open(array('header-border' => TRUE, 'title' => 'Sensor Permissions'));
if (count($user_permissions['sensor'])) {
echo '<table class="' . OBS_CLASS_TABLE . '">' . PHP_EOL;
foreach (array_keys($user_permissions['sensor']) as $entity_id) {
$sensor = get_entity_by_id_cache('sensor', $entity_id);
$device = device_by_id_cache($sensor['device_id']);
echo '<tr><td style="width: 1px;"></td>
<td style="width: 200px; overflow: hidden;"><i class="' . $config['entities']['device']['icon'] . '"></i> ' . generate_entity_link('device', $device) . '</td>
<td style="overflow: hidden;"><i class="' . $config['entities']['sensor']['icon'] . '"></i> ' . generate_entity_link('sensor', $sensor) . '
<td width="25">
</tr>';
}
echo '</table>' . PHP_EOL;
} else {
echo '<p class="text-center text-warning bg-warning" style="padding: 10px; margin: 0px;"><strong>This user currently has no permitted sensors</strong></p>';
//print_warning('This user currently has no permitted sensors');
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:general.inc.php
示例7: register_html_title
* @author Adam Armstrong <[email protected]>
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
register_html_title("Poller/Discovery Timing");
$rrd_file = $config['rrd_dir'] . '/poller-wrapper.rrd';
if (is_file($rrd_file) && $_SESSION['userlevel'] >= 7) {
echo generate_box_open(array('header-border' => TRUE, 'title' => 'Poller Wrapper History'));
$graph_array = array('type' => 'poller_wrapper_threads', 'width' => 1158, 'height' => 100, 'from' => $config['time']['week'], 'to' => $config['time']['now']);
echo generate_graph_tag($graph_array);
//echo "<h3>Poller wrapper Total time</h3>";
$graph_array = array('type' => 'poller_wrapper_times', 'width' => 1158, 'height' => 100, 'from' => $config['time']['week'], 'to' => $config['time']['now']);
echo generate_graph_tag($graph_array);
echo generate_box_close(array('footer_content' => '<b>Please note:</b> The total time for the poller wrapper is not the same as the timings below. Total poller wrapper time is real polling time for all devices and all threads.'));
}
echo generate_box_open(array('header-border' => TRUE, 'title' => 'Poller/Discovery Timing'));
echo '<table class="' . OBS_CLASS_TABLE_STRIPED_MORE . '">' . PHP_EOL;
?>
<thead>
<tr>
<th class="state-marker"></th>
<th>Device</th>
<th colspan="3">Last Polled</th>
<th></th>
<th colspan="3">Last Discovered</th>
<th></th>
</tr>
</thead>
<tbody>
<?php
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:pollerlog.inc.php
示例8: array
<?php
$form = array('type' => 'horizontal', 'id' => 'logalert_rule', 'title' => 'New Syslog Rule Details', 'icon' => 'oicon-gear');
$form['row'][1]['name'] = array('type' => 'text', 'name' => 'Rule Name', 'placeholder' => TRUE, 'width' => '250px', 'value' => $vars['name']);
$form['row'][2]['descr'] = array('type' => 'textarea', 'name' => 'Message', 'placeholder' => TRUE, 'class' => 'col-md-11 col-xs-11', 'rows' => 4, 'value' => $vars['descr']);
$form['row'][3]['regex'] = array('type' => 'textarea', 'name' => 'Regular Expression', 'placeholder' => TRUE, 'class' => 'col-md-11 col-xs-11', 'rows' => 4, 'value' => $vars['regex']);
$form['row'][7]['submit'] = array('type' => 'submit', 'name' => 'Add Rule', 'icon' => 'icon-plus icon-white', 'class' => 'btn-success', 'value' => 'add_alertlog_rule');
print_form($form);
unset($form);
?>
</div>
<div class="col-md-4">
<?php
$box_args = array('title' => 'Syslog Regular Expressions', 'header-border' => TRUE, 'padding' => TRUE);
echo generate_box_open($box_args);
echo <<<SYSLOG_RULES
<p><strong>Syslog Rules</strong> are built using standard PCRE regular expressions.</p>
<p>There are many online resources to help you learn and test regular expressions.
Good resources include <a href="https://regex101.com/">regex101.com</a>,
<a href="https://www.debuggex.com/cheatsheet/regex/pcre">Debuggex Cheatsheet</a>,
<a href="http://regexr.com/">regexr.com</a> and <a href="http://www.tutorialspoint.com/php/php_regular_expression.htm">Tutorials Point</a>.
There are many other sites with examples which can be found online.
<p>A simple rule to match the word "error" could look like:</p>
<code>/error/</code>
<p>A more complex rule to match SSH authentication failures from PAM for the users root or adama might look like:</p>
<code>/pam.+\\(sshd:auth\\).+failure.+user\\=(root|adama)/</code>
SYSLOG_RULES;
echo generate_box_close();
?>
开发者ID:Natolumin,项目名称:observium,代码行数:30,代码来源:add_syslog_rule.inc.php
示例9: dbFetchRows
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage webui
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
$cbqos_array = dbFetchRows('SELECT * FROM `ports_cbqos` WHERE `port_id` = ?', array($port['port_id']));
foreach ($cbqos_array as $cbqos) {
echo generate_box_open(array('title' => $cbqos['policy_name'] . ' / ' . $cbqos['object_name'] . ' (' . $cbqos['direction'] . ')'));
echo '<table class="table table-hover table-condensed table-striped">';
$graph_array['id'] = $cbqos['cbqos_id'];
echo '<tr><td>';
echo '<h3>Packets</h3>';
$graph_array['type'] = 'cbqos_pkts';
print_graph_row($graph_array);
echo '<h3>Bits</h3>';
$graph_array['type'] = 'cbqos_bits';
print_graph_row($graph_array);
echo '</td></tr>';
echo '</table>';
echo generate_box_close();
}
// EOF
开发者ID:Natolumin,项目名称:observium,代码行数:29,代码来源:cbqos.inc.php
示例10: print_addresses
//.........这里部分代码省略.........
//$query_netscaler_count = str_replace(array('vsvr_ip', '0.0.0.0'), array('vsvr_ipv6', '0:0:0:0:0:0:0:0'), $query_netscaler_count);
}
$entries = dbFetchRows($query_netscaler, $param_netscaler);
// Rewrite netscaler addresses
foreach ($entries as $entry) {
$ip_address = $address_type == 'ipv4' ? $entry['vsvr_ip'] : $entry['vsvr_' . $address_type];
$ip_network = $address_type == 'ipv4' ? $entry['vsvr_ip'] . '/32' : $entry['vsvr_' . $address_type] . '/128';
$ip_array[] = array('type' => 'netscaler_vsvr', 'device_id' => $entry['device_id'], 'hostname' => $entry['hostname'], 'vsvr_id' => $entry['vsvr_id'], 'vsvr_label' => $entry['vsvr_label'], 'ifAlias' => 'Netscaler: ' . $entry['vsvr_type'] . '/' . $entry['vsvr_entitytype'], $address_type . '_address' => $ip_address, $address_type . '_network' => $ip_network);
}
//print_message($query_netscaler_count);
$query = 'FROM `ip_addresses` AS A ';
$query .= 'LEFT JOIN `ports` AS I ON I.`port_id` = A.`port_id` ';
$query .= 'LEFT JOIN `devices` AS D ON I.`device_id` = D.`device_id` ';
$query .= 'LEFT JOIN `ip_networks` AS N ON N.`ip_network_id` = A.`ip_network_id` ';
$query .= $where . $query_port_permitted;
//$query_count = 'SELECT COUNT(`ip_address_id`) ' . $query;
$query = 'SELECT * ' . $query;
$query .= ' ORDER BY A.`ip_address`';
if ($ip_valid) {
$pagination = FALSE;
}
// Override by address type
$query = str_replace(array('ip_address', 'ip_network'), array($address_type . '_address', $address_type . '_network'), $query);
//$query_count = str_replace(array('ip_address', 'ip_network'), array($address_type.'_address', $address_type.'_network'), $query_count);
// Query addresses
$entries = dbFetchRows($query, $param);
$ip_array = array_merge($ip_array, $entries);
$ip_array = array_sort($ip_array, $address_type . '_address');
// Query address count
//if ($pagination) { $count = dbFetchCell($query_count, $param); }
if ($pagination) {
$count = count($ip_array);
$ip_array = array_slice($ip_array, $start, $pagesize);
}
$list = array('device' => FALSE);
if (!isset($vars['device']) || empty($vars['device']) || $vars['page'] == 'search') {
$list['device'] = TRUE;
}
$string = generate_box_open($vars['header']);
$string .= '<table class="' . OBS_CLASS_TABLE_STRIPED . '">' . PHP_EOL;
if (!$short) {
$string .= ' <thead>' . PHP_EOL;
$string .= ' <tr>' . PHP_EOL;
if ($list['device']) {
$string .= ' <th>Device</th>' . PHP_EOL;
}
$string .= ' <th>Interface</th>' . PHP_EOL;
$string .= ' <th>Address</th>' . PHP_EOL;
$string .= ' <th>Description</th>' . PHP_EOL;
$string .= ' </tr>' . PHP_EOL;
$string .= ' </thead>' . PHP_EOL;
}
$string .= ' <tbody>' . PHP_EOL;
foreach ($ip_array as $entry) {
$address_show = TRUE;
if ($ip_valid) {
// If address not in specified network, don't show entry.
if ($address_type === 'ipv4') {
$address_show = Net_IPv4::ipInNetwork($entry[$address_type . '_address'], $addr . '/' . $mask);
} else {
$address_show = Net_IPv6::isInNetmask($entry[$address_type . '_address'], $addr, $mask);
}
}
if ($address_show) {
list($prefix, $length) = explode('/', $entry[$address_type . '_network']);
if (port_permitted($entry['port_id']) || $entry['type'] == 'netscaler_vsvr') {
if ($entry['type'] == 'netscaler_vsvr') {
$entity_link = generate_entity_link($entry['type'], $entry);
} else {
humanize_port($entry);
if ($entry['ifInErrors_delta'] > 0 || $entry['ifOutErrors_delta'] > 0) {
$port_error = generate_port_link($entry, '<span class="label label-important">Errors</span>', 'port_errors');
}
$entity_link = generate_port_link($entry, $entry['port_label_short']) . ' ' . $port_error;
}
$device_link = generate_device_link($entry);
$string .= ' <tr>' . PHP_EOL;
if ($list['device']) {
$string .= ' <td class="entity" style="white-space: nowrap">' . $device_link . '</td>' . PHP_EOL;
}
$string .= ' <td class="entity">' . $entity_link . '</td>' . PHP_EOL;
if ($address_type === 'ipv6') {
$entry[$address_type . '_address'] = Net_IPv6::compress($entry[$address_type . '_address']);
}
$string .= ' <td>' . generate_popup_link('ip', $entry[$address_type . '_address'] . '/' . $length) . '</td>' . PHP_EOL;
$string .= ' <td>' . $entry['ifAlias'] . '</td>' . PHP_EOL;
$string .= ' </tr>' . PHP_EOL;
}
}
}
$string .= ' </tbody>' . PHP_EOL;
$string .= '</table>';
$string .= generate_box_close();
// Print pagination header
if ($pagination) {
$string = pagination($vars, $count) . $string . pagination($vars, $count);
}
// Print addresses
echo $string;
}
开发者ID:Natolumin,项目名称:observium,代码行数:101,代码来源:addresses.inc.php
示例11: print_alert_table
/**
* Display alert_table entries.
*
* @param array $vars
* @return none
*
*/
function print_alert_table($vars)
{
global $alert_rules;
global $config;
// This should be set outside, but do it here if it isn't
if (!is_array($alert_rules)) {
$alert_rules = cache_alert_rules();
}
/// WARN HERE
if (isset($vars['device']) && !isset($vars['device_id'])) {
$vars['device_id'] = $vars['device'];
}
if (isset($vars['entity']) && !isset($vars['entity_id'])) {
$vars['entity_id'] = $vars['entity'];
}
// Short? (no pagination, small out)
$short = isset($vars['short']) && $vars['short'];
list($query, $param, $query_count) = build_alert_table_query($vars);
// Fetch alerts
$count = dbFetchCell($query_count, $param);
$alerts = dbFetchRows($query, $param);
// Set which columns we're going to show.
// We hide the columns that have been given as search options via $vars
$list = array('device_id' => FALSE, 'entity_id' => FALSE, 'entity_type' => FALSE, 'alert_test_id' => FALSE);
foreach ($list as $argument => $nope) {
if (!isset($vars[$argument]) || empty($vars[$argument]) || $vars[$argument] == "all") {
$list[$argument] = TRUE;
}
}
if ($vars['format'] != "condensed") {
$list['checked'] = TRUE;
$list['changed'] = TRUE;
$list['alerted'] = TRUE;
}
if ($vars['short'] == TRUE) {
$list['checked'] = FALSE;
$list['alerted'] = FALSE;
}
// Hide device if we know entity_id
if (isset($vars['entity_id'])) {
$list['device_id'] = FALSE;
}
// Hide entity_type if we know the alert_test_id
if (isset($vars['alert_test_id']) || TRUE) {
$list['entity_type'] = FALSE;
}
// Hide entity types in favour of icons to save space
if ($vars['pagination'] && !$short) {
$pagination_html = pagination($vars, $count);
echo $pagination_html;
}
echo generate_box_open($vars['header']);
echo '<table class="table table-condensed table-striped table-hover">';
if ($vars['no_header'] == FALSE) {
echo '
<thead>
<tr>
<th class="state-marker"></th>
<th style="width: 1px;"></th>';
if ($list['device_id']) {
echo ' <th style="width: 15%">Device</th>';
}
if ($list['entity_type']) {
echo ' <th style="width: 10%">Type</th>';
}
if ($list['entity_id']) {
echo ' <th style="">Entity</th>';
}
if ($list['alert_test_id']) {
echo ' <th style="min-width: 15%;">Alert</th>';
}
echo '
<th style="width: 100px;">Status</th>';
if ($list['checked']) {
echo ' <th style="width: 95px;">Checked</th>';
}
if ($list['changed']) {
echo ' <th style="width: 95px;">Changed</th>';
}
if ($list['alerted']) {
echo ' <th style="width: 95px;">Alerted</th>';
}
echo ' <th style="width: 45px;"></th>
</tr>
</thead>';
}
echo '<tbody>' . PHP_EOL;
foreach ($alerts as $alert) {
// Process the alert entry, generating colours and classes from the data
humanize_alert_entry($alert);
// Get the entity array using the cache
$entity = get_entity_by_id_cache($alert['entity_type'], $alert['entity_id']);
// Get the device array using the cache
//.........这里部分代码省略.........
开发者ID:Natolumin,项目名称:observium,代码行数:101,代码来源:alert.inc.php
示例12: generate_graph_js_state
<?php
*/
/// End options navbar
echo generate_graph_js_state($graph_array);
echo generate_box_open();
echo generate_graph_tag($graph_array);
echo generate_box_close();
if (!empty($graph_return['descr'])) {
echo generate_box_open(array('title' => 'Description', 'padding' => TRUE));
echo $graph_return['descr'];
echo generate_box_close();
}
#print_vars($graph_return);
if (isset($vars['showcommand'])) {
echo generate_box_open(array('title' => 'Performance & Output', 'padding' => TRUE));
echo "RRDTool Output: " . $graph_return['output'] . "<br />\n RRDtool Runtime: " . number_format($graph_return['runtime'], 3) . "s |\n Total time: " . number_format($graph_return['total'], 3) . "s";
echo generate_box_close();
echo generate_box_open(array('title' => 'RRDTool Command', 'padding' => TRUE));
echo $graph_return['command'];
echo generate_box_close();
echo generate_box_open(array('title' => 'RRDTool Files Used', 'padding' => TRUE));
if (is_array($graph_return['rrds'])) {
foreach ($graph_return['rrds'] as $rrd) {
echo "{$rrd} <br />";
}
} else {
echo "No RRD information returned. This may be because the graph module doesn't yet return this data. <br />";
}
echo generate_box_close();
}
// EOF
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:graphs.inc.php
示例13: print_xml
/**
* Pretty print for xml string
*
* @param string $xml An xml string
* @param boolean $formatted Convert or not output to human formatted xml
*/
function print_xml($xml, $formatted = TRUE)
{
if ($formatted) {
$xml = format_xml($xml);
}
if (is_cli()) {
echo $xml;
} else {
echo generate_box_open(array('title' => 'Output', 'padding' => TRUE));
echo '
<pre class="prettyprint lang-xml small">' . escape_html($xml) . '</pre>
<span><em>NOTE: XML values are always escaped, that\'s why you can see this <mark>' . escape_html(escape_html('< > & " \'')) . '</mark> instead of this <mark>' . escape_html('< > & " \'') . '</mark>. <u>Leave them as is</u>.</em></span>
<script type="text/javascript">window.prettyPrint && prettyPrint();</script>' . PHP_EOL;
echo generate_box_close();
}
}
开发者ID:Natolumin,项目名称:observium,代码行数:22,代码来源:templates.inc.php
示例14: unset
unset($as);
unset($astext);
unset($asn);
}
$name = format_mac($acc['mac']);
if (!isset($vars['graph'])) {
$vars['graph'] = "bits";
}
$graph_type = "macaccounting_" . $vars['graph'];
if ($vars['subview'] == "minigraphs") {
if (!$asn) {
$asn = "No Session";
}
$graph_array = array('id' => $acc['ma_id'], 'type' => $graph_type, 'from' => $config['time']['twoday'], 'to' => $config['time']['now'], 'width' => '215', 'height' => '100');
echo '<div class="col-md-3">';
echo generate_box_open(array('title' => $name, 'header-border' => TRUE));
print_graph_popup($graph_array);
echo generate_box_close(array());
echo '</div>';
} else {
echo "\n <tr>\n <td width=20></td>\n <td width=200><bold>" . format_mac($acc['mac']) . "</bold></td>\n <td width=200>" . implode($ips, "<br />") . "</td>\n <td width=500>" . $name . " " . $arp_name . "</td>\n <td width=100>" . formatRates($acc['bytes_input_rate'] / 8) . "</td>\n <td width=100>" . formatRates($acc['bytes_output_rate'] / 8) . "</td>\n <td width=100>" . format_number($acc['pkts_input_rate'] / 8) . "pps</td>\n <td width=100>" . format_number($acc['pkts_output_rate'] / 8) . "pps</td>\n </tr>\n ";
$peer_info['astext'];
if ($vars['subview'] == "graphs") {
$graph_array['type'] = $graph_type;
$graph_array['id'] = $acc['ma_id'];
$graph_array['height'] = "100";
$graph_array['to'] = $config['time']['now'];
echo '<tr><td colspan="8">';
print_graph_row($graph_array);
echo "</td></tr>";
$i++;
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:macaccounting.inc.php
示例15: print_syslogs
/**
* Display syslog messages.
*
* Display pages with device syslog messages.
* Examples:
* print_syslogs() - display last 10 syslog messages from all devices
* print_syslogs(array('pagesize' => 99)) - display last 99 syslog messages from all device
* print_syslogs(array('pagesize' => 10, 'pageno' => 3, 'pagination' => TRUE)) - display 10 syslog messages from page 3 with pagination header
* print_syslogs(array('pagesize' => 10, 'device' = 4)) - display last 10 syslog messages for device_id 4
* print_syslogs(array('short' => TRUE)) - show small block with last syslog messages
*
* @param array $vars
* @return none
*
*/
function print_syslogs($vars)
{
// Short events? (no pagination, small out)
$short = isset($vars['short']) && $vars['short'];
// With pagination? (display page numbers in header)
$pagination = isset($vars['pagination']) && $vars['pagination'];
pagination($vars, 0, TRUE);
// Get default pagesize/pageno
$pageno = $vars['pageno'];
$pagesize = $vars['pagesize'];
$start = $pagesize * $pageno - $pagesize;
$priorities = $GLOBALS['config']['syslog']['priorities'];
$param = array();
$where = ' WHERE 1 ';
foreach ($vars as $var => $value) {
if ($value != '') {
$cond = array();
switch ($var) {
case 'device':
case 'device_id':
$where .= generate_query_values($value, 'device_id');
break;
case 'priority':
if (!is_array($value)) {
$value = explode(',', $value);
}
foreach ($value as $k => $v) {
// Rewrite priority strings to numbers
$value[$k] = priority_string_to_numeric($v);
}
// Do not break here, it's true!
// Do not break here, it's true!
case 'program':
$where .= generate_query_values($value, $var);
break;
case 'message':
$where .= generate_query_values($value, 'msg', '%LIKE%');
break;
case 'timestamp_from':
$where .= ' AND `timestamp` > ?';
$param[] = $value;
break;
case 'timestamp_to':
$where .= ' AND `timestamp` < ?';
$param[] = $value;
break;
}
}
}
// Show events only for permitted devices
$query_permitted = generate_query_permitted();
$query = 'FROM `syslog` ';
$query .= $where . $query_permitted;
$query_count = 'SELECT COUNT(*) ' . $query;
$query = 'SELECT * ' . $query;
$query .= ' ORDER BY `seq` DESC ';
$query .= "LIMIT {$start},{$pagesize}";
// Query syslog messages
$entries = dbFetchRows($query, $param);
// Query syslog count
if ($pagination && !$short) {
$count = dbFetchCell($query_count, $param);
} else {
$count = count($entries);
}
if (!$count) {
// There have been no entries returned. Print the warning.
print_warning('<h4>No syslog entries found!</h4>
Check that the syslog daemon and Observium configuration options are set correctly, that your devices are configured to send syslog to Observium and that there are no firewalls blocking the messages.
See <a href="' . OBSERVIUM_URL . '/wiki/Category:Documentation" target="_blank">documentation</a> and <a href="' . OBSERVIUM_URL . '/wiki/Configuration_Options#Syslog_Settings" target="_blank">configuration options</a> for more information.');
} else {
// Entries have been returned. Print the table.
$list = array('device' => FALSE, 'priority' => TRUE);
// For now (temporarily) priority always displayed
if (!isset($vars['device']) || empty($vars['device']) || $vars['page'] == 'syslog') {
$list['device'] = TRUE;
}
if ($short || !isset($vars['priority']) || empty($vars['priority'])) {
$list['priority'] = TRUE;
}
$string = generate_box_open($vars['header']);
$string .= '<table class="' . OBS_CLASS_TABLE_STRIPED_MORE . '">' . PHP_EOL;
if (!$short) {
$string .= ' <thead>' . PHP_EOL;
//.........这里部分代码省略.........
开发者ID:Natolumin,项目名称:observium,代码行数:101,代码来源:syslogs.inc.php
示例16: generate_entity_popup_header
function generate_entity_popup_header($entity, $vars)
{
$translate = entity_type_translate_array($vars['entity_type']);
$vars['popup'] = TRUE;
$vars['entity_icon'] = TRUE;
switch ($vars['entity_type']) {
case "sensor":
$contents .= generate_box_open();
$contents .= '<table class="' . OBS_CLASS_TABLE . '">';
$contents .= generate_sensor_row($entity, $vars);
$contents .= '</table>';
$contents .= generate_box_close();
break;
case "toner":
$contents .= generate_box_open();
$contents .= '<table class="' . OBS_CLASS_TABLE . '">';
$contents .= generate_toner_row($entity, $vars);
$contents .= '</table>';
$contents .= generate_box_close();
break;
case "bgp_peer":
if ($entity['peer_device_id']) {
$peer_dev = device_by_id_cache($entity['peer_device_id']);
$peer_name = '<br /><a class="entity" style="font-weight: bold;">' . $peer_dev['hostname'] . '</a>';
} else {
if ($entity['reverse_dns']) {
$peer_name = '<br /><span style="font-weight: bold;">' . $entity['reverse_dns'] . '</span>';
}
}
$astext = '<span>AS' . $entity['bgpPeerRemoteAs'];
if ($entity['astext']) {
$astext .= '<br />' . $entity['astext'] . '</span>';
}
$astext .= '</span>';
$contents .= generate_box_open();
$contents .= '
<table class="' . OBS_CLASS_TABLE . '">
<tr class="' . $entity['row_class'] . ' vertical-align" style="font-size: 10pt;">
<td class="state-marker"></td>
<td style="width: 10px;"></td>
<td style="width: 10px;"><i class="' . $translate['icon'] . '"></i></td>
<td><a class="entity-popup" style="font-size: 15px; font-weight: bold;">' . $entity['entity_shortname'] . '</a>' . $peer_name . '</td>
<td class="text-nowrap" style="width: 20%;">' . $astext . '</td>
<td></td>
</tr>
</table>';
$contents .= generate_box_close();
break;
case "sla":
$contents .= generate_box_open();
$contents .= '<table class="' . OBS_CLASS_TABLE . '">';
$contents .= generate_sla_row($entity, $vars);
$contents .= '</table>';
$contents .= generate_box_close();
break;
case "processor":
$contents .= generate_box_open();
$contents .= '<table class="' . OBS_CLASS_TABLE . '">';
$contents .= generate_processor_row($entity, $vars);
$contents .= '</table>';
$contents .= generate_box_close();
break;
case "mempool":
$contents .= generate_box_open();
$contents .= '<table class="' . OBS_CLASS_TABLE . '">';
$contents .= generate_mempool_row($entity, $vars);
$contents .= '</table>';
$contents .= generate_box_close();
break;
case "p2pradio":
$contents .= generate_box_open();
$contents .= '<table class="' . OBS_CLASS_TABLE . '">';
$contents .= generate_p2pradio_row($entity, $vars);
$contents .= '</table>';
$contents .= generate_box_close();
break;
case "status":
$contents .= generate_box_open();
$contents .= '<table class="' . OBS_CLASS_TABLE . '">';
$contents .=
|
请发表评论