本文整理汇总了PHP中format_si函数的典型用法代码示例。如果您正苦于以下问题:PHP format_si函数的具体用法?PHP format_si怎么用?PHP format_si使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了format_si函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: dbFetchRow
$check = dbFetchRow("SELECT * FROM `bill_history` WHERE bill_id = ? AND bill_datefrom = ? AND bill_dateto = ? LIMIT 1", array($bill['bill_id'], $datefrom, $dateto));
$period = getPeriod($bill['bill_id'], $datefrom, $dateto);
$date_updated = str_replace("-", "", str_replace(":", "", str_replace(" ", "", $check['updated'])));
if ($period > 0 && $dateto > $date_updated) {
$rate_data = getRates($bill['bill_id'], $datefrom, $dateto);
#print_vars($rate_data);
# $rate_95th = $rate_data['rate_95th'];
# $dir_95th = $rate_data['dir_95th'];
# $total_data = $rate_data['total_data'];
# $rate_average = $rate_data['rate_average'];
if ($bill['bill_type'] == "cdr") {
$type = "CDR";
$allowed = $bill['bill_cdr'];
$used = $rate_data['rate_95th'];
$allowed_text = format_si($allowed) . "bps";
$used_text = format_si($used) . "bps";
$overuse = $used - $allowed;
$overuse = $overuse <= 0 ? "0" : $overuse;
$percent = round($rate_data['rate_95th'] / $bill['bill_cdr'] * 100, 2);
} elseif ($bill['bill_type'] == "quota") {
$type = "Quota";
$allowed = $bill['bill_quota'];
$used = $rate_data['total_data'];
$allowed_text = format_bytes_billing($allowed);
$used_text = format_bytes_billing($used);
$overuse = $used - $allowed;
$overuse = $overuse <= 0 ? "0" : $overuse;
$percent = round($rate_data['total_data'] / $bill['bill_quota'] * 100, 2);
}
echo strftime("%x @ %X", strtotime($datefrom)) . " to " . strftime("%x @ %X", strtotime($dateto)) . " " . str_pad($type, 8) . " " . str_pad($allowed_text, 10) . " " . str_pad($used_text, 10) . " " . $percent . "%";
if ($i == '0') {
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:31,代码来源:billing-calculate.php
示例2: overlib
$afi = $afisafi['afi'];
$safi = $afisafi['safi'];
$this_afisafi = $afi . $safi;
$peer['afi'] .= $sep . $afi . "." . $safi;
$sep = "<br />";
$peer['afisafi'][$this_afisafi] = 1;
// Build a list of valid AFI/SAFI for this peer
}
$graph_type = "bgp_updates";
$peer_daily_url = "graph.php?id=" . $peer['bgpPeer_id'] . "&type=" . $graph_type . "&from=" . $config['time']['day'] . "&to=" . $config['time']['now'] . "&width=500&height=150";
$peeraddresslink = "<span class=entity-title><a onmouseover=\"return overlib('<img src=\\'{$peer_daily_url}\\'>', LEFT" . $config['overlib_defaults'] . ");\" onmouseout=\"return nd();\">" . $peer['human_remoteip'] . "</a></span>";
echo '<tr class="' . $peer['html_row_class'] . '">';
echo '
<td style="width: 1px; background-color: ' . $peer['table_tab_colour'] . '; margin: 0px; padding: 0px"></td>
<td style="width: 1px;"></td>';
echo " <td>" . $peeraddresslink . "<br />" . $peername . "</td>\n <td><strong>" . $peer['peer_type'] . "</strong></td>\n <td style='font-size: 10px; font-weight: bold; line-height: 10px;'>" . (isset($peer['afi']) ? $peer['afi'] : '') . "</td>\n <td><strong>AS" . $peer['bgpPeerRemoteAs'] . "</strong><br />" . $peer['astext'] . "</td>\n <td><strong><span class='" . $peer['admin_class'] . "'>" . $peer['bgpPeerAdminStatus'] . "</span><br /><span class='" . $peer['state_class'] . "'>" . $peer['bgpPeerState'] . "</span></strong></td>\n <td>" . formatUptime($peer['bgpPeerFsmEstablishedTime']) . "<br />\n Updates <i class='oicon-arrow_down'></i> " . format_si($peer['bgpPeerInUpdates']) . "\n <i class='oicon-arrow_up'></i> " . format_si($peer['bgpPeerOutUpdates']) . "</td>\n </tr>";
unset($invalid);
switch ($vars['view']) {
case 'prefixes_ipv4unicast':
case 'prefixes_ipv4multicast':
case 'prefixes_vpnv4unicast':
case 'prefixes_ipv6unicast':
case 'prefixes_ipv6multicast':
list(, $afisafi) = explode("_", $vars['view']);
if (isset($peer['afisafi'][$afisafi])) {
$peer['graph'] = 1;
}
// FIXME no break??
// FIXME no break??
case 'updates':
$graph_array['type'] = "bgp_" . $vars['view'];
开发者ID:skive,项目名称:observium,代码行数:31,代码来源:bgp.inc.php
示例3: foreach
foreach (dbFetchRows('SELECT * FROM `bgpPeers_cbgp` WHERE `device_id` = ? AND bgpPeerIdentifier = ?', array($peer['device_id'], $peer['bgpPeerIdentifier'])) as $afisafi) {
$afi = $afisafi['afi'];
$safi = $afisafi['safi'];
$this_afisafi = $afi . $safi;
$peer['afi'] .= $sep . $afi . '.' . $safi;
$sep = '<br />';
$peer['afisafi'][$this_afisafi] = 1;
// Build a list of valid AFI/SAFI for this peer
}
unset($sep);
echo ' <td></td>
<td width=150>' . $localaddresslink . '<br />' . generate_device_link($peer, shorthost($peer['hostname']), array('tab' => 'routing', 'proto' => 'bgp')) . '</td>
<td width=30><b>»</b></td>
<td width=150>' . $peeraddresslink . "</td>\n <td width=50><b>{$peer_type}</b></td>\n <td width=50>" . $peer['afi'] . '</td>
<td><strong>AS' . $peer['bgpPeerRemoteAs'] . '</strong><br />' . $peer['astext'] . "</td>\n <td><strong><span style='color: {$admin_col};'>" . $peer['bgpPeerAdminStatus'] . "</span><br /><span style='color: {$col};'>" . $peer['bgpPeerState'] . '</span></strong></td>
<td>' . formatUptime($peer['bgpPeerFsmEstablishedTime']) . "<br />\n Updates <img src='images/16/arrow_down.png' align=absmiddle /> " . format_si($peer['bgpPeerInUpdates']) . "\n <img src='images/16/arrow_up.png' align=absmiddle /> " . format_si($peer['bgpPeerOutUpdates']) . '</td></tr>';
unset($invalid);
switch ($vars['graph']) {
case 'prefixes_ipv4unicast':
case 'prefixes_ipv4multicast':
case 'prefixes_ipv4vpn':
case 'prefixes_ipv6unicast':
case 'prefixes_ipv6multicast':
list(, $afisafi) = explode('_', $vars['graph']);
if (isset($peer['afisafi'][$afisafi])) {
$peer['graph'] = 1;
}
case 'updates':
$graph_array['type'] = 'bgp_' . $vars['graph'];
$graph_array['id'] = $peer['bgpPeer_id'];
}
开发者ID:n-st,项目名称:librenms,代码行数:31,代码来源:bgp.inc.php
示例4: testFormatSi
/**
* @dataProvider providerFormatSi
*/
public function testFormatSi($value, $round, $sf, $result)
{
$this->assertSame($result, format_si($value, $round, $sf));
}
开发者ID:skive,项目名称:observium,代码行数:7,代码来源:IncludesCommonTest.php
示例5: dbFetchRow
$dateto = $day_data['1'];
$check = dbFetchRow('SELECT * FROM `bill_history` WHERE bill_id = ? AND bill_datefrom = ? AND bill_dateto = ? LIMIT 1', array($bill['bill_id'], $datefrom, $dateto));
$period = getPeriod($bill['bill_id'], $datefrom, $dateto);
$date_updated = str_replace('-', '', str_replace(':', '', str_replace(' ', '', $check['updated'])));
if ($period > 0 && $dateto > $date_updated) {
$rate_data = getRates($bill['bill_id'], $datefrom, $dateto);
$rate_95th = $rate_data['rate_95th'];
$dir_95th = $rate_data['dir_95th'];
$total_data = $rate_data['total_data'];
$rate_average = $rate_data['rate_average'];
if ($bill['bill_type'] == 'cdr') {
$type = 'CDR';
$allowed = $bill['bill_cdr'];
$used = $rate_data['rate_95th'];
$allowed_text = format_si($allowed) . 'bps';
$used_text = format_si($used) . 'bps';
$overuse = $used - $allowed;
$overuse = $overuse <= 0 ? '0' : $overuse;
$percent = round($rate_data['rate_95th'] / $bill['bill_cdr'] * 100, 2);
} else {
if ($bill['bill_type'] == 'quota') {
$type = 'Quota';
$allowed = $bill['bill_quota'];
$used = $rate_data['total_data'];
$allowed_text = format_bytes_billing($allowed);
$used_text = format_bytes_billing($used);
$overuse = $used - $allowed;
$overuse = $overuse <= 0 ? '0' : $overuse;
$percent = round($rate_data['total_data'] / $bill['bill_quota'] * 100, 2);
}
}
开发者ID:samyscoub,项目名称:librenms,代码行数:31,代码来源:billing-calculate.php
示例6: generate_url
if (is_integer($i / 2)) {
$bg_colour = $list_colour_a;
} else {
$bg_colour = $list_colour_b;
}
if ($vsvr['vsvr_state'] == 'up') {
$vsvr_class = 'green';
} else {
$vsvr_class = 'red';
}
echo "<tr bgcolor='{$bg_colour}'>";
echo '<td width=320 class=list-large><a href="' . generate_url($vars, array('vsvr' => $vsvr['vsvr_id'], 'view' => null, 'graph' => null)) . '">' . $vsvr['vsvr_name'] . '</a></td>';
echo '<td width=320 class=list-small>' . $vsvr['vsvr_ip'] . ':' . $vsvr['vsvr_port'] . '</a></td>';
echo "<td width=100 class=list-small><span class='" . $vsvr_class . "'>" . $vsvr['vsvr_state'] . '</span></td>';
echo '<td width=320 class=list-small>' . format_si($vsvr['vsvr_bps_in'] * 8) . 'bps</a></td>';
echo '<td width=320 class=list-small>' . format_si($vsvr['vsvr_bps_out'] * 8) . 'bps</a></td>';
echo '</tr>';
if ($vars['view'] == 'graphs') {
echo '<tr class="list-bold" bgcolor="' . $bg_colour . '">';
echo '<td colspan="5">';
$graph_type = 'netscalervsvr_' . $vars['graph'];
$graph_array['height'] = '100';
$graph_array['width'] = '213';
$graph_array['to'] = $config['time']['now'];
$graph_array['id'] = $vsvr['vsvr_id'];
$graph_array['type'] = $graph_type;
include 'includes/print-graphrow.inc.php';
echo '
</td>
</tr>';
}
开发者ID:awlx,项目名称:librenms,代码行数:31,代码来源:netscaler_vsvr.inc.php
示例7: file_put_contents
if ($config['debug_port'][$port['port_id']]) {
$port_debug = $port['port_id'] . '|' . $polled . '|' . $polled_period . '|' . $this_port['ifHCInOctets'] . '|' . $this_port['ifHCOutOctets'];
$port_debug .= '|' . $port['stats']['ifInOctets_rate'] . '|' . $port['stats']['ifOutOctets_rate'] . "\n";
file_put_contents('/tmp/port_debug.txt', $port_debug, FILE_APPEND);
echo 'Wrote port debugging data';
}
$port['stats']['ifInBits_rate'] = round($port['stats']['ifInOctets_rate'] * 8);
$port['stats']['ifOutBits_rate'] = round($port['stats']['ifOutOctets_rate'] * 8);
// 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
开发者ID:MACscr,项目名称:librenms,代码行数:31,代码来源:ports.inc.php
示例8: foreach
<?php
echo '<table cellspacing="0" cellpadding="5" width="100%">';
$i = 0;
foreach (dbFetchRows('SELECT * FROM `packages` WHERE `device_id` = ? ORDER BY `name`', array($device['device_id'])) as $entry) {
echo '<tr class="list">';
echo '<td width=200><a href="' . generate_url($vars, array('name' => $entry['name'])) . '">' . $entry['name'] . '</a></td>';
if ($build != '') {
$dbuild = '-' . $entry['build'];
} else {
$dbuild = '';
}
echo '<td>' . $entry['version'] . $dbuild . '</td>';
echo '<td>' . $entry['arch'] . '</td>';
echo '<td>' . $entry['manager'] . '</td>';
echo '<td>' . format_si($entry['size']) . '</td>';
echo '</tr>';
$i++;
}
echo '</table>';
开发者ID:sfromm,项目名称:librenms,代码行数:20,代码来源:packages.inc.php
示例9: array
$classes = array('primary', 'success', 'danger');
$legend = '<table class="table table-condensed-more">';
$i = 0;
foreach ($totals_array as $type => $dir) {
// derp we actually need whole #s here for the graph. muiltiply by 100, yo!
$percentIn = $dir["in"] / $totalIn * 100;
$percentOut = $dir["out"] / $totalOut * 100;
$percent = ($dir["in"] + $dir["out"]) / ($totalIn + $totalOut) * 100;
$color = $config['graph_colours']['mixed'][$i];
$class = $classes[$i];
$bars_in .= ' <div class="progress-bar progress-bar-' . $class . '" style="width: ' . $percentIn . '%"><span class="sr-only">' . round($percentIn) . '%' . '</span></div>';
$bars_out .= ' <div class="progress-bar progress-bar-' . $class . '" style="width: ' . $percentOut . '%"><span class="sr-only">' . round($percentOut) . '%' . '</span></div>';
$bars .= ' <div class="progress-bar progress-bar-' . $class . '" style="width: ' . $percent . '%"><span class="sr-only">' . round($percent) . '%' . '</span></div>';
$i++;
$legend .= '<tr><td><span class="label label-' . $class . '">' . $type . '</span></td><td><i class="icon-circle-arrow-down green"></i> <small><b>' . format_si($dir['in']) . 'bps</b></small></td>
<td><i class="icon-circle-arrow-up" style="color: #323b7c;"></i> <small><b>' . format_si($dir['out']) . 'bps</b></small></td>
</tr>';
}
$legend .= '</table>';
?>
<table class="table table-condensed">
<tr>
<td rowspan="3" width="220"><?php
echo $legend;
?>
</td>
<th width="40"><span class="label label-success"><i class="icon-circle-arrow-up"></i> In</span></th>
<td>
<div class="progress" style="margin-bottom: 0;">
<?php
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:status-portpercent.inc.php
示例10: format_si
break;
default:
echo $cef['cef_path'];
}
echo '</td>';
echo '<td>' . format_si($cef['drop']);
if ($cef['drop'] > $cef['drop_prev']) {
echo " <span style='color:red;'>(" . round(($cef['drop'] - $cef['drop_prev']) / $interval, 2) . '/sec)</span>';
}
echo '</td>';
echo '<td>' . format_si($cef['punt']);
if ($cef['punt'] > $cef['punt_prev']) {
echo " <span style='color:red;'>(" . round(($cef['punt'] - $cef['punt_prev']) / $interval, 2) . '/sec)</span>';
}
echo '</td>';
echo '<td>' . format_si($cef['punt2host']);
if ($cef['punt2host'] > $cef['punt2host_prev']) {
echo " <span style='color:red;'>(" . round(($cef['punt2host'] - $cef['punt2host_prev']) / $interval, 2) . '/sec)</span>';
}
echo '</td>';
echo '</tr>
';
if ($vars['view'] == 'graphs') {
$graph_array['height'] = '100';
$graph_array['width'] = '215';
$graph_array['to'] = $config['time']['now'];
$graph_array['id'] = $cef['cef_switching_id'];
$graph_array['type'] = 'cefswitching_graph';
echo "<tr bgcolor='{$bg_colour}'><td colspan=6>";
include 'includes/print-graphrow.inc.php';
echo '</td></tr>';
开发者ID:awlx,项目名称:librenms,代码行数:31,代码来源:cef.inc.php
示例11: format_si
break;
default:
echo $cef['cef_path'];
}
echo "</td>";
echo "<td>" . format_si($cef['drop']);
if ($cef['drop'] > $cef['drop_prev']) {
echo " <span style='color:red;'>(" . round(($cef['drop'] - $cef['drop_prev']) / $interval, 2) . "/sec)</span>";
}
echo "</td>";
echo "<td>" . format_si($cef['punt']);
if ($cef['punt'] > $cef['punt_prev']) {
echo " <span style='color:red;'>(" . round(($cef['punt'] - $cef['punt_prev']) / $interval, 2) . "/sec)</span>";
}
echo "</td>";
echo "<td>" . format_si($cef['punt2host']);
if ($cef['punt2host'] > $cef['punt2host_prev']) {
echo " <span style='color:red;'>(" . round(($cef['punt2host'] - $cef['punt2host_prev']) / $interval, 2) . "/sec)</span>";
}
echo "</td>";
echo "</tr>\n ";
if ($vars['view'] == "graphs") {
$graph_array['height'] = "100";
$graph_array['width'] = "215";
$graph_array['to'] = $config['time']['now'];
$graph_array['id'] = $cef['cef_switching_id'];
$graph_array['type'] = "cefswitching_graph";
echo "<tr bgcolor='{$bg_colour}'><td colspan=6>";
print_graph_row($graph_array);
echo "</td></tr>";
}
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:31,代码来源:cef.inc.php
示例12: generate_url
if (is_integer($i / 2)) {
$bg_colour = $list_colour_a;
} else {
$bg_colour = $list_colour_b;
}
if ($vsvr['vsvr_state'] == "up") {
$vsvr_class = "green";
} else {
$vsvr_class = "red";
}
echo "<tr bgcolor='{$bg_colour}'>";
echo '<td width=320 class=list-large><a href="' . generate_url($vars, array('vsvr' => $vsvr['vsvr_id'], 'view' => NULL, 'graph' => NULL)) . '">' . $vsvr['vsvr_name'] . '</a></td>';
echo "<td width=320 class=list-small>" . $vsvr['vsvr_ip'] . ":" . $vsvr['vsvr_port'] . "</a></td>";
echo "<td width=100 class=list-small><span class='" . $vsvr_class . "'>" . $vsvr['vsvr_state'] . "</span></td>";
echo "<td width=320 class=list-small>" . format_si($vsvr['vsvr_bps_in'] * 8) . "bps</a></td>";
echo "<td width=320 class=list-small>" . format_si($vsvr['vsvr_bps_out'] * 8) . "bps</a></td>";
echo "</tr>";
if ($vars['view'] == "graphs") {
echo '<tr class="list-bold" bgcolor="' . $bg_colour . '">';
echo '<td colspan="5">';
$graph_type = "netscalervsvr_" . $vars['graph'];
$graph_array['height'] = "100";
$graph_array['width'] = "213";
$graph_array['to'] = $config['time']['now'];
$graph_array['id'] = $vsvr['vsvr_id'];
$graph_array['type'] = $graph_type;
include "includes/print-graphrow.inc.php";
echo "\n </td>\n </tr>";
}
echo "</td>";
echo "</tr>";
开发者ID:REAP720801,项目名称:librenms,代码行数:31,代码来源:netscaler_vsvr.inc.php
示例13: foreach
<?php
/**
* Observium Network Management and Monitoring System
* Copyright (C) 2006-2014, Adam Armstrong - http://www.observium.org
*
* @package observium
* @subpackage webui
* @author Adam Armstrong <[email protected]>
* @copyright (C) 2006-2014 Adam Armstrong
*
*/
echo '<table class="table table-striped-two table-condensed table-bordered">';
echo "<thead><tr>\n <th>内存池</th>\n <th>MIB</th>\n <th>值</th>\n <th>上限</th>\n <th>下限</th>\n </tr></thead>";
$row = 1;
$sql = "SELECT *, `sensors`.`sensor_id` AS `sensor_id`";
$sql .= " FROM `sensors`";
$sql .= " LEFT JOIN `sensors-state` ON `sensors`.sensor_id = `sensors-state`.sensor_id";
$sql .= " WHERE `sensor_class` = ? AND `device_id` = ?";
foreach (dbFetchRows($sql, array($vars['metric'], $device['device_id'])) as $sensor) {
$graph_array['id'] = $sensor['sensor_id'];
$graph_array['type'] = 'sensor_' . $vars['metric'];
$sensor_url = "graphs/id=" . $sensor['sensor_id'] . "/type=" . $graph_array['type'];
echo "<tr>\n <td width=500 class='entity-title'><a class='entity-title' href='" . $sensor_url . "'>" . $sensor['sensor_descr'] . "</a></td>\n <td>" . nicecase($sensor['sensor_type']) . "</td>\n <td width=75>" . format_si($sensor['sensor_value']) . $config['sensor_types'][$vars['metric']]['symbol'] . "</td>\n <td width=75>" . format_si($sensor['sensor_limit']) . $config['sensor_types'][$vars['metric']]['symbol'] . "</td>\n <td width=75>" . format_si($sensor['sensor_limit_low']) . $config['sensor_types'][$vars['metric']]['symbol'] . "</td>\n </tr>\n";
echo "<tr><td colspan='5'>";
print_graph_row($graph_array);
echo "</td></tr>";
$row++;
}
echo "</table>";
// EOF
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:31,代码来源:sensors.inc.php
示例14: format_si
*
* @package observium
* @subpackage graphs
* @copyright (C) 2006-2014 Adam Armstrong
*
*/
$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_min = '-100';
$scale_max = '100';
$unit_text = '% of ' . format_si($port['ifSpeed']) . 'b';
$args['nototal'] = 1;
$print_total = 0;
$nototal = 1;
include 'includes/graphs/generic_duplex.inc.php';
// EOF
开发者ID:skive,项目名称:observium,代码行数:31,代码来源:percent.inc.php
示例15: generate_url
if ('`' . $lhead . '`' == $order) {
$icon = " class='fa fa-chevron-";
if ($by == 'asc') {
$bhead = 'desc';
$icon .= 'up';
} else {
$icon .= 'down';
}
$icon .= "'";
}
echo '<th><a href="' . generate_url(array('page' => 'device', 'device' => $device['device_id'], 'tab' => 'processes', 'order' => $lhead, 'by' => $bhead)) . '"><span' . $icon . '> ';
if (!empty($extra)) {
echo "<abbr title='{$extra}'>{$head}</abbr>";
} else {
echo $head;
}
echo '</span></a></th>';
}
//end foreach
echo '</tr></thead><tbody>';
foreach (dbFetchRows('SELECT * FROM `processes` WHERE `device_id` = ? ORDER BY ' . $order . ' ' . $by, array($device['device_id'])) as $entry) {
echo '<tr>';
echo '<td>' . $entry['pid'] . '</td>';
echo '<td>' . format_si($entry['vsz'] * 1024) . '</td>';
echo '<td>' . format_si($entry['rss'] * 1024) . '</td>';
echo '<td>' . $entry['cputime'] . '</td>';
echo '<td>' . $entry['user'] . '</td>';
echo '<td>' . $entry['command'] . '</td>';
echo '</tr>';
}
echo '</tbody></table></div>';
开发者ID:awlx,项目名称:librenms,代码行数:31,代码来源:processes.inc.php
示例16: print_bgp_table
//.........这里部分代码省略.........
$afi_class = 'success';
break;
case 'ipv6':
case 'ipv6z':
$afi_class = 'primary';
break;
default:
$afi_class = 'default';
}
switch ($peer_afi['safi']) {
case 'unicast':
$safi_class = 'delayed';
break;
case 'multicast':
$safi_class = 'warning';
break;
case 'vpn':
$safi_class = 'suppressed';
break;
default:
$safi_class = 'default';
}
$peer_afi_html .= '<span class="label label-' . $afi_class . '">' . $peer_afi['afi'] . '</span>';
$peer_afi_html .= '<span class="label label-' . $safi_class . '">' . $peer_afi['safi'] . '</span>';
$peer_afi_html .= '</span>';
$peer_afis_html[] = $peer_afi_html;
}
$string .= ' <tr class="' . $peer['html_row_class'] . '">' . PHP_EOL;
$string .= ' <td class="state-marker"></td>' . PHP_EOL;
$string .= ' <td></td>' . PHP_EOL;
$string .= ' <td style="white-space: nowrap" class="entity">' . $local_ip . '<br />' . $local_name . '</td>' . PHP_EOL;
$string .= ' <td><span class="text-success"><i class="glyphicon glyphicon-arrow-right"></i></span></td>' . PHP_EOL;
$string .= ' <td style="white-space: nowrap" class="entity">' . $peer_ip . '<br />' . $peer_name . '</td>' . PHP_EOL;
$string .= ' <td><span class="label label-' . $peer['peer_type_class'] . '">' . $peer['peer_type'] . '</span></td>' . PHP_EOL;
$string .= ' <td>' . implode('<br />', $peer_afis_html) . '</td>' . PHP_EOL;
$string .= ' <td><strong>' . $peer_as . '</strong><br />' . $peer['astext'] . '</td>' . PHP_EOL;
$string .= ' <td><strong><span class=" label label-' . $peer['admin_class'] . '">' . $peer['bgpPeerAdminStatus'] . '</span><br /><span class="label label-' . $peer['state_class'] . '">' . $peer['bgpPeerState'] . '</span></strong></td>' . PHP_EOL;
$string .= ' <td style="white-space: nowrap">' . formatUptime($peer['bgpPeerFsmEstablishedTime']) . '<br />
Updates: <i class="icon-circle-arrow-down text-success"></i> ' . format_si($peer['bgpPeerInUpdates']) . ' <i class="icon-circle-arrow-up text-primary"></i> ' . format_si($peer['bgpPeerOutUpdates']) . '</td>' . PHP_EOL;
$string .= ' </tr>' . PHP_EOL;
// Graphs
$peer_graph = FALSE;
switch ($vars['graph']) {
case 'prefixes_ipv4unicast':
case 'prefixes_ipv4multicast':
case 'prefixes_ipv4vpn':
case 'prefixes_ipv6unicast':
case 'prefixes_ipv6multicast':
$afisafi = preg_replace('/prefixes_(ipv[46])(\\w+)/', '$1.$2', $vars['graph']);
// prefixes_ipv6unicast ->> ipv6.unicast
if (isset($peer_afis[$afisafi]) && $peer['bgpPeer_id']) {
$graph_array['type'] = 'bgp_' . $vars['graph'];
$graph_array['id'] = $peer['bgpPeer_id'];
$peer_graph = TRUE;
}
break;
case 'updates':
if ($peer['bgpPeer_id']) {
$graph_array['type'] = 'bgp_updates';
$graph_array['id'] = $peer['bgpPeer_id'];
$peer_graph = TRUE;
}
break;
case 'macaccounting_bits':
case 'macaccounting_pkts':
//FIXME. I really still not know it works or not? -- mike
// This part copy-pasted from old code as is
$acc = dbFetchRow("SELECT * FROM `mac_accounting` AS M\n LEFT JOIN `ip_mac` AS I ON M.mac = I.mac_address\n LEFT JOIN `ports` AS P ON P.port_id = M.port_id\n LEFT JOIN `devices` AS D ON D.device_id = P.device_id\n WHERE I.ip_address = ?", array($peer['bgpPeerRemoteAddr']));
$database = get_rrd_path($device, "cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd");
if (is_array($acc) && is_file($database)) {
$peer_graph = TRUE;
$graph_array['id'] = $acc['ma_id'];
$graph_array['type'] = $vars['graph'];
}
break;
}
if ($peer_graph) {
$graph_array['to'] = $config['time']['now'];
$string .= ' <tr class="' . $peer['html_row_class'] . '">' . PHP_EOL;
$string .= ' <td class="state-marker"></td><td colspan="10" style="white-space: nowrap">' . PHP_EOL;
$string .= generate_graph_row($graph_array);
$string .= ' </td>' . PHP_EOL . ' </tr>' . PHP_EOL;
} else {
if ($list['graph']) {
// Empty row for correct view class table-striped-two
$string .= ' <tr class="' . $peer['html_row_class'] . '"><td class="state-marker"></td><td colspan="10"></td></tr>' . PHP_EOL;
}
}
}
$string .= ' </tbody>' . PHP_EOL;
$string .= '</table>';
$string .= generate_box_close();
// Print pagination header
if ($entries['pagination_html']) {
$string = $entries['pagination_html'] . $string . $entries['pagination_html'];
}
// Print
echo $string;
}
}
开发者ID:Natolumin,项目名称:observium,代码行数:101,代码来源:routing.inc.php
示例17: getRates
$datefrom = $day_data['0'];
$dateto = $day_data['1'];
# $rate_data = getRates($bill['bill_id'],$datefrom,$dateto);
$rate_data = $bill;
$rate_95th = $rate_data['rate_95th'];
$dir_95th = $rate_data['dir_95th'];
$total_data = $rate_data['total_data'];
$rate_average = $rate_data['rate_average'];
if ($bill['bill_type'] == "cdr") {
$type = "CDR";
$allowed = format_si($bill['bill_cdr']) . "bps";
$used = format_si($rate_data['rate_95th']) . "bps";
$percent = round($rate_data['rate_95th'] / $bill['bill_cdr'] * 100, 2);
$background = get_percentage_colours($percent);
$overuse = $rate_data['rate_95th'] - $bill['bill_cdr'];
$overuse = $overuse <= 0 ? "-" : "<span style=\"color: #" . $background['left'] . "; font-weight: bold;\">" . format_si($overuse) . "bps</span>";
} elseif ($bill['bill_type'] == "quota") {
$type = "Quota";
$allowed = format_bytes_billing($bill['bill_quota']);
$used = format_bytes_billing($rate_data['total_data']);
$percent = round($rate_data['total_data'] / $bill['bill_quota'] * 100, 2);
$background = get_percentage_colours($percent);
$overuse = $rate_data['total_data'] - $bill['bill_quota'];
$overuse = $overuse <= 0 ? "-" : "<span style=\"color: #" . $background['left'] . "; font-weight: bold;\">" . format_bytes_billing($overuse) . "</span>";
}
$right_background = $background['right'];
$left_background = $background['left'];
if (!is_integer($i / 2)) {
$row_colour = $list_colour_a;
} else {
$row_colour = $list_colour_b;
开发者ID:REAP720801,项目名称:librenms,代码行数:31,代码来源:bills.inc.php
示例18: round
$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 />
# " . $paidrate_text . " <br />
# " . $total_data . "MB transfered in the current billing cycle. <br />
# " . $rate_average . "Kbps Average during the current billing cycle. </p>
# <font face=\"Trebuchet MS, Verdana, Arial, Sans-Serif\" color=" . $bill_color . "><B>" . $rate_95th . "Kbps @ 95th Percentile.</b> (" . $dir_95th . ") (" . $bill_text . ")</font>
# </td><td><img src=\"images/billing-key.png\"></td></tr></table>
# <br />");
}
$lastmonth = dbFetchCell("SELECT UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 1 MONTH))");
$yesterday = dbFetchCell("SELECT UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 1 DAY))");
$rightnow = date(U);
if ($vars['view'] == "accurate") {
$bi = "<img src='billing-graph.php?bill_id=" . $bill_id . "&bill_code=" . $_GET['bill_code'];
开发者ID:CumulusNetworks,项目名称:cldemo-archive,代码行数:31,代码来源:bill.inc.php
示例19: round
<?php
} else {
if ($bill_data['bill_type'] == 'cdr') {
// The customer is billed based on a CDR with 95th%ile overage
$unit = 'kbps';
$cdr = $bill_data['bill_cdr'];
$rate_95th = round($rate_95th, 2);
$percent = round($rate_95th / $cdr * 100, 2);
$type = '&95th=yes';
?>
<td>
<?php
echo format_si($rate_95th);
?>
of <?php
echo format_si($cdr) . 'bps (' . $percent . '%)';
?>
(95th%ile)
</td>
<td style="width: 210px;">
<?php
echo print_percentage_bar(200, 20, $percent, null, 'ffffff', $background['left'], $percent . '%', 'ffffff', $background['right']);
?>
</td>
<?php
}
}
//end if
?>
</tr>
开发者ID:greggcz,项目名称:librenms,代码行数:31,代码来源:bill.inc.php
-
librespeed/speedtest: Self-hosted Speedtest for HTML5 and more. Easy setup, exam
阅读:1291|2022-08-30
-
OpenTeknik LLC OSSN OPEN SOURCE SOCIAL NETWORK v6.3 LTS was discovered to contai
阅读:867|2022-07-29
-
avehtari/BDA_m_demos: Bayesian Data Analysis demos for Matlab/Octave
阅读:1205|2022-08-17
-
女人怀孕后,为了有一个健康聪明的宝宝,经历各种体检、筛查。其实这些体检和筛查中的
阅读:1002|2022-11-06
-
一、电脑软硬件基础知识 1、CPU型号怎么看? CPU是一台电脑的核心,而目前笔记本市场
阅读:802|2022-07-30
-
medfreeman/markdown-it-toc-and-anchor: markdown-it plugin to add a toc and ancho
阅读:1404|2022-08-18
-
sydney0zq/covid-19-detection: The implementation of A Weakly-supervised Framewor
阅读:519|2022-08-16
-
当数据集已处于插入状态时,如何确定数据感知组件字段是否已被修改?我想知道一个字段
阅读:621|2022-07-18
-
离中国最远的国家是阿根廷。从太平洋直线计算,即往东线走,北京到阿根廷的布宜诺斯艾
阅读:669|2022-11-06
-
A vulnerability has been identified in Mendix Excel Importer Module (Mendix 8 co
阅读:787|2022-07-29
|
请发表评论