本文整理汇总了PHP中formatRates函数的典型用法代码示例。如果您正苦于以下问题:PHP formatRates函数的具体用法?PHP formatRates怎么用?PHP formatRates使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了formatRates函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: get_port_stats_by_port_hostname
function get_port_stats_by_port_hostname()
{
// This will return port stats based on a devices hostname and ifName
global $config;
$app = \Slim\Slim::getInstance();
$router = $app->router()->getCurrentRoute()->getParams();
$hostname = $router['hostname'];
$device_id = ctype_digit($hostname) ? $hostname : getidbyname($hostname);
$ifName = urldecode($router['ifname']);
$port = dbFetchRow('SELECT * FROM `ports` WHERE `device_id`=? AND `ifName`=?', array($device_id, $ifName));
$port['in_rate'] = formatRates($port['ifInOctets_rate'] * 8);
$port['out_rate'] = formatRates($port['ifOutOctets_rate'] * 8);
$port['in_perc'] = @round($port['in_rate'] / $port['ifSpeed'] * 100);
$port['out_perc'] = @round($port['in_rate'] / $port['ifSpeed'] * 100);
$port['in_pps'] = format_bi($port['ifInUcastPkts_rate']);
$port['out_pps'] = format_bi($port['ifOutUcastPkts_rate']);
$output = array('status' => 'ok', 'port' => $port);
$app->response->headers->set('Content-Type', 'application/json');
echo _json_encode($output);
}
开发者ID:awlx,项目名称:librenms,代码行数:20,代码来源:api_functions.inc.php
示例2: elseif
} elseif ($vars['view'] == "quick" || $vars['view'] == "accurate") {
echo "<h3>Billed Ports</h3>";
// Collected Earlier
foreach ($ports as $port) {
echo generate_port_link($port) . " on " . generate_device_link($port) . "<br />";
}
echo "<h3>Bill Summary</h3>";
if ($bill_data['bill_type'] == "quota") {
// The Customer is billed based on a pre-paid quota with overage in xB
echo "<h4>Quota Bill</h4>";
$percent = round($total_data / $bill_data['bill_quota'] * 100, 2);
$unit = "MB";
$total_data = round($total_data, 2);
echo "Billing Period from " . $fromtext . " to " . $totext;
echo "<br />Transferred " . format_bytes_billing($total_data) . " of " . format_bytes_billing($bill_data['bill_quota']) . " (" . $percent . "%)";
echo "<br />Average rate " . formatRates($rate_average);
$background = get_percentage_colours($percent);
echo "<p>" . print_percentage_bar(350, 20, $perc, NULL, "ffffff", $background['left'], $percent . "%", "ffffff", $background['right']) . "</p>";
$type = "&ave=yes";
} elseif ($bill_data['bill_type'] == "cdr") {
// The customer is billed based on a CDR with 95th%ile overage
echo "<h4>CDR / 95th Bill</h4>";
$unit = "kbps";
$cdr = $bill_data['bill_cdr'];
$rate_95th = round($rate_95th, 2);
$percent = round($rate_95th / $cdr * 100, 2);
$type = "&95th=yes";
echo "<strong>" . $fromtext . " to " . $totext . "</strong>\n <br />Measured " . format_si($rate_95th) . "bps of " . format_si($cdr) . "bps (" . $percent . "%) @ 95th %ile";
$background = get_percentage_colours($percent);
echo "<p>" . print_percentage_bar(350, 20, $percent, NULL, "ffffff", $background['left'], $percent . "%", "ffffff", $background['right']) . "</p>";
# echo("<p>Billing Period : " . $fromtext . " to " . $totext . "<br />
开发者ID:CumulusNetworks,项目名称:cldemo-archive,代码行数:31,代码来源:bill.inc.php
示例3: listBillPorts
function listBillPorts($bill_id)
{
$res = "";
$res .= "<table>";
$res .= " <tr>";
$res .= " <th>Device</th>";
$res .= " <th>Hardeware</th>";
$res .= " <th>Interface/Port</th>";
$res .= " <th>Speed</th>";
//$res .= " <th>Description</th>";
//$res .= " <th>Notes</th>";
$res .= " </tr>";
foreach (dbFetchRows("SELECT * FROM `bill_ports` as b, `ports` as p, `devices` as d WHERE b.bill_id = ? AND p.port_id = b.port_id AND d.device_id = p.device_id", array($bill_id)) as $row) {
if (bill_permitted($bill_id)) {
$device['name'] = $row['sysName'];
//$device['port'] = $row['ifName']." (".$row['ifDescr'].")";
$device['port'] = $row['ifName'];
$device['speed'] = formatRates($row['ifSpeed']);
$device['hw'] = $row['hardware'];
$device['descr'] = $row['port_descr_descr'];
$device['notes'] = $row['port_descr_notres'];
$res .= " <tr>";
$res .= " <td>" . $device['name'] . "</td>";
$res .= " <td>" . $device['hw'] . "</td>";
$res .= " <td>" . $device['port'] . "</td>";
$res .= " <td>" . $device['speed'] . "</td>";
//$res .= " <td>".$device['descr']."</td>";
//$res .= " <td>".$device['notes']."</td>";
$res .= " </tr>";
}
}
$res .= "</table>";
return $res;
}
开发者ID:CumulusNetworks,项目名称:cldemo-archive,代码行数:34,代码来源:pdf_history.inc.php
示例4: dbFetchCell
// Hide tooltip for empty
echo '<br /><span data-rel="' . $rel . '" class="small ' . $class . '" data-tooltip="<strong class=\'small ' . $class . '\'>' . $port['ifVlan'] . ' [' . $vlan_name . ']</strong>">VLAN ' . $port['ifVlan'] . '</span>';
} else {
if ($port['ifVrf']) {
$vrf_name = dbFetchCell("SELECT `vrf_name` FROM `vrfs` WHERE `vrf_id` = ?", array($port['ifVrf']));
echo '<span class="small text-warning" data-rel="tooltip" data-tooltip="VRF">' . $vrf_name . '</span>';
}
}
}
if ($port_adsl['adslLineCoding']) {
echo "</td><td style='width: 150px;'>";
echo $port_adsl['adslLineCoding'] . "/" . rewrite_adslLineType($port_adsl['adslLineType']);
echo "<br />";
echo "Sync:" . formatRates($port_adsl['adslAtucChanCurrTxRate']) . "/" . formatRates($port_adsl['adslAturChanCurrTxRate']);
echo "<br />";
echo "Max:" . formatRates($port_adsl['adslAtucCurrAttainableRate']) . "/" . formatRates($port_adsl['adslAturCurrAttainableRate']);
echo "</td><td style='width: 150px;'>";
echo "Atten:" . $port_adsl['adslAtucCurrAtn'] . "dB/" . $port_adsl['adslAturCurrAtn'] . "dB";
echo "<br />";
echo "SNR:" . $port_adsl['adslAtucCurrSnrMgn'] . "dB/" . $port_adsl['adslAturCurrSnrMgn'] . "dB";
} else {
echo "</td><td style='width: 150px;'>";
if ($port['ifType'] && $port['ifType'] != "") {
echo "<span class=small>" . $port['human_type'] . "</span>";
} else {
echo "-";
}
echo "<br />";
if ($ifHardType && $ifHardType != "") {
echo "<span class=small>" . $ifHardType . "</span>";
} else {
开发者ID:skive,项目名称:observium,代码行数:31,代码来源:print-interface.inc.php
示例5: formatRates
echo "</span>";
$width = "120";
$height = "40";
$from = $config['time']['day'];
echo "</td><td width=135>";
echo formatRates($port['ifInOctets_rate'] * 8) . " <img class='optionicon' src='images/icons/arrow_updown.png' /> " . formatRates($port['ifOutOctets_rate'] * 8);
echo "<br />";
$port['graph_type'] = "port_bits";
echo generate_port_link($port, "<img src='graph.php?type=" . $port['graph_type'] . "&id=" . $port['port_id'] . "&from=" . $from . "&to=" . $config['time']['now'] . "&width=" . $width . "&height=" . $height . "&legend=no&bg=" . str_replace("#", "", $row_colour) . "'>", $port['graph_type']);
echo "</td><td width=135>";
echo "" . formatRates($port['adslAturChanCurrTxRate']) . "/" . formatRates($port['adslAtucChanCurrTxRate']);
echo "<br />";
$port['graph_type'] = "port_adsl_speed";
echo generate_port_link($port, "<img src='graph.php?type=" . $port['graph_type'] . "&id=" . $port['port_id'] . "&from=" . $from . "&to=" . $config['time']['now'] . "&width=" . $width . "&height=" . $height . "&legend=no&bg=" . str_replace("#", "", $row_colour) . "'>", $port['graph_type']);
echo "</td><td width=135>";
echo "" . formatRates($port['adslAturCurrAttainableRate']) . "/" . formatRates($port['adslAtucCurrAttainableRate']);
echo "<br />";
$port['graph_type'] = "port_adsl_attainable";
echo generate_port_link($port, "<img src='graph.php?type=" . $port['graph_type'] . "&id=" . $port['port_id'] . "&from=" . $from . "&to=" . $config['time']['now'] . "&width=" . $width . "&height=" . $height . "&legend=no&bg=" . str_replace("#", "", $row_colour) . "'>", $port['graph_type']);
echo "</td><td width=135>";
echo "" . $port['adslAturCurrAtn'] . "dB/" . $port['adslAtucCurrAtn'] . "dB";
echo "<br />";
$port['graph_type'] = "port_adsl_attenuation";
echo generate_port_link($port, "<img src='graph.php?type=" . $port['graph_type'] . "&id=" . $port['port_id'] . "&from=" . $from . "&to=" . $config['time']['now'] . "&width=" . $width . "&height=" . $height . "&legend=no&bg=" . str_replace("#", "", $row_colour) . "'>", $port['graph_type']);
echo "</td><td width=135>";
echo "" . $port['adslAturCurrSnrMgn'] . "dB/" . $port['adslAtucCurrSnrMgn'] . "dB";
echo "<br />";
$port['graph_type'] = "port_adsl_snr";
echo generate_port_link($port, "<img src='graph.php?type=" . $port['graph_type'] . "&id=" . $port['port_id'] . "&from=" . $from . "&to=" . $config['time']['now'] . "&width=" . $width . "&height=" . $height . "&legend=no&bg=" . str_replace("#", "", $row_colour) . "'>", $port['graph_type']);
echo "</td><td width=135>";
echo "" . $port['adslAturCurrOutputPwr'] . "dBm/" . $port['adslAtucCurrOutputPwr'] . "dBm";
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:31,代码来源:print-interface-adsl.inc.php
示例6: generate_box_close
}
echo '</tr></table>';
$graph_array = $vars;
$graph_array['height'] = "300";
$graph_array['width'] = $graph_width;
echo generate_box_close();
$form = array('type' => 'rows', 'space' => '5px', 'submit_by_key' => TRUE, 'url' => 'graphs' . generate_url($vars));
// Datetime Field
$form['row'][0]['timestamp'] = array('type' => 'datetime', 'grid' => 10, 'grid_xs' => 10, 'presets' => TRUE, 'min' => '2007-04-03 16:06:59', 'max' => date('Y-m-d 23:59:59'), 'from' => date('Y-m-d H:i:s', $vars['from']), 'to' => date('Y-m-d H:i:s', $vars['to']));
$search_grid = 2;
if ($type == "port") {
if ($subtype == "bits") {
$speed_list = array('auto' => 'Autoscale', 'speed' => 'Interface Speed (' . formatRates($port['ifSpeed'], 4, 4) . ')');
foreach ($config['graphs']['ports_scale_list'] as $entry) {
$speed = intval(unit_string_to_numeric($entry, 1000));
$speed_list[$entry] = formatRates($speed, 4, 4);
}
$form['row'][0]['scale'] = array('type' => 'select', 'name' => 'Scale', 'grid' => 2, 'width' => '100%', 'value' => isset($vars['scale']) ? $vars['scale'] : $config['graphs']['ports_scale_default'], 'values' => $speed_list);
//reduce timestamp element grid sizes
$form['row'][0]['timestamp']['grid'] -= 2;
}
if (in_array($subtype, array('bits', 'percent', 'upkts', 'pktsize'))) {
$form['row'][0]['style'] = array('type' => 'select', 'name' => 'Graph style', 'grid' => 2, 'width' => '100%', 'value' => isset($vars['style']) ? $vars['style'] : $config['graphs']['style'], 'values' => array('default' => 'Default', 'mrtg' => 'MRTG'));
//reduce timestamp element grid sizes
$form['row'][0]['timestamp']['grid'] -= 1;
unset($form['row'][0]['timestamp']['grid_xs']);
$search_grid = 1;
}
}
// Update button
$form['row'][0]['update'] = array('type' => 'submit', 'grid' => $search_grid, 'grid_xs' => $search_grid > 1 ? $search_grid : 12, 'right' => TRUE);
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:graphs.inc.php
示例7: foreach
foreach (dbFetchRows("SELECT * FROM `bill_history` WHERE `bill_id` = ? ORDER BY `bill_datefrom` DESC LIMIT 24", array($bill_id)) as $history) {
if (bill_permitted($history['bill_id'])) {
unset($class);
$datefrom = $history['bill_datefrom'];
$dateto = $history['bill_dateto'];
$type = $history['bill_type'];
$percent = $history['bill_percent'];
$dir_95th = $history['dir_95th'];
$rate_95th = formatRates($history['rate_95th']);
$total_data = format_number($history['traf_total'], $config['billing']['base']);
if ($type == "CDR") {
$allowed = formatRates($history['bill_allowed']);
$used = formatRates($history['rate_95th']);
$in = formatRates($history['rate_95th_in']);
$out = formatRates($history['rate_95th_out']);
$overuse = $history['bill_overuse'] <= 0 ? "<span class=\"badge badge-success\">-</span>" : "<span class=\"badge badge-important\">" . formatRates($history['bill_overuse']) . "</span>";
$label = "inverse";
} elseif ($type == "Quota") {
$allowed = format_number($history['bill_allowed'], $config['billing']['base']);
$used = format_number($history['total_data'], $config['billing']['base']);
$in = format_number($history['traf_in'], $config['billing']['base']);
$out = format_number($history['traf_out'], $config['billing']['base']);
$overuse = $history['bill_overuse'] <= 0 ? "<span class=\"badge badge-success\">-</span>" : "<span class=\"badge badge-imprtant\">" . format_number($history['bill_overuse'], $config['billing']['base']) . "B</span>";
$label = "info";
}
$total_data = $type == "Quota" ? "<span class=\"badge badge-warning\"><strong>" . $total_data . "</strong></span>" : "<span class=\"badge\">" . $total_data . "</span>";
$rate_95th = $type == "CDR" ? "<span class=\"badge badge-warning\"><strong>" . $rate_95th . "</strong></span>" : "<span class=\"badge\">" . $rate_95th . "</span>";
switch (true) {
case $percent >= 90:
$perc['BG'] = "danger";
break;
开发者ID:RomanBogachev,项目名称:observium,代码行数:31,代码来源:history.inc.php
示例8: generateiflink
echo "</td><td width=100>";
if ($port_details) {
$interface['graph_type'] = "port_bits";
echo generateiflink($interface, "<img src='graph.php?type=port_bits&port=" . $interface['interface_id'] . "&from=" . $day . "&to=" . $now . "&width=100&height=20&legend=no&bg=" . str_replace("#", "", $row_colour) . "'>", $interface['graph_type']);
$interface['graph_type'] = "port_upkts";
echo generateiflink($interface, "<img src='graph.php?type=port_upkts&port=" . $interface['interface_id'] . "&from=" . $day . "&to=" . $now . "&width=100&height=20&legend=no&bg=" . str_replace("#", "", $row_colour) . "'>", $interface['graph_type']);
$interface['graph_type'] = "port_errors";
echo generateiflink($interface, "<img src='graph.php?type=port_errors&port=" . $interface['interface_id'] . "&from=" . $day . "&to=" . $now . "&width=100&height=20&legend=no&bg=" . str_replace("#", "", $row_colour) . "'>", $interface['graph_type']);
}
echo "</td><td width=120>";
if ($interface['ifOperStatus'] == "up") {
$interface['in_rate'] = $interface['ifInOctets_rate'] * 8;
$interface['out_rate'] = $interface['ifOutOctets_rate'] * 8;
$in_perc = @round($interface['in_rate'] / $interface['ifSpeed'] * 100);
$out_perc = @round($interface['in_rate'] / $interface['ifSpeed'] * 100);
echo "<img src='images/16/arrow_left.png' align=absmiddle> <span style='color: " . percent_colour($in_perc) . "'>" . formatRates($interface['in_rate']) . "<br />\n <img align=absmiddle src='images/16/arrow_out.png'> <span style='color: " . percent_colour($out_perc) . "'>" . formatRates($interface['out_rate']) . "<br />\n <img src='images/icons/arrow_pps_in.png' align=absmiddle> " . format_bi($interface['ifInUcastPkts_rate']) . "pps</span><br />\n <img src='images/icons/arrow_pps_out.png' align=absmiddle> " . format_bi($interface['ifOutUcastPkts_rate']) . "pps</span>";
}
echo "</td><td width=75>";
if ($interface['ifSpeed'] && $interface['ifAlias'] != "") {
echo "<span class=box-desc>" . humanspeed($interface['ifSpeed']) . "</span>";
}
echo "<br />";
# if($interface[ifDuplex] != unknown) { echo("<span class=box-desc>Duplex " . $interface['ifDuplex'] . "</span>"); } else { echo("-"); }
if ($device['os'] == "ios" || $device['os'] == "iosxe") {
if ($interface['ifTrunk']) {
echo "<span class=box-desc><span class=red>" . $interface['ifTrunk'] . "</span></span>";
} elseif ($interface['ifVlan']) {
echo "<span class=box-desc><span class=blue>VLAN " . $interface['ifVlan'] . "</span></span>";
} elseif ($interface['ifVrf']) {
$vrf = mysql_fetch_array(mysql_query("SELECT * FROM vrfs WHERE vrf_id = '" . $interface['ifVrf'] . "'"));
echo "<span style='color: green;'>" . $vrf['vrf_name'] . "</span>";
开发者ID:kyrisu,项目名称:observernms,代码行数:31,代码来源:print-interface.inc.php
示例9: unset
if (bill_permitted($history['bill_id'])) {
unset($class);
$datefrom = $history['bill_datefrom'];
$dateto = $history['bill_dateto'];
$type = $history['bill_type'];
$percent = $history['bill_percent'];
$dir_95th = $history['dir_95th'];
$rate_95th = formatRates($history['rate_95th']);
$total_data = format_number($history['traf_total'], $config['billing']['base']);
$background = get_percentage_colours($percent);
if ($type == 'CDR') {
$allowed = formatRates($history['bill_allowed']);
$used = formatRates($history['rate_95th']);
$in = formatRates($history['rate_95th_in']);
$out = formatRates($history['rate_95th_out']);
$overuse = $history['bill_overuse'] <= 0 ? '-' : '<span style="color: #' . $background['left'] . '; font-weight: bold;">' . formatRates($history['bill_overuse']) . '</span>';
} else {
if ($type == 'Quota') {
$allowed = format_number($history['bill_allowed'], $config['billing']['base']);
$used = format_number($history['total_data'], $config['billing']['base']);
$in = format_number($history['traf_in'], $config['billing']['base']);
$out = format_number($history['traf_out'], $config['billing']['base']);
$overuse = $history['bill_overuse'] <= 0 ? '-' : '<span style="color: #' . $background['left'] . '; font-weight: bold;">' . format_number($history['bill_overuse'], $config['billing']['base']) . 'B</span>';
}
}
$total_data = $type == 'Quota' ? '<b>' . $total_data . '</b>' : $total_data;
$rate_95th = $type == 'CDR' ? '<b>' . $rate_95th . '</b>' : $rate_95th;
$url = generate_url($vars, array('detail' => $history['bill_hist_id']));
echo '
<tr>
<td></td>
开发者ID:greggcz,项目名称:librenms,代码行数:31,代码来源:history.inc.php
示例10: formatRates
*
* @package observium
* @subpackage graphs
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
$defs = ' DEF:in_octets=' . $rrd_filename . ':INOCTETS:AVERAGE';
$defs .= ' DEF:out_octets=' . $rrd_filename . ':OUTOCTETS:AVERAGE';
$defs .= ' CDEF:in_bits=in_octets,8,*';
$defs .= ' CDEF:out_bits=out_octets,8,*';
$defs .= ' CDEF:in=in_bits,' . $port['ifSpeed'] . ',/,100,*';
$defs .= ' CDEF:out=out_bits,' . $port['ifSpeed'] . ',/,100,*';
$defs .= ' CDEF:in_max=in';
$defs .= ' CDEF:out_max=out';
$defs .= ' HRULE:100#555:';
$defs .= ' HRULE:-100#555:';
$colour_area_out = '3E629F';
$colour_line_out = '070A64';
$colour_area_in = '72B240';
$colour_line_in = '285B00';
#$colour_area_in_max = 'cc88cc';
#$colour_area_out_max = 'FFefaa';
$graph_max = 0;
$scale_max = '100';
$scale_min = '-100';
$unit_text = '% of ' . formatRates($port['ifSpeed'], 4, 4);
$args['nototal'] = 1;
$print_total = 0;
$nototal = 1;
include $config['html_dir'] . '/includes/graphs/generic_duplex.inc.php';
// EOF
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:percent.inc.php
示例11: humanspeed
function humanspeed($speed)
{
$speed = formatRates($speed);
if ($speed == "") {
$speed = "-";
}
return $speed;
}
开发者ID:kyrisu,项目名称:observernms_clean,代码行数:8,代码来源:functions.php
示例12: array
//if ($insert === FALSE) { print_error("Certain MEMORY DB error for table 'ports-state'."); }
//else { print_debug("STATE inserted port_id=".$port['port_id']); }
//unset($state_insert);
} else {
//$updated = dbUpdate($port['state'], 'ports-state', '`port_id` = ?', array($port['port_id']));
//print_debug("STATE updated rows=$updated");
}
}
// Add table row
$table_row = array();
$table_row[] = $port['ifIndex'];
$table_row[] = $port['port_label_short'];
$table_row[] = rewrite_iftype($port['ifType']);
$table_row[] = formatRates($port['ifSpeed']);
$table_row[] = formatRates($port['stats']['ifInBits_rate']);
$table_row[] = formatRates($port['stats']['ifOutBits_rate']);
$table_row[] = formatStorage($port['stats']['ifInOctets_diff']);
$table_row[] = formatStorage($port['stats']['ifOutOctets_diff']);
$table_row[] = format_si($port['stats']['ifInUcastPkts_rate']);
$table_row[] = format_si($port['stats']['ifOutUcastPkts_rate']);
$table_row[] = $port['port_64bit'] ? "%gY%w" : "%rN%w";
$table_rows[] = $table_row;
unset($table_row);
// End Update Database
} elseif ($port['disabled'] != "1") {
print_message("Port Deleted.");
// Port missing from SNMP cache.
if (isset($port['ifIndex']) && $port['deleted'] != "1") {
dbUpdate(array('deleted' => '1', 'ifLastChange' => date('Y-m-d H:i:s', $polled)), 'ports', '`device_id` = ? AND `ifIndex` = ?', array($device['device_id'], $port['ifIndex']));
log_event("Interface was marked as DELETED", $device, 'port', $port);
}
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:ports.inc.php
示例13: USING
$query = "SELECT `{$entry}` FROM `ports`";
$query .= " LEFT JOIN `devices` USING (`device_id`)";
if (isset($where_array[$entry])) {
$tmp = $where_array[$entry];
unset($where_array[$entry]);
$query .= ' WHERE 1 ' . implode('', $where_array);
$where_array[$entry] = $tmp;
} else {
$query .= $where;
}
$query .= " AND `{$entry}` != ''" . $cache['where']['ports_permitted'] . " GROUP BY `{$entry}` ORDER BY `{$entry}`";
foreach (dbFetchRows($query) as $data) {
if ($entry == "ifType") {
$form_items[$entry][$data['ifType']] = rewrite_iftype($data['ifType']) . ' (' . $data['ifType'] . ')';
} elseif ($entry == "ifSpeed") {
$form_items[$entry][$data[$entry]] = formatRates($data[$entry]);
} else {
$form_items[$entry][$data[$entry]] = nicecase($data[$entry]);
}
}
}
$form_items['devices'] = generate_form_values('device');
// Always all devices
asort($form_items['ifType']);
$form_items['sort'] = array('device' => 'Device', 'port' => 'Port', 'speed' => 'Speed', 'traffic' => 'Traffic In+Out', 'traffic_in' => 'Traffic In', 'traffic_out' => 'Traffic Out', 'traffic_perc' => 'Traffic Percentage In+Out', 'traffic_perc_in' => 'Traffic Percentage In', 'traffic_perc_out' => 'Traffic Percentage Out', 'packets' => 'Packets In+Out', 'packets_in' => 'Packets In', 'packets_out' => 'Packets Out', 'errors' => 'Errors', 'media' => 'Media', 'descr' => 'Description');
$form = array('type' => 'rows', 'space' => '10px', 'submit_by_key' => TRUE, 'url' => generate_url($vars));
// First row
$form['row'][0]['device_id'] = array('type' => 'multiselect', 'name' => 'Device', 'value' => $vars['device_id'], 'width' => '100%', 'values' => $form_items['devices']);
$form['row'][0]['ifDescr'] = array('type' => 'text', 'name' => 'Port Name', 'value' => $vars['ifDescr'], 'width' => '100%', 'placeholder' => TRUE);
$form['row'][0]['state'] = array('type' => 'multiselect', 'name' => 'Port State', 'width' => '100%', 'value' => $vars['state'], 'values' => array('up' => 'Up', 'down' => ' Down', 'admindown' => 'Admin Down'));
$form['row'][0]['ifType'] = array('type' => 'multiselect', 'name' => 'Port Media', 'width' => '100%', 'value' => $vars['ifType'], 'values' => $form_items['ifType']);
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:ports.inc.php
示例14: elseif
} elseif ($port['ifVlan']) {
echo '<p class=box-desc><span class=blue>VLAN ' . $port['ifVlan'] . '</span></p>';
} elseif ($port['ifVrf']) {
$vrf = dbFetchRow('SELECT * FROM vrfs WHERE vrf_id = ?', array($port['ifVrf']));
echo "<p style='color: green;'>" . $vrf['vrf_name'] . '</p>';
}
//end if
}
//end if
if ($port_adsl['adslLineCoding']) {
echo "</td><td width=150 onclick=\"location.href='" . generate_port_url($port) . "'\" >";
echo $port_adsl['adslLineCoding'] . '/' . rewrite_adslLineType($port_adsl['adslLineType']);
echo '<br />';
echo 'Sync:' . formatRates($port_adsl['adslAtucChanCurrTxRate']) . '/' . formatRates($port_adsl['adslAturChanCurrTxRate']);
echo '<br />';
echo 'Max:' . formatRates($port_adsl['adslAtucCurrAttainableRate']) . '/' . formatRates($port_adsl['adslAturCurrAttainableRate']);
echo "</td><td width=150 onclick=\"location.href='" . generate_port_url($port) . "'\" >";
echo 'Atten:' . $port_adsl['adslAtucCurrAtn'] . 'dB/' . $port_adsl['adslAturCurrAtn'] . 'dB';
echo '<br />';
echo 'SNR:' . $port_adsl['adslAtucCurrSnrMgn'] . 'dB/' . $port_adsl['adslAturCurrSnrMgn'] . 'dB';
} else {
echo "</td><td width=150 onclick=\"location.href='" . generate_port_url($port) . "'\" >";
if ($port['ifType'] && $port['ifType'] != '') {
echo '<span class=box-desc>' . fixiftype($port['ifType']) . '</span>';
} else {
echo '-';
}
echo '<br />';
if ($ifHardType && $ifHardType != '') {
echo '<span class=box-desc>' . $ifHardType . '</span>';
} else {
开发者ID:Tatermen,项目名称:librenms,代码行数:31,代码来源:print-interface.inc.php
示例15: generate_url
echo '>';
if ($vars['sort'] == $col['sort']) {
echo $col['head'] . ' *';
} else {
echo '<a href="' . generate_url($vars, array('sort' => $col['sort'])) . '">' . $col['head'] . '</a>';
}
echo "</th>";
}
echo " </tr></thead>";
$ports_disabled = 0;
$ports_down = 0;
$ports_up = 0;
$ports_total = 0;
foreach ($ports as $port) {
$device = device_by_id_cache($port['device_id']);
#&$GLOBALS['cache']['devices']['id'][$port['device_id']];
$ports_total++;
humanize_port($port);
if ($port['in_errors'] > 0 || $port['out_errors'] > 0) {
$error_img = generate_port_link($port, "<img src='images/16/chart_curve_error.png' alt='接口错误' border=0>", errors);
} else {
$error_img = "";
}
$port['bps_in'] = formatRates($port['ifInOctets_rate'] * 8);
$port['bps_out'] = formatRates($port['ifOutOctets_rate'] * 8);
$port['pps_in'] = format_si($port['ifInUcastPkts_rate']) . "pps";
$port['pps_out'] = format_si($port['ifOutUcastPkts_rate']) . "pps";
echo "<tr class='ports " . $port['row_class'] . "'>\n <td style='background-color: " . $port['table_tab_colour'] . ";'></td>\n <td></td>\n <td><span class=entity>" . generate_device_link($device, short_hostname($device['hostname'], "20")) . "</span><br />\n <span class=em>" . truncate($port['location'], 32, "") . "</span></td>\n\n <td><span class=entity>" . generate_port_link($port, rewrite_ifname($port['label'])) . " " . $error_img . "</span><br />\n <span class=em>" . truncate($port['ifAlias'], 50, '') . "</span></td>" . '<td> <i class="icon-circle-arrow-down" style="' . $port['bps_in_style'] . '"></i> <span class="small" style="' . $port['bps_in_style'] . '">' . formatRates($port['in_rate']) . '</span><br />' . '<i class="icon-circle-arrow-up" style="' . $port['bps_out_style'] . '"></i> <span class="small" style="' . $port['bps_out_style'] . '">' . formatRates($port['out_rate']) . '</span><br /></td>' . '<td> <i class="icon-circle-arrow-down" style="' . $port['bps_in_style'] . '"></i> <span class="small" style="' . $port['bps_in_style'] . '">' . $port['ifInOctets_perc'] . '%</span><br />' . '<i class="icon-circle-arrow-up" style="' . $port['bps_out_style'] . '"></i> <span class="small" style="' . $port['bps_out_style'] . '">' . $port['ifOutOctets_perc'] . '%</span><br /></td>' . '<td><i class="icon-circle-arrow-down" style="' . $port['pps_in_style'] . '"></i> <span class="small" style="' . $port['pps_in_style'] . '">' . format_bi($port['ifInUcastPkts_rate']) . 'pps</span><br />' . '<i class="icon-circle-arrow-up" style="' . $port['pps_out_style'] . '"></i> <span class="small" style="' . $port['pps_out_style'] . '">' . format_bi($port['ifOutUcastPkts_rate']) . 'pps</span></td>' . "<td>" . $port['human_speed'] . "<br />" . $port['ifMtu'] . "</td>\n <td >" . $port['human_type'] . "<br />" . $port['human_mac'] . "</td>\n </tr>\n";
}
echo '</td></tr></table>';
echo pagination($vars, count($ports));
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:31,代码来源:list.inc.php
示例16: round
// If we have a valid ifSpeed we should populate the stats for checking.
if (is_numeric($this_port['ifSpeed'])) {
$port['stats']['ifInBits_perc'] = round($port['stats']['ifInBits_rate'] / $this_port['ifSpeed'] * 100);
$port['stats']['ifOutBits_perc'] = round($port['stats']['ifOutBits_rate'] / $this_port['ifSpeed'] * 100);
}
echo 'bps(' . formatRates($port['stats']['ifInBits_rate']) . '/' . formatRates($port['stats']['ifOutBits_rate']) . ')';
echo 'bytes(' . formatStorage($port['stats']['ifInOctets_diff']) . '/' . formatStorage($port['stats']['ifOutOctets_diff']) . ')';
echo 'pkts(' . format_si($port['stats']['ifInUcastPkts_rate']) . 'pps/' . format_si($port['stats']['ifOutUcastPkts_rate']) . 'pps)';
// Port utilisation % threshold alerting. // FIXME allow setting threshold per-port. probably 90% of ports we don't care about.
if ($config['alerts']['port_util_alert'] && $port['ignore'] == '0') {
// Check for port saturation of $config['alerts']['port_util_perc'] or higher. Alert if we see this.
// Check both inbound and outbound rates
$saturation_threshold = $this_port['ifSpeed'] * ($config['alerts']['port_util_perc'] / 100);
echo 'IN: ' . $port['stats']['ifInBits_rate'] . ' OUT: ' . $port['stats']['ifOutBits_rate'] . ' THRESH: ' . $saturation_threshold;
if (($port['stats']['ifInBits_rate'] >= $saturation_threshold || $port['stats']['ifOutBits_rate'] >= $saturation_threshold) && $saturation_threshold > 0) {
log_event('Port reached saturation threshold: ' . formatRates($port['stats']['ifInBits_rate']) . '/' . formatRates($port['stats']['ifOutBits_rate']) . ' - ifspeed: ' . formatRates($this_port['stats']['ifSpeed']), $device, 'interface', $port['port_id']);
}
}
// Update RRDs
$rrdfile = $host_rrd . '/port-' . safename($port['ifIndex'] . '.rrd');
if (!is_file($rrdfile)) {
rrdtool_create($rrdfile, ' --step 300
DS:INOCTETS:DERIVE:600:0:12500000000
DS:OUTOCTETS:DERIVE:600:0:12500000000
DS:INERRORS:DERIVE:600:0:12500000000
DS:OUTERRORS:DERIVE:600:0:12500000000
DS:INUCASTPKTS:DERIVE:600:0:12500000000
DS:OUTUCASTPKTS:DERIVE:600:0:12500000000
DS:INNUCASTPKTS:DERIVE:600:0:12500000000
DS:OUTNUCASTPKTS:DERIVE:600:0:12500000000
DS:INDISCARDS:DERIVE:600:0:12500000000
开发者ID:MACscr,项目名称:librenms,代码行数:31,代码来源:ports.inc.php
示例17: foreach
foreach ($adsl_db_oids as $oid) {
$data = str_replace('"', '', $this_port[$oid]);
// FIXME - do we need this?
$port['adsl_update'][$oid] = $data;
}
dbUpdate($port['adsl_update'], 'ports_adsl', '`port_id` = ?', array($port_id));
if ($this_port['adslAtucCurrSnrMgn'] > '1280') {
$this_port['adslAtucCurrSnrMgn'] = 'U';
}
if ($this_port['adslAturCurrSnrMgn'] > '1280') {
$this_port['adslAturCurrSnrMgn'] = 'U';
}
$fields = array();
foreach ($adsl_oids as $oid) {
$oid = 'adsl' . $oid;
$data = str_replace('"', '', $this_port[$oid]);
// Set data to be "unknown" if it's garbled, unexistant or zero
if (!is_numeric($data)) {
$data = 'U';
}
$fields[$oid] = $data;
}
if (!is_file($rrdfile)) {
rrdtool_create($rrdfile, $rrd_create);
}
rrdtool_update($rrdfile, $fields);
$tags = array('ifName' => $port['ifName']);
influx_update($device, 'adsl', $tags, $fields);
echo 'ADSL (' . $this_port['adslLineCoding'] . '/' . formatRates($this_port['adslAtucChanCurrTxRate']) . '/' . formatRates($this_port['adslAturChanCurrTxRate']) . ')';
}
//end if
开发者ID:greggcz,项目名称:librenms,代码行数:31,代码来源:port-adsl.inc.php
示例18: format_si
echo 'pkts(' . format_si($port['stats']['ifInUcastPkts_rate']) . 'pps/' . format_si($port['stats']['ifOutUcastPkts_rate']) . 'pps)';
// Store aggregate in/out state
if ($config['memcached']['enable'] === true) {
$port['state']['ifOctets_rate'] = $port['stats']['ifOutOctets_rate'] + $port['stats']['ifInOctets_rate'];
$port['state']['ifUcastPkts_rate'] = $port['stats']['ifOutUcastPkts_rate'] + $port['stats']['ifInUcastPkts_rate'];
$port['state']['ifErrors_rate'] = $port['stats']['ifOutErrors_rate'] + $port['stats']['ifInErrors_rate'];
}
// Port utilisation % threshold alerting. // FIXME allow setting threshold per-port. probably 90% of ports we don't care about.
if ($config['alerts']['port_util_alert'] && $port['ignore'] == '0') {
// Check for port saturation of $config['alerts']['port_util_perc'] or higher. Alert if we see this.
// Check both inbound and outbound rates
$saturation_threshold = $this_port['ifSpeed'] * ($config['alerts']['port_util_perc'] / 100);
echo 'IN: ' . $port['stats']['ifInBits_rate'] . ' OUT: ' . $port['stats']['ifOutBits_rate'] . ' THRESH: ' . $saturation_threshold;
if (($port['stats']['ifInBits_rate'] >= $saturation_threshold || $port['stats']['ifOutBits_rate'] >= $saturation_threshold) && $saturation_threshold > 0) {
log_event('Port reached saturation threshold: ' . formatRates($port['stats']['ifInBits_rate']) . '/' . formatRates($port['stats']['ifOutBits_rate']) . ' - ifspeed: ' . formatRates($this_port['stats']['ifSpeed']), $device, 'interface', $port['port_id']);
notify($device, 'Port saturation threshold reached on ' . $device['hostname'], 'Port saturation threshold alarm: ' . $device['hostname'] . ' on ' . $port['ifDescr'] . "\nRates:" . formatRates($port['stats']['ifInBits_rate']) . '/' . formatRates($port['stats']['ifOutBits_rate']) . ' - ifspeed: ' . formatRates($this_port['ifSpeed']));
}
}
// Update RRDs
$rrdfile = $host_rrd . '/port-' . safename($port['ifIndex'] . '.rrd');
if (!is_file($rrdfile)) {
rrdtool_create($rrdfile, ' --step 300 \\
DS:INOCTETS:DERIVE:600:0:12500000000 \\
DS:OUTOCTETS:DERIVE:600:0:12500000000 \\
DS:INERRORS:DERIVE:600:0:12500000000 \\
DS:OUTERRORS:DERIVE:600:0:12500000000 \\
DS:INUCASTPKTS:DERIVE:600:0:12500000000 \\
DS:OUTUCASTPKTS:DERIVE:600:0:12500000000 \\
DS:INNUCASTPKTS:DERIVE:600:0:12500000000 \\
DS:OUTNUCASTPKTS:DERIVE:600:0:12500000000 \\
DS:INDISCARDS:DERIVE:600:0:12500000000 \\
开发者ID:rasssta,项目名称:librenms,代码行数:31,代码来源:ports.inc.php
-
unicodeveloper/laravel-hackathon-starter: A hackathon/MVP boilerplate for larave
阅读:1730|2022-08-12
-
solegalli/feature-selection-for-machine-learning: Code repository for the online
阅读:945|2022-08-18
-
win7系统电脑使用过程中有不少朋友表示遇到过win7系统重装系统初始设置的状况,当出现
阅读:874|2022-11-06
-
%分解%regexps='ab/c/d.png'file_name=regexp(s,'/','split');%'d.png'%splitfraction
阅读:580|2022-07-18
-
hchunhui/librime-lua: Extending RIME with Lua scripts
阅读:462|2022-08-16
-
Vulnerability of pointers being incorrectly used during data transmission in the
阅读:721|2022-07-29
-
tboronczyk/localization-middleware: PSR-15 middleware to assist primarily with l
阅读:518|2022-08-16
-
由于人们消费水平的提高,人们越来越多的追求美的享受,瓷砖美缝就是一种让瓷砖缝隙变
阅读:672|2022-11-06
-
md-5/Bukkit-MinecraftServer: Bukkit's tools to make our custom normalized mi
阅读:591|2022-08-17
-
jjg/agentalpha: Experimental mastodon bot
阅读:602|2022-08-18
|
请发表评论