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

PHP ifLabel函数代码示例

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

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



在下文中一共展示了ifLabel函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: ifNameDescr

function ifNameDescr($interface, $device = null)
{
    return ifLabel($interface, $device);
}
开发者ID:arrmo,项目名称:librenms,代码行数:4,代码来源:rewrites.php


示例2: array_sort

    case 'errors':
        $ports = array_sort($ports, 'ifErrors_rate', SORT_DESC);
        break;
    case 'speed':
        $ports = array_sort($ports, 'ifSpeed', SORT_DESC);
        break;
    case 'port':
        $ports = array_sort($ports, 'ifDescr', SORT_ASC);
        break;
    case 'media':
        $ports = array_sort($ports, 'ifType', SORT_ASC);
        break;
    case 'descr':
        $ports = array_sort($ports, 'ifAlias', SORT_ASC);
        break;
    case 'device':
    default:
        $ports = array_sort($ports, 'hostname', SORT_ASC);
}
//end switch
$csv[] = array('Device', 'Port', 'Speed', 'Down', 'Up', 'Media', 'Description');
foreach ($ports as $port) {
    if (port_permitted($port['port_id'], $port['device_id'])) {
        $speed = humanspeed($port['ifSpeed']);
        $type = humanmedia($port['ifType']);
        $port['in_rate'] = formatRates($port['ifInOctets_rate'] * 8);
        $port['out_rate'] = formatRates($port['ifOutOctets_rate'] * 8);
        $port = ifLabel($port, $device);
        $csv[] = array($port['hostname'], fixIfName($port['label']), $speed, $port['in_rate'], $port['out_rate'], $type, $port['ifAlias']);
    }
}
开发者ID:sfromm,项目名称:librenms,代码行数:31,代码来源:ports.csv.inc.php


示例3: gethostbyid

<?php

$hostname = gethostbyid($entry['host']);
unset($icon);
$icon = geteventicon($entry['message']);
if ($icon) {
    $icon = '<img src="images/16/' . $icon . '" />';
}
echo '<tr>
  <td>
    ' . $entry['datetime'] . '
  </td>';
if (!isset($vars['device'])) {
    $dev = device_by_id_cache($entry['host']);
    echo '<td>
    ' . generate_device_link($dev, shorthost($dev['hostname'])) . '
  </td>';
}
if ($entry['type'] == 'interface') {
    $this_if = ifLabel(getifbyid($entry['reference']));
    $entry['link'] = '<b>' . generate_port_link($this_if, makeshortif(strtolower($this_if['label']))) . '</b>';
} else {
    $entry['link'] = 'System';
}
echo '<td>' . $entry['link'] . '</td>';
echo '<td>' . $entry['message'] . '</td>
</tr>';
开发者ID:jmacul2,项目名称:librenms,代码行数:27,代码来源:print-event.inc.php


示例4: foreach

<?php

$i = 0;
foreach (explode(",", $vars['id']) as $ifid) {
    $port = dbFetchRow("SELECT * FROM `ports` AS I, devices as D WHERE I.port_id = ? AND I.device_id = D.device_id", array($ifid));
    if (is_file($config['rrd_dir'] . "/" . $port['hostname'] . "/port-" . safename($port['ifIndex'] . ".rrd"))) {
        $port = ifLabel($port);
        $rrd_list[$i]['filename'] = $config['rrd_dir'] . "/" . $port['hostname'] . "/port-" . safename($port['ifIndex'] . ".rrd");
        $rrd_list[$i]['descr'] = $port['hostname'] . " " . $port['ifDescr'];
        $rrd_list[$i]['descr_in'] = $port['hostname'];
        $rrd_list[$i]['descr_out'] = makeshortif($port['label']);
        $i++;
    }
}
$units = 'bps';
$total_units = 'B';
$colours_in = 'greens';
$multiplier = "8";
$colours_out = 'blues';
$nototal = 1;
$ds_in = "INOCTETS";
$ds_out = "OUTOCTETS";
include "includes/graphs/generic_multi_bits_separated.inc.php";
开发者ID:REAP720801,项目名称:librenms,代码行数:23,代码来源:bits_separate.inc.php


示例5: AND

    $sql .= " AND (`D`.`hostname` LIKE '%{$searchPhrase}%' OR `E`.`datetime` LIKE '%{$searchPhrase}%' OR `E`.`message` LIKE '%{$searchPhrase}%' OR `E`.`type` LIKE '%{$searchPhrase}%')";
}
$count_sql = "SELECT COUNT(datetime) {$sql}";
$total = dbFetchCell($count_sql, $param);
if (empty($total)) {
    $total = 0;
}
if (!isset($sort) || empty($sort)) {
    $sort = 'datetime DESC';
}
$sql .= " ORDER BY {$sort}";
if (isset($current)) {
    $limit_low = $current * $rowCount - $rowCount;
    $limit_high = $rowCount;
}
if ($rowCount != -1) {
    $sql .= " LIMIT {$limit_low},{$limit_high}";
}
$sql = "SELECT `E`.*,DATE_FORMAT(datetime, '" . $config['dateformat']['mysql']['compact'] . "') as humandate {$sql}";
foreach (dbFetchRows($sql, $param) as $eventlog) {
    $dev = device_by_id_cache($eventlog['host']);
    if ($eventlog['type'] == 'interface') {
        $this_if = ifLabel(getifbyid($eventlog['reference']));
        $type = '<b>' . generate_port_link($this_if, makeshortif(strtolower($this_if['label']))) . '</b>';
    } else {
        $type = $eventlog['type'];
    }
    $response[] = array('datetime' => $eventlog['humandate'], 'hostname' => generate_device_link($dev, shorthost($dev['hostname'])), 'type' => $type, 'message' => htmlspecialchars($eventlog['message']));
}
$output = array('current' => $current, 'rowCount' => $rowCount, 'rows' => $response, 'total' => $total);
echo _json_encode($output);
开发者ID:n-st,项目名称:librenms,代码行数:31,代码来源:eventlog.inc.php


示例6: generate_port_link

    if (!$ignore) {
        if ($entry['ifInErrors'] > 0 || $entry['ifOutErrors'] > 0) {
            $error_img = generate_port_link($entry, "<img src='images/16/chart_curve_error.png' alt='Interface Errors' border=0>", port_errors);
        } else {
            $error_img = '';
        }
        $arp_host = dbFetchRow('SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = ? AND I.port_id = A.port_id AND D.device_id = I.device_id', array($entry['ipv4_address']));
        if ($arp_host) {
            $arp_name = generate_device_link($arp_host);
        } else {
            unset($arp_name);
        }
        if ($arp_host) {
            $arp_if = generate_port_link($arp_host);
        } else {
            unset($arp_if);
        }
        if ($arp_host['device_id'] == $entry['device_id']) {
            $arp_name = 'Localhost';
        }
        if ($arp_host['port_id'] == $entry['port_id']) {
            $arp_if = 'Local port';
        }
        $response[] = array('mac_address' => formatMac($entry['mac_address']), 'ipv4_address' => $entry['ipv4_address'], 'hostname' => generate_device_link($entry), 'interface' => generate_port_link($entry, makeshortif(fixifname(ifLabel($entry['label'])))) . ' ' . $error_img, 'remote_device' => $arp_name, 'remote_interface' => $arp_if);
    }
    //end if
    unset($ignore);
}
//end foreach
$output = array('current' => $current, 'rowCount' => $rowCount, 'rows' => $response, 'total' => $total);
echo _json_encode($output);
开发者ID:greggcz,项目名称:librenms,代码行数:31,代码来源:arp-search.inc.php


示例7: ifLabel

<?php

#echo("<pre>");
#print_r($interface);
#echo("</pre>");
#  This file prints a table row for each interface
$interface['device_id'] = $device['device_id'];
$interface['hostname'] = $device['hostname'];
$if_id = $interface['interface_id'];
$interface = ifLabel($interface);
if (!is_integer($i / 2)) {
    $row_colour = $list_colour_a;
} else {
    $row_colour = $list_colour_b;
}
if ($interface['ifInErrors_delta'] > 0 || $interface['ifOutErrors_delta'] > 0) {
    $error_img = generateiflink($interface, "<img src='images/16/chart_curve_error.png' alt='Interface Errors' border=0>", "port_errors");
} else {
    $error_img = "";
}
if (mysql_result(mysql_query("SELECT count(*) FROM mac_accounting WHERE interface_id = '" . $interface['interface_id'] . "'"), 0)) {
    $mac = "<a href='device/" . $interface['device_id'] . "/interface/" . $interface['interface_id'] . "/macaccounting/'><img src='/images/16/chart_curve.png' align='absmiddle'></a>";
} else {
    $mac = "";
}
echo "<tr style=\"background-color: {$row_colour}; padding: 5px;\" valign=top onmouseover=\"this.style.backgroundColor='{$list_highlight}';\" onmouseout=\"this.style.backgroundColor='{$row_colour}';\" onclick=\"location.href='/device/" . $device['device_id'] . "/interface/" . $interface['interface_id'] . "/'\" style='cursor: hand;'>\n           <td valign=top width=350>";
echo "        <span class=list-large>\n                " . generateiflink($interface, $interface['ifIndex'] . ". " . $interface['label']) . " {$error_img} {$mac}\n\n             </span><br /><span class=interface-desc>" . $interface['ifAlias'] . "</span>";
if ($interface['ifAlias']) {
    echo "<br />";
}
unset($break);
开发者ID:kyrisu,项目名称:observernms,代码行数:31,代码来源:print-interface.inc.php


示例8: EXISTS

    AND NOT EXISTS (
        SELECT * FROM ipv4_addresses a
        WHERE a.ipv4_address = m.ipv4_address
    )
    GROUP BY ipv4_address
    ORDER BY ipv4_address
    ';
// FIXME: Observium now uses ip_mac.ip_address in place of ipv4_mac.ipv4_address - why?
$names = array();
$ips = array();
foreach (dbFetchRows($sql, array($deviceid)) as $entry) {
    global $config;
    $ip = $entry['ipv4_address'];
    $mac = $entry['mac_address'];
    $if = $entry['port_id'];
    $int = ifLabel($if);
    $label = $int['label'];
    // Even though match_network is done inside discover_new_device, we do it here
    // as well in order to skip unnecessary reverse DNS lookups on discovered IPs.
    if (match_network($config['autodiscovery']['nets-exclude'], $ip)) {
        echo 'x';
        continue;
    }
    if (!match_network($config['nets'], $ip)) {
        echo 'i';
        log_event("Ignored {$ip}", $deviceid, 'interface', $if);
        continue;
    }
    // Attempt discovery of each IP only once per run.
    if (arp_discovery_is_cached($ip)) {
        echo '.';
开发者ID:rasssta,项目名称:librenms,代码行数:31,代码来源:discovery-arp.inc.php


示例9: get_port_by_id

require_once '../includes/snmp.inc.php';
if (is_numeric($_GET['id']) && ($config['allow_unauth_graphs'] || port_permitted($_GET['id']))) {
    $port = get_port_by_id($_GET['id']);
    $device = device_by_id_cache($port['device_id']);
    $title = generate_device_link($device);
    $title .= " :: Port  " . generate_port_link($port);
    $auth = TRUE;
} else {
    echo "Unauthenticad";
    die;
}
header("Content-type: image/svg+xml");
/********** HTTP GET Based Conf ***********/
$ifnum = @$port['ifIndex'];
// BSD / SNMP interface name / number
$ifname = ifLabel($port);
$ifname = $ifname['label'];
//Interface name that will be showed on top right of graph
$hostname = shorthost($device['hostname']);
if ($_GET['title']) {
    $ifname = $_GET['title'];
}
/********* Other conf *******/
$scale_type = "follow";
//Autoscale default setup : "up" = only increase scale; "follow" = increase and decrease scale according to current graphed datas
$nb_plot = 240;
//NB plot in graph
if (is_numeric($_GET['interval'])) {
    $time_interval = $_GET['interval'];
} else {
    $time_interval = 1;
开发者ID:samyscoub,项目名称:librenms,代码行数:31,代码来源:graph-realtime.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP ifNameDescr函数代码示例发布时间:2022-05-15
下一篇:
PHP iemdb函数代码示例发布时间: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