当前位置: 首页>>代码示例>>PHP>>正文


PHP shorthost函数代码示例

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


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

示例1: foreach

$sql = 'SELECT * FROM `bgpPeers` AS B
        LEFT JOIN `bgpPeers-state` AS S ON B.bgpPeer_id = S.bgpPeer_id
        WHERE `device_id` = ? ' . $where . '
        ORDER BY `bgpPeerRemoteAs`, `bgpPeerRemoteAddr`';
foreach (dbFetchRows($sql, array($device['device_id'])) as $peer) {
    $peer['bgpLocalAs'] = $device['bgpLocalAs'];
    humanize_bgp($peer);
    $has_macaccounting = dbFetchCell("SELECT COUNT(*) FROM mac_accounting AS M\n                                   LEFT JOIN `ip_mac` AS I ON M.mac = I.mac_address\n                                   WHERE I.ip_address = ?", array($peer['bgpPeerRemoteAddr']));
    unset($peerhost, $peername);
    $ip_version = strstr($peer['bgpPeerRemoteAddr'], ':') ? 'ipv6' : 'ipv4';
    $peerhost = dbFetchRow('SELECT * FROM ' . $ip_version . '_addresses AS A
                         LEFT JOIN ports AS I ON A.port_id = I.port_id
                         LEFT JOIN devices AS D ON I.device_id = D.device_id
                         WHERE A.' . $ip_version . '_address = ?', array($peer['bgpPeerRemoteAddr']));
    if ($peerhost) {
        $peername = generate_device_link($peerhost, shorthost($peerhost['hostname']), array('tab' => 'routing', 'proto' => 'bgp'));
    } else {
        unset($peername);
    }
    unset($sep);
    foreach (dbFetchRows("SELECT * FROM `bgpPeers_cbgp` WHERE `device_id` = ? AND bgpPeerRemoteAddr = ?", array($device['device_id'], $peer['bgpPeerRemoteAddr'])) 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
    }
    $graph_type = "bgp_updates";
    $peer_daily_url = "graph.php?id=" . $peer['bgpPeer_id'] . "&amp;type=" . $graph_type . "&amp;from=" . $config['time']['day'] . "&amp;to=" . $config['time']['now'] . "&amp;width=500&amp;height=150";
开发者ID:RomanBogachev,项目名称:observium,代码行数:31,代码来源:bgp.inc.php

示例2: getImage

                     $serviceLabelOld = 'availability-map-oldview-box-down';
                     $serviceState = "down";
                     $service_down_count++;
                 }
             }
         }
         if ($config['webui']['availability_map_compact'] == 0) {
             if ($directpage == "yes") {
                 $deviceIcon = getImage($service);
                 $temp_output[] = '
                 <a href="' . generate_url(array('page' => 'device', 'tab' => 'services', 'device' => $service['device_id'])) . '" title="' . $service['hostname'] . " - " . $service['service_type'] . " - " . $service['service_desc'] . '">
                     <div class="service-availability ' . $serviceState . '" style="width:' . $config['webui']['availability_map_direct_tile_size'] . 'px;">
                         <span class="service-name-label label ' . $serviceLabel . ' label-font-border">' . $service["service_type"] . '</span>
                         <span class="availability-label label ' . $serviceLabel . ' label-font-border">' . $serviceState . '</span>
                         <span class="device-icon">' . $deviceIcon . '</span><br>
                         <span class="small">' . shorthost(ip_to_sysname($service, $service['hostname'])) . '</span>
                     </div>
                 </a>';
             } else {
                 $temp_output[] = '
                 <a href="' . generate_url(array('page' => 'device', 'tab' => 'services', 'device' => $service['device_id'])) . '" title="' . $service['hostname'] . " - " . $service['service_type'] . " - " . $service['service_desc'] . '">
                     <span class="label ' . $serviceLabel . ' widget-availability label-font-border">' . $service['service_type'] . ' - ' . $serviceState . '</span>
                 </a>';
             }
         } else {
             $temp_output[] = '<a href="' . generate_url(array('page' => 'device', 'tab' => 'services', 'device' => $service['device_id'])) . '" title="' . $service['hostname'] . " - " . $service['service_type'] . " - " . $service['service_desc'] . '"><div class="' . $serviceLabelOld . '" style="width:' . $compact_tile . 'px;"></div></a>';
         }
     }
 } else {
     $temp_output[] = '';
 }
开发者ID:ekoyle,项目名称:librenms,代码行数:31,代码来源:availability-map.inc.php

示例3: overlib

 }
 $peeraddresslink = "<span class=list-large><a href='device/device=" . $peer['device_id'] . "/tab=routing/proto=bgp/' onmouseover=\"return overlib('<img src=\\'{$peer_daily_url}\\'>', LEFT" . $config['overlib_defaults'] . ');" onmouseout="return nd();">' . $peer_ident . '</a></span>';
 echo '<tr class="bgp"' . ($peer['alert'] ? ' bordercolor="#cc0000"' : '') . ($peer['disabled'] ? ' bordercolor="#cccccc"' : '') . '>';
 unset($sep);
 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>&#187;</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;
         }
开发者ID:n-st,项目名称:librenms,代码行数:31,代码来源:bgp.inc.php

示例4: foreach

foreach (dbFetchRows($sql, $param) as $alertlog) {
    $dev = device_by_id_cache($alertlog['device_id']);
    $fault_detail = alert_details($alertlog['details']);
    $alert_state = $alertlog['state'];
    if ($alert_state == '0') {
        $fa_icon = 'check';
        $fa_color = 'success';
        $text = 'Ok';
    } elseif ($alert_state == '1') {
        $fa_icon = 'times';
        $fa_color = 'danger';
        $text = 'Alert';
    } elseif ($alert_state == '2') {
        $fa_icon = 'info-circle';
        $fa_color = 'muted';
        $text = 'Ack';
    } elseif ($alert_state == '3') {
        $fa_icon = 'arrow-down';
        $fa_color = 'warning';
        $text = 'Worse';
    } elseif ($alert_state == '4') {
        $fa_icon = 'arrow-up';
        $fa_color = 'info';
        $text = 'Better';
    }
    //end if
    $response[] = array('id' => $rulei++, 'time_logged' => $alertlog['humandate'], 'details' => '<a class="fa fa-plus incident-toggle" style="display:none" data-toggle="collapse" data-target="#incident' . $rulei . '" data-parent="#alerts"></a>', 'hostname' => '<div class="incident">' . generate_device_link($dev, shorthost($dev['hostname'])) . '<div id="incident' . $rulei . '" class="collapse">' . $fault_detail . '</div></div>', 'alert' => htmlspecialchars($alertlog['alert']), 'status' => "<b><i class='fa fa-" . $fa_icon . " text-" . $fa_color . "'></i> {$text}</b>");
}
//end foreach
$output = array('current' => $current, 'rowCount' => $rowCount, 'rows' => $response, 'total' => $total);
echo _json_encode($output);
开发者ID:awlx,项目名称:librenms,代码行数:31,代码来源:alertlog.inc.php

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

示例6: unset

            }
            if ($int_links_v4[$int_link]) {
                echo " <b style='color: #00a100'>v4</b>";
            }
            $br = "<br />";
        }
    }
    #     unset($int_links, $int_links_v6, $int_links_v4, $int_links_phys, $br);
}
if ($port_details && $config['enable_port_relationship'] === TRUE) {
    foreach (dbFetchRows("SELECT * FROM `pseudowires` WHERE `port_id` = ?", array($port['port_id'])) as $pseudowire) {
        #`port_id`,`peer_device_id`,`peer_ldp_id`,`cpwVcID`,`cpwOid`
        $pw_peer_dev = dbFetchRow("SELECT * FROM `devices` WHERE `device_id` = ?", array($pseudowire['peer_device_id']));
        $pw_peer_int = dbFetchRow("SELECT * FROM `ports` AS I, pseudowires AS P WHERE I.device_id = ? AND P.cpwVcID = ? AND P.port_id = I.port_id", array($pseudowire['peer_device_id'], $pseudowire['cpwVcID']));
        $pw_peer_int = ifNameDescr($pw_peer_int);
        echo "{$br}<img src='images/16/arrow_switch.png' align=absmiddle><b> " . generate_port_link($pw_peer_int, makeshortif($pw_peer_int['label'])) . " on " . generate_device_link($pw_peer_dev, shorthost($pw_peer_dev['hostname'])) . "</b>";
        $br = "<br />";
    }
    foreach (dbFetchRows("SELECT * FROM `ports` WHERE `pagpGroupIfIndex` = ? and `device_id` = ?", array($port['ifIndex'], $device['device_id'])) as $member) {
        echo "{$br}<img src='images/16/brick_link.png' align=absmiddle> <strong>" . generate_port_link($member) . " (PAgP)</strong>";
        $br = "<br />";
    }
    if ($port['pagpGroupIfIndex'] && $port['pagpGroupIfIndex'] != $port['ifIndex']) {
        $parent = dbFetchRow("SELECT * FROM `ports` WHERE `ifIndex` = ? and `device_id` = ?", array($port['pagpGroupIfIndex'], $device['device_id']));
        echo "{$br}<img src='images/16/bricks.png' align=absmiddle> <strong>" . generate_port_link($parent) . " (PAgP)</strong>";
        $br = "<br />";
    }
    foreach (dbFetchRows("SELECT * FROM `ports_stack` WHERE `port_id_low` = ? and `device_id` = ?", array($port['ifIndex'], $device['device_id'])) as $higher_if) {
        if ($higher_if['port_id_high']) {
            $this_port = get_port_by_index_cache($device['device_id'], $higher_if['port_id_high']);
            echo "{$br}<img src='images/16/arrow_divide.png' align=absmiddle> <strong>" . generate_port_link($this_port) . "</strong>";
开发者ID:REAP720801,项目名称:librenms,代码行数:31,代码来源:print-interface.inc.php

示例7: sum

<?php

/*
 * LibreNMS front page top devices graph
 * - Find most utilised devices that have been polled in the last N minutes
 *
 * Author: Paul Gear
 * Copyright (c) 2013 Gear Consulting Pty Ltd <http://libertysys.com.au/>
 *
 * This program is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or (at your
 * option) any later version.  Please see LICENSE.txt at the top level of
 * the source code distribution for details.
 */
$minutes = 15;
$seconds = $minutes * 60;
$top = $config['front_page_settings']['top']['devices'];
if (is_admin() === true || is_read() === true) {
    $query = "\n        SELECT *, sum(p.ifInOctets_rate + p.ifOutOctets_rate) as total\n        FROM ports as p, devices as d\n        WHERE d.device_id = p.device_id\n        AND unix_timestamp() - p.poll_time < {$seconds}\n        AND ( p.ifInOctets_rate > 0\n        OR p.ifOutOctets_rate > 0 )\n        GROUP BY d.device_id\n        ORDER BY total desc\n        LIMIT {$top}\n        ";
} else {
    $query = "\n        SELECT *, sum(p.ifInOctets_rate + p.ifOutOctets_rate) as total\n        FROM ports as p, devices as d, `devices_perms` AS `P`\n        WHERE `P`.`user_id` = ? AND `P`.`device_id` = `d`.`device_id` AND\n        d.device_id = p.device_id\n        AND unix_timestamp() - p.poll_time < {$seconds}\n        AND ( p.ifInOctets_rate > 0\n        OR p.ifOutOctets_rate > 0 )\n        GROUP BY d.device_id\n        ORDER BY total desc\n        LIMIT {$top}\n        ";
    $param[] = array($_SESSION['user_id']);
}
//end if
echo "<strong>Top {$top} devices (last {$minutes} minutes)</strong>\n";
echo "<table class='simple'>\n";
foreach (dbFetchRows($query, $param) as $result) {
    echo '<tr class=top10>' . '<td class=top10>' . generate_device_link($result, shorthost($result['hostname'])) . '</td>' . '<td class=top10>' . generate_device_link($result, generate_minigraph_image($result, $config['time']['day'], $config['time']['now'], 'device_bits', 'no', 150, 21, '&', 'top10'), array(), 0, 0, 0) . '</td>' . "</tr>\n";
}
echo "</table>\n";
开发者ID:awlx,项目名称:librenms,代码行数:31,代码来源:top_device_bits.inc.php

示例8: array_merge

    $sql = 'FROM syslog AS S';
    $sql .= ' WHERE ' . $where;
} else {
    $sql = 'FROM syslog AS S, devices_perms AS P ';
    $sql .= 'WHERE S.device_id = P.device_id AND P.user_id = ? AND ';
    $sql .= $where;
    $param = array_merge(array($_SESSION['user_id']), $param);
}
$count_sql = "SELECT COUNT(timestamp) {$sql}";
$total = dbFetchCell($count_sql, $param);
if (empty($total)) {
    $total = 0;
}
if (!isset($sort) || empty($sort)) {
    $sort = 'timestamp 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 S.*, DATE_FORMAT(timestamp, '" . $config['dateformat']['mysql']['compact'] . "') AS date {$sql}";
foreach (dbFetchRows($sql, $param) as $syslog) {
    $dev = device_by_id_cache($syslog['device_id']);
    $response[] = array('priority' => generate_priority_icon($syslog['priority']), 'timestamp' => '<div style="white-space:nowrap;">' . $syslog['date'] . '</div>', 'device_id' => generate_device_link($dev, shorthost($dev['hostname'])), 'program' => $syslog['program'], 'msg' => htmlspecialchars($syslog['msg']));
}
$output = array('current' => $current, 'rowCount' => $rowCount, 'rows' => $response, 'total' => $total);
echo _json_encode($output);
开发者ID:Tatermen,项目名称:librenms,代码行数:31,代码来源:syslog.inc.php

示例9: generate_url

                     <a href="' . generate_url(array('page' => 'device', 'tab' => 'services', 'device' => $service['device_id'])) . '" title="' . $service['hostname'] . " - " . $service['service_type'] . " - " . $service['service_desc'] . '">
                         <div class="service-availability ' . $serviceState . '" style="width:' . $config['webui']['availability_map_box_size'] . 'px;">
                             <span class="service-name-label label ' . $serviceLabel . ' label-font-border">' . $service["service_type"] . '</span>
                             <span class="availability-label label ' . $serviceLabel . ' label-font-border">' . $serviceState . '</span>
                             <span class="device-icon">' . $deviceIcon . '</span><br>
                             <span class="small">' . shorthost(ip_to_sysname($service, $service['hostname'])) . '</span>
                         </div>
                     </a>';
                 } else {
                     $serviceText = $service['service_type'] . ' - ' . $serviceState;
                     if ($widget_settings['color_only_select'] == 1) {
                         $serviceText = ' ';
                         $serviceLabel .= ' widget-availability-fixed';
                     }
                     $temp_output[] = '
                     <a href="' . generate_url(array('page' => 'device', 'tab' => 'services', 'device' => $service['device_id'])) . '" title="' . shorthost(ip_to_sysname($device, $device['hostname'])) . " - " . $service['service_type'] . " - " . $service['service_desc'] . '">
                         <span class="label ' . $serviceLabel . ' widget-availability label-font-border">' . $serviceText . '</span>
                     </a>';
                 }
             } else {
                 $temp_output[] = "<a href='" . generate_url(array('page' => 'device', 'tab' => 'services', 'device' => $service['device_id'])) . "' title='{$service['hostname']} - {$service['service_type']} - {$service['service_desc']}'><div class='" . $serviceLabelOld . "' style='width:{$compact_tile}px;height:{$compact_tile}px;'></div></a>";
             }
         }
     } else {
         $temp_output[] = '';
     }
 }
 if ($directpage == "yes") {
     $temp_header[] = '
     <div class="page-availability-title-left">
         <span class="page-availability-title">Availability map for</span>
开发者ID:Rosiak,项目名称:librenms,代码行数:31,代码来源:availability-map.inc.php

示例10: sum

<?php

/*
 * LibreNMS front page top devices graph
 * - Find most utilised devices that have been polled in the last N minutes
 *
 * Copyright (c) 2013 Gear Consulting Pty Ltd <http://libertysys.com.au/>
 *
 * This program is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or (at your
 * option) any later version.  Please see LICENSE.txt at the top level of
 * the source code distribution for details.
 */
$minutes = 15;
$seconds = $minutes * 60;
$top = $config['front_page_settings']['top']['devices'];
$query = "\n  SELECT *, sum(p.ifInOctets_rate + p.ifOutOctets_rate) as total\n  FROM ports as p, devices as d\n  WHERE d.device_id = p.device_id\n    AND unix_timestamp() - p.poll_time < {$seconds}\n    AND ( p.ifInOctets_rate > 0\n    OR p.ifOutOctets_rate > 0 )\n  GROUP BY d.device_id\n  ORDER BY total desc\n  LIMIT {$top}\n";
echo "<strong>Top {$top} devices (last {$minutes} minutes)</strong>\n";
echo "<table class='simple'>\n";
foreach (dbFetchRows($query) as $result) {
    echo "<tr class=top10>" . "<td class=top10>" . generate_device_link($result, shorthost($result['hostname'])) . "</td>" . "<td class=top10>" . generate_device_link($result, generate_minigraph_image($result, $config['time']['day'], $config['time']['now'], "device_bits", "no", 150, 21, '&', "top10"), array(), 0, 0, 0) . "</td>" . "</tr>\n";
}
echo "</table>\n";
开发者ID:CumulusNetworks,项目名称:cldemo-archive,代码行数:24,代码来源:top_device_bits.inc.php

示例11: get_port_by_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 = @$port['ifDescr'];
//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;
    //Refresh time Interval
}
$fetch_link = "data.php?id=" . $_GET['id'];
开发者ID:RomanBogachev,项目名称:observium,代码行数:31,代码来源:graph-realtime.php

示例12: nicecase

<?php

$graph_array['height'] = "100";
$graph_array['width'] = "220";
$graph_array['to'] = $config['time']['now'];
$graph_array['from'] = $config['time']['day'];
$graph_array_zoom = $graph_array;
$graph_array_zoom['height'] = "150";
$graph_array_zoom['width'] = "400";
$graph_array['legend'] = "no";
echo '<h2>' . nicecase($vars['app']) . '</h2>';
echo '<table cellpadding=5 cellspacing=0 class=devicetable width=100%>';
$app_devices = dbFetchRows("SELECT * FROM `devices` AS D, `applications` AS A WHERE D.device_id = A.device_id AND A.app_type = ?", array($vars['app']));
foreach ($app_devices as $app_device) {
    echo '<tr class="list-device">';
    echo '<td class="device-head" width=300px>' . generate_device_link($app_device, shorthost($app_device['hostname']), array('tab' => 'apps', 'app' => $vars['app'])) . '</td>';
    echo '<td class="device-head" width=100px>' . $app_device['app_instance'] . '</td>';
    echo '<td class="device-head" width=100px>' . $app_device['app_status'] . '</td>';
    echo '<td></td>';
    echo '</tr>';
    echo '<tr class="list-device">';
    echo '<td colspan=4>';
    foreach ($graphs[$vars['app']] as $graph_type) {
        $graph_array['type'] = "application_" . $vars['app'] . "_" . $graph_type;
        $graph_array['id'] = $app_device['app_id'];
        $graph_array_zoom['type'] = "application_" . $vars['app'] . "_" . $graph_type;
        $graph_array_zoom['id'] = $app_device['app_id'];
        $link = generate_url(array('page' => 'device', 'device' => $app_device['device_id'], 'tab' => 'apps', 'app' => $vars['app']));
        echo overlib_link($link, generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL);
    }
    echo '</td>';
开发者ID:REAP720801,项目名称:librenms,代码行数:31,代码来源:default.inc.php

示例13: gethostbyid

<?php

$hostname = gethostbyid($alert_entry['device_id']);
$alert_state = $alert_entry['state'];
echo '<tr>
  <td>
    ' . $alert_entry['time_logged'] . '
  </td>';
if (!isset($alert_entry['device'])) {
    $dev = device_by_id_cache($alert_entry['device_id']);
    echo "<td>\n    " . generate_device_link($dev, shorthost($dev['hostname'])) . "\n  </td>";
}
echo "<td>" . htmlspecialchars($alert_entry['name']) . "</td>";
if ($alert_state != '') {
    if ($alert_state == '0') {
        $glyph_icon = 'ok';
        $glyph_color = 'green';
        $text = 'Ok';
    } elseif ($alert_state == '1') {
        $glyph_icon = 'remove';
        $glyph_color = 'red';
        $text = 'Alert';
    } elseif ($alert_state == '2') {
        $glyph_icon = 'info-sign';
        $glyph_color = 'lightgrey';
        $text = 'Ack';
    } elseif ($alert_state == '3') {
        $glyph_icon = 'arrow-down';
        $glyph_color = 'orange';
        $text = 'Worse';
    } elseif ($alert_state == '4') {
开发者ID:job,项目名称:librenms,代码行数:31,代码来源:print-alerts.inc.php

示例14: array

    } else {
        if ($alert_state == '1') {
            $glyph_icon = 'remove';
            $glyph_color = 'red';
            $text = 'Alert';
        } else {
            if ($alert_state == '2') {
                $glyph_icon = 'info-sign';
                $glyph_color = 'lightgrey';
                $text = 'Ack';
            } else {
                if ($alert_state == '3') {
                    $glyph_icon = 'arrow-down';
                    $glyph_color = 'orange';
                    $text = 'Worse';
                } else {
                    if ($alert_state == '4') {
                        $glyph_icon = 'arrow-up';
                        $glyph_color = 'khaki';
                        $text = 'Better';
                    }
                }
            }
        }
    }
    //end if
    $response[] = array('id' => $rulei++, 'time_logged' => $alertlog['humandate'], 'details' => '<a class="glyphicon glyphicon-plus incident-toggle" style="display:none" data-toggle="collapse" data-target="#incident' . $rulei . '" data-parent="#alerts"></a>', 'hostname' => '<div class="incident">' . generate_device_link($dev, shorthost($dev['hostname'])) . '<div id="incident' . $rulei . '" class="collapse">' . $fault_detail . '</div></div>', 'alert' => $alertlog['alert'], 'status' => "<b><span class='glyphicon glyphicon-" . $glyph_icon . "' style='color:" . $glyph_color . "'></span> {$text}</b>");
}
//end foreach
$output = array('current' => $current, 'rowCount' => $rowCount, 'rows' => $response, 'total' => $total);
echo _json_encode($output);
开发者ID:jmacul2,项目名称:librenms,代码行数:31,代码来源:alertlog.inc.php

示例15: mysql_query

}
if ($_SESSION['userlevel'] == '10') {
    $sql = mysql_query("SELECT * FROM `devices` AS D, bgpPeers AS B WHERE bgpPeerState != 'established' AND bgpPeerState != '' AND B.device_id = D.device_id AND D.ignore = 0");
} else {
    $sql = mysql_query("SELECT * FROM `devices` AS D, bgpPeers AS B, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' AND bgpPeerState != 'established' AND bgpPeerState != '' AND B.device_id = D.device_id AND D.ignore = 0");
}
while ($peer = mysql_fetch_array($sql)) {
    generate_front_box("alert", "<center><strong>" . generatedevicelink($peer, shorthost($peer['hostname'])) . "</strong><br />\n      <span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>BGP Down</span> \n      <span style='" . (strstr($peer['bgpPeerIdentifier'], ':') ? 'font-size: 10px' : '') . "'><strong>" . $peer['bgpPeerIdentifier'] . "</strong></span><br />\n      <span title='" . $peer['astext'] . "' class=body-date-1>AS" . $peer['bgpPeerRemoteAs'] . " " . truncate($peer['astext'], 10) . "</span>\n      </center>");
}
if ($_SESSION['userlevel'] == '10') {
    $sql = mysql_query("SELECT * FROM `devices` AS D WHERE D.status = '1' AND D.uptime < '84600' AND D.ignore = 0");
} else {
    $sql = mysql_query("SELECT * FROM `devices` AS D, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' AND D.status = '1' AND D.uptime < '84600' AND D.ignore = 0");
}
while ($device = mysql_fetch_array($sql)) {
    generate_front_box("info", "<center><strong>" . generatedevicelink($device, shorthost($device['hostname'])) . "</strong><br />\n      <span style='font-size: 14px; font-weight: bold; margin: 5px; color: #009;'>Device<br />Rebooted</span><br />\n      <span class=body-date-1>" . formatUptime($device['uptime'], 'short') . "</span>\n      </center>");
}
if ($config['enable_syslog']) {
    ## Open Syslog Div
    echo "<div style='margin: 4px; clear: both; padding: 5px;'>  \n    <h3>Recent Syslog Messages</h3>\n  ";
    if ($_SESSION['userlevel'] == '10') {
        $sql = "SELECT *,DATE_FORMAT(timestamp, '%D %b %T') as date  FROM `syslog` ORDER BY `timestamp` DESC LIMIT 0,15";
    } else {
        $sql = "SELECT *,DATE_FORMAT(timestamp, '%D %b %T') as date  FROM `syslog` AS E, devices_perms AS P WHERE\n    E.device_id = P.device_id AND P.user_id = " . $_SESSION['user_id'] . " ORDER BY `timestamp` DESC LIMIT 0,15";
    }
    $query = mysql_query($sql);
    echo "<table cellspacing=0 cellpadding=2 width=100%>";
    while ($entry = mysql_fetch_array($query)) {
        $entry = array_merge($entry, device_by_id_cache($entry['device_id']));
        include "includes/print-syslog.inc";
    }
开发者ID:kyrisu,项目名称:observernms,代码行数:31,代码来源:default.php


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