• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP format_bi函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中format_bi函数的典型用法代码示例。如果您正苦于以下问题:PHP format_bi函数的具体用法?PHP format_bi怎么用?PHP format_bi使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了format_bi函数的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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`=? AND `deleted` = 0', array($device_id, $ifName));
    $in_rate = $port['ifInOctets_rate'] * 8;
    $out_rate = $port['ifOutOctets_rate'] * 8;
    $port['in_rate'] = formatRates($in_rate);
    $port['out_rate'] = formatRates($out_rate);
    $port['in_perc'] = number_format($in_rate / $port['ifSpeed'] * 100, 2, '.', '');
    $port['out_perc'] = number_format($out_rate / $port['ifSpeed'] * 100, 2, '.', '');
    $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:Rosiak,项目名称:librenms,代码行数:22,代码来源:api_functions.inc.php


示例2: generate_port_link

echo "</td><td width=100>";
if ($port_details) {
    $port['graph_type'] = "port_bits";
    echo generate_port_link($port, "<img src='graph.php?type=port_bits&amp;id=" . $port['port_id'] . "&amp;from=" . $config['time']['day'] . "&amp;to=" . $config['time']['now'] . "&amp;width=100&amp;height=20&amp;legend=no&amp;bg=" . str_replace("#", "", $row_colour) . "'>");
    $port['graph_type'] = "port_upkts";
    echo generate_port_link($port, "<img src='graph.php?type=port_upkts&amp;id=" . $port['port_id'] . "&amp;from=" . $config['time']['day'] . "&amp;to=" . $config['time']['now'] . "&amp;width=100&amp;height=20&amp;legend=no&amp;bg=" . str_replace("#", "", $row_colour) . "'>");
    $port['graph_type'] = "port_errors";
    echo generate_port_link($port, "<img src='graph.php?type=port_errors&amp;id=" . $port['port_id'] . "&amp;from=" . $config['time']['day'] . "&amp;to=" . $config['time']['now'] . "&amp;width=100&amp;height=20&amp;legend=no&amp;bg=" . str_replace("#", "", $row_colour) . "'>");
}
echo "</td><td width=120>";
if ($port['ifOperStatus'] == "up") {
    $port['in_rate'] = $port['ifInOctets_rate'] * 8;
    $port['out_rate'] = $port['ifOutOctets_rate'] * 8;
    $in_perc = @round($port['in_rate'] / $port['ifSpeed'] * 100);
    $out_perc = @round($port['in_rate'] / $port['ifSpeed'] * 100);
    echo "<img src='images/16/arrow_left.png' align=absmiddle> <span style='color: " . percent_colour($in_perc) . "'>" . formatRates($port['in_rate']) . "<br />\n        <img align=absmiddle src='images/16/arrow_out.png'> <span style='color: " . percent_colour($out_perc) . "'>" . formatRates($port['out_rate']) . "<br />\n        <img src='images/icons/arrow_pps_in.png' align=absmiddle> " . format_bi($port['ifInUcastPkts_rate']) . "pps</span><br />\n        <img src='images/icons/arrow_pps_out.png' align=absmiddle> " . format_bi($port['ifOutUcastPkts_rate']) . "pps</span>";
}
echo "</td><td width=75>";
if ($port['ifSpeed']) {
    echo "<span class=box-desc>" . humanspeed($port['ifSpeed']) . "</span>";
}
echo "<br />";
if ($port[ifDuplex] != "unknown") {
    echo "<span class=box-desc>" . $port['ifDuplex'] . "</span>";
} else {
    echo "-";
}
if ($device['os'] == "ios" || $device['os'] == "iosxe") {
    if ($port['ifTrunk']) {
        echo '<p class=box-desc><span class=purple><a title="';
        $vlans = dbFetchRows("SELECT * FROM `ports_vlans` AS PV, vlans AS V WHERE PV.`port_id` ='" . $port['port_id'] . "' and PV.`device_id` = '" . $device['device_id'] . "' AND V.`vlan_vlan` = PV.vlan AND V.device_id = PV.device_id");
开发者ID:REAP720801,项目名称:librenms,代码行数:31,代码来源:print-interface.inc.php


示例3: testFormatBi

 /**
  * @dataProvider providerFormatBi
  */
 public function testFormatBi($value, $round, $sf, $result)
 {
     $this->assertSame($result, format_bi($value, $round, $sf));
 }
开发者ID:skive,项目名称:observium,代码行数:7,代码来源:IncludesCommonTest.php


示例4: _port

 private function _port($params)
 {
     $params = explode(' ', $params);
     $hostname = $params[0];
     $ifname = $params[1];
     if (!$hostname || !$ifname) {
         return $this->respond('Error: Missing hostname or ifname.');
     }
     $device = dbFetchRow('SELECT * FROM `devices` WHERE `hostname` = ?', array($hostname));
     $port = dbFetchRow('SELECT * FROM `ports` WHERE (`ifName` = ? OR `ifDescr` = ?) AND device_id = ?', array($ifname, $ifname, $device['device_id']));
     if ($this->user['level'] < 5 && !in_array($port['port_id'], $this->user['ports']) && !in_array($device['device_id'], $this->user['devices'])) {
         return $this->respond('Error: Permission denied.');
     }
     $bps_in = formatRates($port['ifInOctets_rate'] * 8);
     $bps_out = formatRates($port['ifOutOctets_rate'] * 8);
     $pps_in = format_bi($port['ifInUcastPkts_rate']);
     $pps_out = format_bi($port['ifOutUcastPkts_rate']);
     return $this->respond($port['ifAdminStatus'] . '/' . $port['ifOperStatus'] . ' ' . $bps_in . ' > bps > ' . $bps_out . ' | ' . $pps_in . 'pps > PPS > ' . $pps_out . 'pps');
 }
开发者ID:arrmo,项目名称:librenms,代码行数:19,代码来源:IRCBot.php


示例5: humanspeed

                            $in_perc = @round($port['in_rate'] / $port['ifSpeed'] * 100);
                            $out_perc = @round($port['in_rate'] / $port['ifSpeed'] * 100);
                        }
                        if ($port['ifSpeed']) {
                            $port_speed = humanspeed($port['ifSpeed']);
                        }
                        if ($port[ifDuplex] != 'unknown') {
                            $port_duplex = $port['ifDuplex'];
                        }
                        if ($port['ifPhysAddress'] && $port['ifPhysAddress'] != '') {
                            $port_mac = formatMac($port['ifPhysAddress']);
                        }
                        if ($port['ifMtu'] && $port['ifMtu'] != '') {
                            $port_mtu = $port['ifMtu'];
                        }
                        $tbl->addRow(array($port['ifDescr'], $port['ifOperStatus'], '', formatRates($port['in_rate']), formatRates($port['out_rate']), format_bi($port['ifInUcastPkts_rate']) . 'pps', format_bi($port['ifOutUcastPkts_rate']) . 'pps', $port_speed, $port_duplex, '', $port_mac, $port_mtu));
                    }
                    //end foreach
                    echo $tbl->getTable();
                } else {
                    echo $options['list'];
                    echo "Usage of console-ui.php:\n\n            -l      What log type we want to see:\n            eventlog = Event log messages\n            syslog = Syslog messages\n\n            -d      Specify the device id to filter results\n\n            --list   What to list\n            devices = list devices and device id's\n\n            --device-stats      Lists the port statistics for a given device\n\n            Examples:\n            #1 php console-ui.php -l eventlog -d 1\n            #2 php console-ui.php --list=devices\n\n            ";
                    exit;
                }
            }
        }
    }
    //end if
    echo print $console_color->convert('%rLast update at ' . date('Y-m-d h:i:s') . "%n\n\n");
    sleep(5);
}
开发者ID:rasssta,项目名称:librenms,代码行数:31,代码来源:console-ui.php


示例6: discover_virtual_machine

/**
 * Discover a new virtual machine on a device
 *
 * This function adds a virtual machine to a device, if it does not already exist.
 * Data on the VM is updated if it has changed, and an event is logged with regards to the changes.
 * If the VM has a valid hostname, Observium attempts to discover this as a new device (calling discover_new_device).
 *
 * Valid array keys for the $options array: type, id, name, os, memory (in bytes), cpucount, status, source (= snmp, agent, etc)
 *
 * @param array &$valid
 * @param array $device
 * @param array $options
*/
function discover_virtual_machine(&$valid, $device, $options = array())
{
    print_debug('Discover VM: ' . $options['type'] . '/' . $options['source'] . ' (' . $options['id'] . ') ' . $options['name'] . ' CPU: ' . $options['cpucount'] . ' RAM: ' . $options['memory'] . ' Status: ' . $options['status']);
    if (dbFetchCell("SELECT COUNT(`vm_id`) FROM `vminfo` WHERE `device_id` = ? AND `vm_name` = ? AND `vm_type` = ? AND `vm_source` = ?", array($device['device_id'], $options['name'], $options['type'], $options['source'])) == '0') {
        $vm_insert = array('device_id' => $device['device_id'], 'vm_type' => $options['type'], 'vm_uuid' => $options['id'], 'vm_name' => $options['name'], 'vm_guestos' => $options['os'], 'vm_memory' => $options['memory'] / 1024 / 1024, 'vm_cpucount' => $options['cpucount'], 'vm_state' => $options['status'], 'vm_source' => $options['source']);
        $vm_id = dbInsert($vm_insert, 'vminfo');
        echo '+';
        log_event("Virtual Machine added: " . $options['name'] . ' (' . format_bi($options['memory']) . 'B RAM, ' . $options['cpucount'] . ' CPU)', $device, $options['type'], $vm_id);
        if (is_valid_hostname($options['name']) && in_array($options['status'], array('running', 'powered on', 'poweredOn'))) {
            // Try to discover this VM as a new device, if it's actually running. discover_new_device() will check for valid hostname, duplicates, etc.
            // Libvirt, Proxmox (= QEMU-powered) return "running"; VMWare returns "powered on" (or "poweredOn" in older versions).
            discover_new_device($options['name'], $options['type']);
        }
    } else {
        $vm = dbFetchRow("SELECT * FROM `vminfo` WHERE `device_id` = ? AND `vm_uuid` = ? AND `vm_type` = ?", array($device['device_id'], $options['id'], $options['type']));
        if ($vm['vm_state'] != $options['status'] || $vm['vm_name'] != $options['name'] || $vm['vm_cpucount'] != $options['cpucount'] || $vm['vm_guestos'] != $options['os'] || $vm['vm_memory'] != $options['memory'] / 1024 / 1024) {
            $update = array('vm_state' => $options['status'], 'vm_guestos' => $options['os'], 'vm_name' => $options['name'], 'vm_memory' => $options['memory'] / 1024 / 1024, 'vm_cpucount' => $options['cpucount']);
            dbUpdate($update, 'vminfo', "device_id = ? AND vm_type = ? AND vm_uuid = ? AND vm_source = ?", array($device['device_id'], $options['type'], $options['id'], $options['source']));
            echo 'U"';
            /// FIXME eventlog changed fields
        } else {
            echo '.';
        }
    }
    $valid['vm'][$options['type']][(string) $options['id']] = 1;
}
开发者ID:Natolumin,项目名称:observium,代码行数:39,代码来源:functions.inc.php


示例7: 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


示例8: format_value

function format_value($value, $format = '', $round = 2, $sf = 3)
{
    switch (strtolower($format)) {
        case 'si':
        case '1000':
            $value = format_si($value, $round, $sf);
            break;
        case 'bi':
        case '1024':
            $value = format_bi($value, $round, $sf);
            break;
        case 'time':
            $value = formatUptime($value);
            break;
        default:
            if (is_numeric($value)) {
                $value = sprintf("%01.{$round}f", $value);
                $value = preg_replace(array('/\\.0+$/', '/(\\.\\d)0+$/'), '\\1', $value);
            }
    }
    return $value;
}
开发者ID:Natolumin,项目名称:observium,代码行数:22,代码来源:common.inc.php


示例9: generate_vm_row

function generate_vm_row($vm, $vars)
{
    global $config;
    $table_cols = "8";
    $out = '<tr class="' . $vm['row_class'] . '">';
    // <td class="state-marker"></td>'; // FIXME useful when we start polling VM state
    if ($vars['page'] != "device" && $vars['popup'] != TRUE) {
        $out .= '<td class="entity">' . generate_device_link($vm) . '</td>';
        $table_cols++;
    }
    $out .= '<td class="entity">' . generate_entity_link('virtualmachine', $vm) . '</td>';
    $out .= '<td>' . nicecase($vm['vm_state']) . '</td>';
    switch ($vm['vm_guestos']) {
        case 'E: tools not installed':
            $out .= '  <td class="small">Unknown (VMware Tools not installed)</td>';
            break;
        case 'E: tools not running':
            $out .= '  <td class="small">Unknown (VMware Tools not running)</td>';
            break;
        case '':
            $out .= '  <td class="small"><i>(Unknown)</i></td>';
            break;
        default:
            if (isset($config['vmware_guestid'][$vm['vm_guestos']])) {
                $out .= '  <td>' . $config['vmware_guestid'][$vm['vm_guestos']] . '</td>';
            } else {
                $out .= '  <td>' . $vm['vm_guestos'] . '</td>';
            }
            break;
    }
    $out .= '<td>' . format_bi($vm['vm_memory'] * 1024 * 1024, 3, 3) . 'B</td>';
    $out .= '<td>' . nicecase($vm['vm_cpucount']) . '</td>';
    $out .= '</tr>';
    return $out;
}
开发者ID:Natolumin,项目名称:observium,代码行数:35,代码来源:virtualmachine.inc.php


示例10: generate_ap_link

echo "</span>";
echo "</td><td width=100>";
echo "</td><td width=150>";
$ap['graph_type'] = "accesspoints_numasoclients";
echo generate_ap_link($ap, "<img src='graph.php?type={$ap['graph_type']}&amp;id=" . $ap['accesspoint_id'] . "&amp;from=" . $config['time']['day'] . "&amp;to=" . $config['time']['now'] . "&amp;width=100&amp;height=20&amp;legend=no&amp;bg=" . str_replace("#", "", $row_colour) . "'>");
echo "<br>\n";
$ap['graph_type'] = "accesspoints_radioutil";
echo generate_ap_link($ap, "<img src='graph.php?type={$ap['graph_type']}&amp;id=" . $ap['accesspoint_id'] . "&amp;from=" . $config['time']['day'] . "&amp;to=" . $config['time']['now'] . "&amp;width=100&amp;height=20&amp;legend=no&amp;bg=" . str_replace("#", "", $row_colour) . "'>");
echo "<br>\n";
$ap['graph_type'] = "accesspoints_interference";
echo generate_ap_link($ap, "<img src='graph.php?type={$ap['graph_type']}&amp;id=" . $ap['accesspoint_id'] . "&amp;from=" . $config['time']['day'] . "&amp;to=" . $config['time']['now'] . "&amp;width=100&amp;height=20&amp;legend=no&amp;bg=" . str_replace("#", "", $row_colour) . "'>");
echo "<br>\n";
echo "</td><td width=120>";
echo "<img src='images/icons/wireless.png' align=absmiddle /> " . format_bi($ap[numasoclients]) . " Clients<br />";
echo "<img src='images/icons/wireless.png' align=absmiddle /> " . format_bi($ap[radioutil]) . " % busy<br />";
echo "<img src='images/icons/wireless.png' align=absmiddle /> " . format_bi($ap[interference]) . " interference index<br />";
echo "</td></tr>";
if ($vars['tab'] == "accesspoint") {
    $graph_type = 'accesspoints_numasoclients';
    echo "<tr style='background-color: {$row_colour}; padding: 0px;'><td colspan=7>";
    echo "<div class='graphhead'>Associated Clients</div>";
    include "includes/print-accesspoint-graphs.inc.php";
    echo "</td></tr>";
    $graph_type = 'accesspoints_interference';
    echo "<tr style='background-color: {$row_colour}; padding: 0px;'><td colspan=7>";
    echo "<div class='graphhead'>Interference</div>";
    include "includes/print-accesspoint-graphs.inc.php";
    echo "</td></tr>";
    $graph_type = 'accesspoints_channel';
    echo "<tr style='background-color: {$row_colour}; padding: 0px;'><td colspan=7>";
    echo "<div class='graphhead'>Channel</div>";
开发者ID:RomanBogachev,项目名称:observium,代码行数:31,代码来源:print-accesspoint.inc.php


示例11: port_info

 function port_info(&$irc, &$data)
 {
     global $config;
     $hostname = $data->messageex[1];
     $ifname = $data->messageex[2];
     mysql_connect($config['db_host'], $config['db_user'], $config['db_pass']);
     mysql_select_db($config['db_name']);
     $device = dbFetchRow("SELECT * FROM `devices` WHERE `hostname` = ?", array($hostname));
     $sql = "SELECT *, `ports`.`port_id` as `port_id`";
     $sql .= " FROM  `ports`";
     $sql .= " LEFT JOIN  `ports-state` ON  `ports`.port_id =  `ports-state`.port_id";
     $sql .= " WHERE ports.`ifName` = ? OR ports.`ifDescr` = ? AND ports.device_id = ?";
     $port = dbFetchRow($sql, array($ifname, $ifname, $device['device_id']));
     mysql_close();
     $bps_in = formatRates($port['ifInOctets_rate']);
     $bps_out = formatRates($port['ifOutOctets_rate']);
     $pps_in = format_bi($port['ifInUcastPkts_rate']);
     $pps_out = format_bi($port['ifOutUcastPkts_rate']);
     $irc->message(SMARTIRC_TYPE_CHANNEL, $data->channel, $port['ifAdminStatus'] . "/" . $port['ifOperStatus'] . " " . $bps_in . " > bps > " . $bps_out . " | " . $pps_in . "pps > PPS > " . $pps_out . "pps");
     echo date("m-d-y H:i:s ");
     echo "PORT\t\t\t" . $hostname . "\t" . $ifname . "\n";
 }
开发者ID:skive,项目名称:observium,代码行数:22,代码来源:irc.php


示例12: generate_port_row

function generate_port_row($port, $vars = array())
{
    global $config, $cache;
    $device = device_by_id_cache($port['device_id']);
    humanize_port($port);
    if (!isset($vars['view'])) {
        $vars['view'] = "basic";
    }
    // Populate $port_adsl if the port has ADSL-MIB data
    if (!isset($cache['ports_option']['ports_adsl']) || in_array($port['port_id'], $cache['ports_option']['ports_adsl'])) {
        $port_adsl = dbFetchRow("SELECT * FROM `ports_adsl` WHERE `port_id` = ?", array($port['port_id']));
    }
    // Populate $port['tags'] with various tags to identify port statuses and features
    // Port Errors
    if ($port['ifInErrors_delta'] > 0 || $port['ifOutErrors_delta'] > 0) {
        $port['tags'] .= generate_port_link($port, '<span class="label label-important">Errors</span>', 'port_errors');
    }
    // Port Deleted
    if ($port['deleted'] == '1') {
        $port['tags'] .= '<a href="' . generate_url(array('page' => 'deleted-ports')) . '"><span class="label label-important">Deleted</span></a>';
    }
    // Port CBQoS
    if (isset($cache['ports_option']['ports_cbqos'])) {
        if (in_array($port['port_id'], $cache['ports_option']['ports_cbqos'])) {
            $port['tags'] .= '<a href="' . generate_port_url($port, array('view' => 'cbqos')) . '"><span class="label label-info">CBQoS</span></a>';
        }
    } else {
        if (dbFetchCell("SELECT COUNT(*) FROM `ports_cbqos` WHERE `port_id` = ?", array($port['port_id']))) {
            $port['tags'] .= '<a href="' . generate_port_url($port, array('view' => 'cbqos')) . '"><span class="label label-info">CBQoS</span></a>';
        }
    }
    // Port MAC Accounting
    if (isset($cache['ports_option']['mac_accounting'])) {
        if (in_array($port['port_id'], $cache['ports_option']['mac_accounting'])) {
            $port['tags'] .= '<a href="' . generate_port_url($port, array('view' => 'macaccounting')) . '"><span class="label label-info">MAC</span></a>';
        }
    } else {
        if (dbFetchCell("SELECT COUNT(*) FROM `mac_accounting` WHERE `port_id` = ?", array($port['port_id']))) {
            $port['tags'] .= '<a href="' . generate_port_url($port, array('view' => 'macaccounting')) . '"><span class="label label-info">MAC</span></a>';
        }
    }
    // Populated formatted versions of port rates.
    $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";
    $string = '';
    if ($vars['view'] == "basic" || $vars['view'] == "graphs") {
        $table_cols = '8';
        $string .= '<tr class="' . $port['row_class'] . '">
            <td class="state-marker"></td>
            <td style="width: 1px;"></td>';
        if ($vars['page'] != "device" && $vars['popup'] != TRUE) {
            $table_cols++;
            // Increment table columns by one to make sure graph line draws correctly
            $string .= '    <td style="width: 200px;"><span class="entity">' . generate_device_link($device, short_hostname($device['hostname'], "20")) . '</span><br />
                <span class="em">' . escape_html(truncate($port['location'], 32, "")) . '</span></td>';
        }
        $string .= '    <td><span class="entity">' . generate_port_link($port, rewrite_ifname($port['port_label'])) . ' ' . $port['tags'] . '</span><br />
                <span class="em">' . escape_html(truncate($port['ifAlias'], 50, '')) . '</span></td>' . '<td style="width: 110px;"> <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 style="width: 90px;"> <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 style="width: 110px;"><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 style="width: 110px;"><small>' . $port['human_speed'] . '<br />' . $port['ifMtu'] . '</small></td>
            <td ><small>' . $port['human_type'] . '<br />' . $port['human_mac'] . '</small></td>
          </tr>';
    } else {
        if ($vars['view'] == "details" || $vars['view'] == "detail") {
            $table_cols = '9';
            $string .= '<tr class="' . $port['row_class'] . '"';
            if ($vars['tab'] != "port") {
                $string .= ' onclick="openLink(\'' . generate_port_url($port) . '\')" style="cursor: pointer;"';
            }
            $string .= '>';
            $string .= '         <td class="state-marker"></td>
         <td style="width: 1px;"></td>';
            if ($vars['page'] != "device" && $vars['popup'] != TRUE) {
                $table_cols++;
                // Increment table columns by one to make sure graph line draws correctly
                $string .= '    <td width="200"><span class="entity">' . generate_device_link($device, short_hostname($device['hostname'], "20")) . '</span><br />
                <span class="em">' . escape_html(truncate($port['location'], 32, "")) . '</span></td>';
            }
            $string .= '
         <td style="min-width: 250px;">';
            $string .= '        <span class="entity-title">
              ' . generate_port_link($port) . ' ' . $port['tags'] . '
           </span><br /><span class="small">' . escape_html($port['ifAlias']) . '</span>';
            if ($port['ifAlias']) {
                $string .= '<br />';
            }
            unset($break);
            if (!isset($cache['ports_option']['ipv4_addresses']) || in_array($port['port_id'], $cache['ports_option']['ipv4_addresses'])) {
                foreach (dbFetchRows("SELECT * FROM `ipv4_addresses` WHERE `port_id` = ?", array($port['port_id'])) as $ip) {
                    $string .= $break . generate_popup_link('ip', $ip['ipv4_address'] . '/' . $ip['ipv4_prefixlen'], NULL, 'small');
                    $break = "<br />";
                }
            }
            if (!isset($cache['ports_option']['ipv6_addresses']) || in_array($port['port_id'], $cache['ports_option']['ipv6_addresses'])) {
                foreach (dbFetchRows("SELECT * FROM `ipv6_addresses` WHERE `port_id` = ?", array($port['port_id'])) as $ip6) {
                    $string .= $break . generate_popup_link('ip', $ip6['ipv6_address'] . '/' . $ip6['ipv6_prefixlen'], NULL, 'small');
                    $break = "<br />";
                }
            }
            //$string .= '</span>';
//.........这里部分代码省略.........
开发者ID:Natolumin,项目名称:observium,代码行数:101,代码来源:port.inc.php


示例13: generate_ap_link

echo '</span>';
echo '</td><td width=100>';
echo '</td><td width=150>';
$ap['graph_type'] = 'accesspoints_numasoclients';
echo generate_ap_link($ap, "<img src='graph.php?type={$ap['graph_type']}&amp;id=" . $ap['accesspoint_id'] . '&amp;from=' . $config['time']['day'] . '&amp;to=' . $config['time']['now'] . '&amp;width=100&amp;height=20&amp;legend=no&amp;bg=' . str_replace('#', '', $row_colour) . "'>");
echo "<br>\n";
$ap['graph_type'] = 'accesspoints_radioutil';
echo generate_ap_link($ap, "<img src='graph.php?type={$ap['graph_type']}&amp;id=" . $ap['accesspoint_id'] . '&amp;from=' . $config['time']['day'] . '&amp;to=' . $config['time']['now'] . '&amp;width=100&amp;height=20&amp;legend=no&amp;bg=' . str_replace('#', '', $row_colour) . "'>");
echo "<br>\n";
$ap['graph_type'] = 'accesspoints_interference';
echo generate_ap_link($ap, "<img src='graph.php?type={$ap['graph_type']}&amp;id=" . $ap['accesspoint_id'] . '&amp;from=' . $config['time']['day'] . '&amp;to=' . $config['time']['now'] . '&amp;width=100&amp;height=20&amp;legend=no&amp;bg=' . str_replace('#', '', $row_colour) . "'>");
echo "<br>\n";
echo '</td><td width=120>';
echo "<img src='images/icons/wireless.png' style='height:20px; width:20px;' align=absmiddle /> " . format_bi($ap[numasoclients]) . ' Clients<br />';
echo "<img src='images/icons/wireless.png' style='height:20px; width:20px;' align=absmiddle /> " . format_bi($ap[radioutil]) . ' % busy<br />';
echo "<img src='images/icons/wireless.png' style='height:20px; width:20px;' align=absmiddle /> " . format_bi($ap[interference]) . ' interference index<br />';
echo '</td></tr>';
if ($vars['tab'] == 'accesspoint') {
    $graph_type = 'accesspoints_numasoclients';
    echo "<tr style='background-color: {$row_colour}; padding: 0px;'><td colspan=7>";
    echo "<div class='graphhead'>Associated Clients</div>";
    include 'includes/print-accesspoint-graphs.inc.php';
    echo '</td></tr>';
    $graph_type = 'accesspoints_interference';
    echo "<tr style='background-color: {$row_colour}; padding: 0px;'><td colspan=7>";
    echo "<div class='graphhead'>Interference</div>";
    include 'includes/print-accesspoint-graphs.inc.php';
    echo '</td></tr>';
    $graph_type = 'accesspoints_channel';
    echo "<tr style='background-color: {$row_colour}; padding: 0px;'><td colspan=7>";
    echo "<div class='graphhead'>Channel</div>";
开发者ID:awlx,项目名称:librenms,代码行数:31,代码来源:print-accesspoint.inc.php


示例14: format_number

function format_number($value, $base = '1000', $round = 2, $sf = 3)
{
    if ($base == '1000') {
        return format_si($value, $round, $sf);
    } else {
        return format_bi($value, $round, $sf);
    }
}
开发者ID:BillTheBest,项目名称:librenms,代码行数:8,代码来源:common.php


示例15: formatstorage

function formatstorage($rate, $round = '2')
{
    $rate = format_bi($rate, $round) . "B";
    return $rate;
}
开发者ID:kyrisu,项目名称:observernms_clean,代码行数:5,代码来源:functions.php


示例16: generate_port_link

    }
}
//echo("</span>");
echo "</td><td style='width: 147px;'>";
if ($port_details) {
    $port['graph_type'] = "port_bits";
    echo generate_port_link($port, "<img src='graph.php?type=port_bits&amp;id=" . $port['port_id'] . "&amp;from=" . $config['time']['day'] . "&amp;to=" . $config['time']['now'] . "&amp;width=100&amp;height=20&amp;legend=no' alt=\"\" />");
    $port['graph_type'] = "port_upkts";
    echo generate_port_link($port, "<img src='graph.php?type=port_upkts&amp;id=" . $port['port_id'] . "&amp;from=" . $config['time']['day'] . "&amp;to=" . $config['time']['now'] . "&amp;width=100&amp;height=20&amp;legend=no' alt=\"\" />");
    $port['graph_type'] = "port_errors";
    echo generate_port_link($port, "<img src='graph.php?type=port_errors&amp;id=" . $port['port_id'] . "&amp;from=" . $config['time']['day'] . "&amp;to=" . $config['time']['now'] . "&amp;width=100&amp;height=20&amp;legend=no' alt=\"\" />");
}
echo '</td><td style="width: 120px; white-space: nowrap;">';
if ($port['ifOperStatus'] == "up" || $port['ifOperStatus'] == "monitoring") {
    // Colours generated by humanize_port
    echo '<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 />', '<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>';
}
echo '</td><td style="width: 75px;">';
if ($port['ifSpeed']) {
    echo "<span class=small>" . humanspeed($port['ifSpeed']) . "</span>";
}
echo "<br />";
if ($port['ifDuplex'] != "unknown") {
    echo "<span class=small>" . $port['ifDuplex'] . "</span>";
} else {
    echo "-";
}
if ($port['ifTrunk']) {
    if ($port['ifVlan']) {
        // Native VLAN
        if (!isset($ports_vlan_cache)) {
开发者ID:skive,项目名称:observium,代码行数:31,代码来源:print-interface.inc.php


示例17: generate_ap_link

echo "</span>";
echo "</td><td width=100>";
echo "</td><td width=150>";
$ap['graph_type'] = "accesspoints_numasoclients";
echo generate_ap_link($ap, "<img src='graph.php?type=" . $ap['graph_type'] . "&amp;id=" . $ap['accesspoint_id'] . "&amp;from=" . $config['time']['day'] . "&amp;to=" . $config['time']['now'] . "&amp;width=100&amp;height=20&amp;legend=no&amp;bg=" . str_replace("#", "", $row_colour) . "'>");
echo "<br>\n";
$ap['graph_type'] = "accesspoints_radioutil";
echo generate_ap_link($ap, "<img src='graph.php?type=" . $ap['graph_type'] . "&amp;id=" . $ap['accesspoint_id'] . "&amp;from=" . $config['time']['day'] . "&amp;to=" . $config['time']['now'] . "&amp;width=100&amp;height=20&amp;legend=no&amp;bg=" . str_replace("#", "", $row_colour) . "'>");
echo "<br>\n";
$ap['graph_type'] = "accesspoints_interference";
echo generate_ap_link($ap, "<img src='graph.php?type=" . $ap['graph_type'] . "&amp;id=" . $ap['accesspoint_id'] . "&amp;from=" . $config['time']['day'] . "&amp;to=" . $config['time']['now'] . "&amp;width=100&amp;height=20&amp;legend=no&amp;bg=" . str_replace("#", "", $row_colour) . "'>");
echo "<br>\n";
echo "</td><td width=120>";
echo "<img src='images/icons/wireless.png' align=absmiddle /> " . format_bi($ap['numasoclients']) . " 客户端<br />";
echo "<img src='images/icons/wireless.png' align=absmiddle /> " . format_bi($ap['radioutil']) . " % 繁忙<br />";
echo "<img src='images/icons/wireless.png' align=absmiddle /> " . format_bi($ap['interference']) . " 干扰指数<br />";
echo "</td></tr>";
if ($vars['tab'] == "accesspoint") {
    $graphs = array('accesspoints_numasoclients' => '相关的客户', 'accesspoints_interference' => '干扰', 'accesspoints_channel' => '频道', 'accesspoints_txpow' => '传输功率', 'accesspoints_radioutil' => '广播应用', 'accesspoints_nummonclients' => '监控客户端', 'accesspoints_nummonbssid' => '监测BSSIDs');
    foreach ($graphs as $key => $text) {
        $graph_array['height'] = "100";
        $graph_array['width'] = "215";
        $graph_array['to'] = $config['time']['now'];
        $graph_array['id'] = $ap['accesspoint_id'];
        $graph_array['type'] = $key;
        echo '<tr><td colspan=4>';
        echo '<h4>', $text, '</h4>';
        print_graph_row($graph_array);
        echo '</td></tr>';
    }
    echo "</td></tr>";
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:31,代码来源:print-accesspoint.inc.php



注:本文中的format_bi函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP format_bytes函数代码示例发布时间:2022-05-15
下一篇:
PHP format_bankaccount函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap