예제 #1
0
if ($_SESSION['userlevel'] == '10') {
    $sql = mysql_query("SELECT * FROM `devices` WHERE `status` = '0' AND `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 = '0' AND D.ignore = '0'");
}
while ($device = mysql_fetch_array($sql)) {
    generate_front_box("alert", "<center><strong>" . generatedevicelink($device, shorthost($device['hostname'])) . "</strong><br />\n      <span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>Device Down</span> <br />\n      <span class=body-date-1>" . truncate($device['location'], 20) . "</span>\n      </center>");
}
if ($_SESSION['userlevel'] == '10') {
    $sql = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0'");
} else {
    $sql = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' AND  I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0'");
}
while ($interface = mysql_fetch_array($sql)) {
    $interface = ifNameDescr($interface);
    generate_front_box("warn", "<center><strong>" . generatedevicelink($interface, shorthost($interface['hostname'])) . "</strong><br />\n      <span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>Port Down</span><br />\n<!--      <img src='graph.php?type=bits&if=" . $interface['interface_id'] . "&from={$day}&to={$now}&width=100&height=32' /> -->\n      <strong>" . generateiflink($interface, truncate(makeshortif($interface['label']), 13, '')) . "</strong> <br />\n      " . ($interface['ifAlias'] ? '<span class="body-date-1">' . truncate($interface['ifAlias'], 20, '') . '</span>' : '') . "\n      </center>");
}
/* FIXME service permissions? seem nonexisting now.. */
$sql = mysql_query("SELECT * FROM `services` AS S, `devices` AS D WHERE S.device_id = D.device_id AND service_status = 'down' AND D.ignore = '0' AND S.service_ignore = '0'");
while ($service = mysql_fetch_array($sql)) {
    generate_front_box("alert", "<center><strong>" . generatedevicelink($service, shorthost($service['hostname'])) . "</strong><br />\n      <span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>Service Down</span> \n      <strong>" . $service['service_type'] . "</strong><br />\n      <span class=body-date-1>" . truncate($interface['ifAlias'], 20) . "</span>\n      </center>");
}
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') {
예제 #2
0
파일: demo.php 프로젝트: kyrisu/observernms
<table border=0 cellpadding=10 cellspacing=10 width=100%>
  <tr>
    <td bgcolor=#e5e5e5 valign=top>
<?php 
#      <table width=100% border=0><tr><td><div style="margin-bottom: 5px; font-size: 18px; font-weight: bold;">Devices with Alerts</div></td><td width=35 align=center><div class=tablehead>Host</div></td><td align=center width=35><div class=tablehead>Int</div></td><td align=center width=35><div class=tablehead>Srv</div></tr>
$sql = mysql_query("SELECT * FROM `devices` WHERE `status` = '0' AND `ignore` = '0'");
while ($device = mysql_fetch_array($sql)) {
    echo "<div style='border: solid 2px #d0D0D0; float: left; padding: 5px; width: 120px; height: 90px; background: #ffbbbb; margin: 4px;'>\n      <center><strong>" . generatedevicelink($device, shorthost($device['hostname'])) . "</strong><br />\n      <span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>Device Down</span><br /> \n      <span class=body-date-1>" . truncate($device['location'], 20) . "</span>\n      </center></div>";
}
$sql = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id AND D.status = '1' AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0'");
while ($interface = mysql_fetch_array($sql)) {
    echo "<div style='border: solid 2px #D0D0D0; float: left; padding: 5px; width: 120px; height: 90px; background: #ffddaa; margin: 4px;'>\n      <center><strong>" . generatedevicelink($interface, shorthost($interface['hostname'])) . "</strong><br />\n      <span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>Port Down</span> \n      <strong>" . generateiflink($interface, makeshortif($interface['ifDescr'])) . "</strong> <br />\n      <span class=body-date-1>" . truncate($interface['ifAlias'], 20) . "</span>\n      </center></div>";
}
$sql = mysql_query("SELECT * FROM `services` AS S, `devices` AS D WHERE S.device_id = D.device_id AND  D.status = '1' AND service_status = 'down' AND D.ignore = '0' AND S.service_ignore = '0'");
while ($service = mysql_fetch_array($sql)) {
    echo "<div style='border: solid 2px #D0D0D0; float: left; padding: 5px; width: 120px; height: 90px; background: #ffddaa; margin: 4px;'>\n      <center><strong>" . generatedevicelink($service, shorthost($service['hostname'])) . "</strong><br />\n      <span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>Service Down</span> \n      <strong>" . $service['service_type'] . "</strong><br />\n      <span class=body-date-1>" . truncate($interface['ifAlias'], 20) . "</span>\n      </center></div>";
}
$sql = mysql_query("SELECT * FROM `devices` AS D, bgpPeers AS B WHERE  D.status = '1' AND bgpPeerState != 'established' AND B.device_id = D.device_id");
while ($peer = mysql_fetch_array($sql)) {
    echo "<div style='border: solid 2px #d0D0D0; float: left; padding: 5px; width: 120px; height: 90px; background: #ffddaa; margin: 4px;'>\n      <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      <strong>" . $peer['bgpPeerIdentifier'] . "</strong> <br />\n      <span class=body-date-1>AS" . $peer['bgpPeerRemoteAs'] . " " . truncate($peer['astext'], 10) . "</span>\n      </center></div>";
}
$sql = mysql_query("SELECT * FROM `devices` WHERE status = '1' AND `uptime` < '84600'");
while ($device = mysql_fetch_array($sql)) {
    echo "<div style='border: solid 2px #d0D0D0; float: left; padding: 5px; width: 120px; height: 90px; background: #ddffdd; margin: 4px;'>\n      <center><strong>" . generatedevicelink($device, shorthost($device['hostname'])) . "</strong><br />\n      <span style='font-size: 14px; font-weight: bold; margin: 5px; color: #090;'>Device<br />Rebooted</span><br /> \n      <span class=body-date-1>" . formatUptime($device['uptime']) . "</span>\n      </center></div>";
}
echo "\n\n\t<div style='clear: both;'>{$errorboxes}</div> <div style='margin: 4px; clear: both;'>  \n\n<h3>Recent Syslog Messages</h3>\n\n";
$sql = "SELECT *, DATE_FORMAT(timestamp, '%D %b %T') AS date from syslog AS S, devices AS D \n        WHERE S.device_id = D.device_id ORDER BY timestamp DESC LIMIT 20";
$query = mysql_query($sql);
echo "<table cellspacing=0 cellpadding=2 width=100%>";
while ($entry = mysql_fetch_array($query)) {
예제 #3
0
while ($pseudowire = mysql_fetch_array($pseudowires)) {
    #`interface_id`,`peer_device_id`,`peer_ldp_id`,`cpwVcID`,`cpwOid`
    $pw_peer_dev = mysql_fetch_array(mysql_query("SELECT * from `devices` WHERE `device_id` = '" . $pseudowire['peer_device_id'] . "'"));
    $pw_peer_int = mysql_fetch_array(mysql_query("SELECT * from `ports` AS I, pseudowires AS P WHERE I.device_id = '" . $pseudowire['peer_device_id'] . "' AND\n                                                                                                          P.cpwVcID = '" . $pseudowire['cpwVcID'] . "' AND\n                                                                                                          P.interface_id = I.interface_id"));
    $pw_peer_int = ifNameDescr($pw_peer_int);
    echo "{$br}<img src='images/16/arrow_switch.png' align=absmiddle><b> " . generateiflink($pw_peer_int, makeshortif($pw_peer_int['label'])) . " on " . generatedevicelink($pw_peer_dev, shorthost($pw_peer_dev['hostname'])) . "</b>";
    $br = "<br />";
}
$members = mysql_query("SELECT * FROM `ports` WHERE `pagpGroupIfIndex` = '" . $interface['ifIndex'] . "' and `device_id` = '" . $device['device_id'] . "'");
while ($member = mysql_fetch_array($members)) {
    echo "{$br}<img src='images/16/brick_link.png' align=absmiddle> <strong>" . generateiflink($member) . " (PAgP)</strong>";
    $br = "<br />";
}
if ($interface['pagpGroupIfIndex'] && $interface['pagpGroupIfIndex'] != $interface['ifIndex']) {
    $parent = mysql_fetch_array(mysql_query("SELECT * FROM `ports` WHERE `ifIndex` = '" . $interface['pagpGroupIfIndex'] . "' and `device_id` = '" . $device['device_id'] . "'"));
    echo "{$br}<img src='images/16/bricks.png' align=absmiddle> <strong>" . generateiflink($parent) . " (PAgP)</strong>";
    $br = "<br />";
}
unset($int_links, $int_links_v6, $int_links_v4, $int_links_phys, $br);
echo "</td></tr>";
// If we're showing graphs, generate the graph and print the img tags
if ($graph_type == "etherlike") {
    $graph_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/etherlike-" . safename($interface['ifIndex']) . ".rrd";
} else {
    $graph_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename($interface['ifIndex']) . ".rrd";
}
if ($graph_type && is_file($graph_file)) {
    $type = $graph_type;
    $daily_traffic = "graph.php?port={$if_id}&type=" . $graph_type . "&from={$day}&to={$now}&width=210&height=100";
    $daily_url = "graph.php?port={$if_id}&type=" . $graph_type . "&from={$day}&to={$now}&width=500&height=150";
    $weekly_traffic = "graph.php?port={$if_id}&type=" . $graph_type . "&from={$week}&to={$now}&width=210&height=100";
예제 #4
0
    $graph_array['from'] = $week;
    $content .= generate_graph_tag($graph_array);
    $graph_array['from'] = $month;
    $content .= generate_graph_tag($graph_array);
    $graph_array['from'] = $year;
    $content .= generate_graph_tag($graph_array);
    $content .= "</div>";
    echo overlib_link($_SERVER['REQUEST_URI'], $graph, $content, NULL);
    echo '  <div style="height: 5px;"></div>';
    echo '  <table class="tablehead" cellpadding="2" cellspacing="0" width="100%">
    <tr bgcolor="' . $ports_colour . '" align="center"><td></td>
      <td width="25%"><img src="images/16/connect.png" align="absmiddle"> ' . $ports['total'] . '</td>
      <td width="25%" class="green"><img src="images/16/if-connect.png" align="absmiddle"> ' . $ports['up'] . '</td>
      <td width="25%" class="red"><img src="images/16/if-disconnect.png" align="absmiddle"> ' . $ports['down'] . '</td>
      <td width="25%" class="grey"><img src="images/16/if-disable.png" align="absmiddle"> ' . $ports['disabled'] . '</td>
    </tr>
  </table>';
    echo '  <div style="margin: 8px; font-size: 11px; font-weight: bold;">';
    $sql = "SELECT * FROM ports WHERE `device_id` = '" . $device['device_id'] . "' AND deleted != '1'";
    $query = mysql_query($sql);
    $ifsep = "";
    while ($data = mysql_fetch_array($query)) {
        $data = ifNameDescr($data);
        $data['hostname'] = $device['hostname'];
        echo "{$ifsep}" . generateiflink($data, makeshortif(strtolower($data['label'])));
        $ifsep = ", ";
    }
    unset($ifsep);
    echo "  </div>";
    echo "</div>";
}
예제 #5
0
파일: ipv4.php 프로젝트: kyrisu/observernms
        }
        if (!match_network($addy . "/" . $mask, $interface['ipv4_address'])) {
            $ignore = 1;
        }
    }
    if (!$ignore) {
        if (is_integer($row / 2)) {
            $row_colour = $list_colour_a;
        } else {
            $row_colour = $list_colour_b;
        }
        $speed = humanspeed($interface['ifSpeed']);
        $type = humanmedia($interface['ifType']);
        list($prefix, $length) = explode("/", $interface['ipv4_network']);
        if ($interface['in_errors'] > 0 || $interface['out_errors'] > 0) {
            $error_img = generateiflink($interface, "<img src='images/16/chart_curve_error.png' alt='Interface Errors' border=0>", errors);
        } else {
            $error_img = "";
        }
        if (interfacepermitted($interface['interface_id'])) {
            echo '<tr bgcolor="' . $row_colour . '">
          <td class="list-bold">' . generatedevicelink($interface) . '</td>
          <td class="list-bold">' . generateiflink($interface, makeshortif(fixifname($interface['ifDescr']))) . ' ' . $error_img . '</td>
          <td>' . $interface['ipv4_address'] . '/' . $length . '</td>
          <td>' . $interface['ifAlias'] . "</td>\n        </tr>\n";
            $row++;
        }
    }
    unset($ignore);
}
echo "</table>";
예제 #6
0
    $where .= " AND I.ifAlias LIKE '%" . $_POST['ifAlias'] . "%'";
}
if ($_POST['deleted'] || $_GET['type'] == "deleted") {
    $where .= " AND I.deleted = '1'";
}
$sql = "SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id {$where} ORDER BY D.hostname, I.ifIndex";
$query = mysql_query($sql);
echo "<tr class=tablehead><td></td><th>Device</a></th><th>Interface</th><th>Speed</th><th>Media</th><th>Description</th></tr>";
$row = 1;
while ($interface = mysql_fetch_array($query)) {
    if (is_integer($row / 2)) {
        $row_colour = $list_colour_a;
    } else {
        $row_colour = $list_colour_b;
    }
    $speed = humanspeed($interface['ifSpeed']);
    $type = humanmedia($interface['ifType']);
    if ($interface['in_errors'] > 0 || $interface['out_errors'] > 0) {
        $error_img = generateiflink($interface, "<img src='images/16/chart_curve_error.png' alt='Interface Errors' border=0>", errors);
    } else {
        $error_img = "";
    }
    if (interfacepermitted($interface['interface_id'])) {
        echo "<tr bgcolor={$row_colour}>\n          <td width=5></td>\n          <td width=200 class=list-bold>" . generatedevicelink($interface) . "</td>\n          <td width=150 class=list-bold>" . generateiflink($interface, makeshortif(fixifname($interface['ifDescr']))) . " {$error_img}</td>\n          <td width=110 >{$speed}</td>\n          <td width=200>{$type}</td>\n          <td>" . $interface['ifAlias'] . "</td>\n        </tr>\n";
        $row++;
    }
}
echo "</table>";
?>

예제 #7
0
include "includes/print-interface-graphs.inc.php";
echo "</td></tr>";
$sql = "select * from ports as I, devices as D WHERE {$type_where} AND I.device_id = D.device_id ORDER BY I.ifAlias";
$query = mysql_query($sql);
while ($interface = mysql_fetch_array($query)) {
    $done = "yes";
    unset($class);
    $interface['ifAlias'] = str_ireplace($type . ": ", "", $interface['ifAlias']);
    $interface['ifAlias'] = str_ireplace("[PNI]", "Private", $interface['ifAlias']);
    $ifclass = ifclass($interface['ifOperStatus'], $interface['ifAdminStatus']);
    if ($bg == "#ffffff") {
        $bg = "#e5e5e5";
    } else {
        $bg = "#ffffff";
    }
    echo "<tr bgcolor='{$bg}'>\n             <td><span class=list-large>" . generateiflink($interface, $interface['ifAlias']) . "</span><br /> \n            <span class=interface-desc style='float: left;'>" . generatedevicelink($interface) . " " . generateiflink($interface) . " </span>";
    if (mysql_result(mysql_query("SELECT count(*) FROM mac_accounting WHERE interface_id = '" . $interface['interface_id'] . "'"), 0)) {
        echo "<span style='float: right;'><a href='" . $config['base_url'] . "/device/" . $interface['device_id'] . "/interface/" . $interface['interface_id'] . "/macaccounting/'><img src='/images/16/chart_curve.png' align='absmiddle'> MAC Accounting</a></span>";
    }
    echo "</td></tr><tr bgcolor='{$bg}'><td>";
    if (file_exists($config['rrd_dir'] . "/" . $interface['hostname'] . "/" . $interface['ifIndex'] . ".rrd")) {
        $graph_type = "port_bits";
        include "includes/print-interface-graphs.inc.php";
    }
    echo "</td></tr>";
}
#}
echo "</table>";
if (!$done) {
    echo "None found.";
}
예제 #8
0
파일: vrfs.php 프로젝트: kyrisu/observernms
            $ports = mysql_query("SELECT * FROM `ports` WHERE `ifVrf` = '" . $device['vrf_id'] . "' and device_id = '" . $device['device_id'] . "'");
            unset($seperator);
            while ($port = mysql_fetch_array($ports)) {
                $port = array_merge($device, $port);
                if ($_GET['opta']) {
                    $port['width'] = "130";
                    $port['height'] = "30";
                    $port['from'] = $day;
                    $port['to'] = $now;
                    $port['bg'] = "#" . $bg;
                    $port['graph_type'] = $_GET['opta'];
                    echo "<div style='display: block; padding: 3px; margin: 3px; min-width: 135px; max-width:135px; min-height:75px; max-height:75px;\n             text-align: center; float: left; background-color: " . $list_colour_b_b . ";'>\n             <div style='font-weight: bold;'>" . makeshortif($port['ifDescr']) . "</div>";
                    generate_port_thumbnail($port);
                    echo "<div style='font-size: 9px;'>" . truncate(short_port_descr($port['ifAlias']), 22, '') . "</div>\n            </div>";
                } else {
                    echo $seperator . generateiflink($port, makeshortif($port['ifDescr']));
                    $seperator = ", ";
                }
            }
            echo "</td></tr>";
            $x++;
        }
        // End While
        echo "</table></td>";
        $i++;
    }
    echo "</table></div>";
} else {
    include "includes/error-no-perm.inc.php";
}
## End Permission if
예제 #9
0
파일: ipv6.php 프로젝트: kyrisu/observernms
        if (!$mask) {
            $mask = "128";
        }
        if (!Net_IPv6::isInNetmask($interface['ipv6_address'], $addy, $mask)) {
            $ignore = 1;
        } else {
            $ignore = 0;
        }
    }
    if (!$ignore) {
        if (is_integer($row / 2)) {
            $row_colour = $list_colour_a;
        } else {
            $row_colour = $list_colour_b;
        }
        $speed = humanspeed($interface['ifSpeed']);
        $type = humanmedia($interface['ifType']);
        list($prefix, $length) = explode("/", $interface['ipv6_network']);
        if ($interface['in_errors'] > 0 || $interface['out_errors'] > 0) {
            $error_img = generateiflink($interface, "<img src='images/16/chart_curve_error.png' alt='Interface Errors' border=0>", errors);
        } else {
            $error_img = "";
        }
        if (interfacepermitted($interface['interface_id'])) {
            echo "<tr bgcolor={$row_colour}><td></td>\n          <td class=list-bold>" . generatedevicelink($interface) . "</td>\n          <td class=list-bold>" . generateiflink($interface, makeshortif(fixifname($interface['ifDescr']))) . " {$error_img}</td>\n          <td>" . Net_IPv6::compress($interface['ipv6_address']) . "/" . $length . "</td>\n          <td>" . $interface['ifAlias'] . "</td>\n        </tr>\n";
            $row++;
        }
    }
    unset($ignore);
}
echo "</table>";
예제 #10
0
$sql = "SELECT * FROM ipv4_mac AS M, ports AS I WHERE I.interface_id = M.interface_id AND I.device_id = '" . $device['device_id'] . "'";
$query = mysql_query($sql);
echo "<table border=0 cellspacing=0 cellpadding=5 width=100%>";
$i = "1";
while ($arp = mysql_fetch_array($query)) {
    if (!is_integer($i / 2)) {
        $bg_colour = $list_colour_a;
    } else {
        $bg_colour = $list_colour_b;
    }
    $arp_host = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = '" . $arp['ipv4_address'] . "' AND I.interface_id = A.interface_id AND D.device_id = I.device_id"));
    if ($arp_host) {
        $arp_name = generatedevicelink($arp_host);
    } else {
        unset($arp_name);
    }
    if ($arp_host) {
        $arp_if = generateiflink($arp_host);
    } else {
        unset($arp_if);
    }
    if ($arp_host['device_id'] == $device['device_id']) {
        $arp_name = "Localhost";
    }
    if ($arp_host['interface_id'] == $arp['interface_id']) {
        $arp_if = "Local Port";
    }
    echo "\n  <tr bgcolor={$bg_colour}>\n    <td width=200><b>" . generateiflink(array_merge($arp, $device)) . "</b></td>\n    <td width=160>" . formatmac($arp['mac_address']) . "</td>\n    <td width=140>" . $arp['ipv4_address'] . "</td>\n    <td width=200>{$arp_name}</td>\n    <td>{$arp_if}</td>\n  </tr>";
    $i++;
}
echo "</table>";
예제 #11
0
echo "<table width=100%>";
$hrdevices = mysql_query("SELECT * FROM `hrDevice` WHERE `device_id` = '" . $device['device_id'] . "'");
while ($hrdevice = mysql_fetch_array($hrdevices)) {
    echo "<tr><td>" . $hrdevice['hrDeviceIndex'] . "</td>";
    if ($hrdevice['hrDeviceType'] == "hrDeviceProcessor") {
        $proc_id = mysql_result(mysql_query("SELECT processor_id FROM processors WHERE device_id = '" . $device['device_id'] . "' AND hrDeviceIndex = '" . $hrdevice['hrDeviceIndex'] . "'"), 0);
        $proc_url = $config['base_url'] . "/device/" . $device['device_id'] . "/health/processors/";
        $proc_popup = "onmouseover=\"return overlib('<div class=list-large>" . $device['hostname'] . " - " . $hrdevice['hrDeviceDescr'];
        $proc_popup .= "</div><img src=\\'" . $config['base_url'] . "/graph.php?id=" . $proc_id . "&type=processor&from={$month}&to={$now}&width=400&height=125\\'>";
        $proc_popup .= "', RIGHT" . $config['overlib_defaults'] . ");\" onmouseout=\"return nd();\"";
        echo "<td><a href='{$proc_url}' {$proc_popup}>" . $hrdevice['hrDeviceDescr'] . "</a></td>";
    } elseif ($hrdevice['hrDeviceType'] == "hrDeviceNetwork") {
        $int = str_replace("network interface ", "", $hrdevice['hrDeviceDescr']);
        $interface = mysql_fetch_array(mysql_query("SELECT * FROM ports WHERE device_id = '" . $device['device_id'] . "' AND ifDescr = '" . $int . "'"));
        if ($interface['ifIndex']) {
            echo "<td>" . generateiflink($interface) . "</td>";
        } else {
            echo "<td>" . $hrdevice['hrDeviceDescr'] . "</td>";
        }
    } else {
        echo "<td>" . $hrdevice['hrDeviceDescr'] . "</td>";
    }
    echo "<td>" . $hrdevice['hrDeviceType'] . "</td><td>" . $hrdevice['hrDeviceStatus'] . "</td>";
    echo "<td>" . $hrdevice['hrDeviceErrors'] . "</td><td>" . $hrdevice['hrProcessorLoad'] . "</td>";
    echo "</tr>";
}
echo "</table>";
?>

예제 #12
0
<?php

global $config;
if (!$graph_type) {
    $graph_type = "pagp_bits";
}
$daily_traffic = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type={$graph_type}&from={$day}&to={$now}&width=215&height=100";
$daily_url = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type={$graph_type}&from={$day}&to={$now}&width=500&height=150";
$weekly_traffic = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type={$graph_type}&from={$week}&to={$now}&width=215&height=100";
$weekly_url = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type={$graph_type}&from={$week}&to={$now}&width=500&height=150";
$monthly_traffic = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type={$graph_type}&from={$month}&to={$now}&width=215&height=100";
$monthly_url = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type={$graph_type}&from={$month}&to={$now}&width=500&height=150";
$yearly_traffic = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type={$graph_type}&from={$year}&to={$now}&width=215&height=100";
$yearly_url = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type={$graph_type}&from={$year}&to={$now}&width=500&height=150";
echo "<a href='/device/" . $device['device_id'] . "/interface/" . $interface['interface_id'] . "/' onmouseover=\"return overlib('<img src=\\'{$daily_url}\\'>', LEFT" . $config['overlib_defaults'] . ");\" onmouseout=\"return nd();\">\n        <img src='{$daily_traffic}' border=0></a> ";
echo "<a href='/device/" . $device['device_id'] . "/interface/" . $interface['interface_id'] . "/' onmouseover=\"return overlib('<img src=\\'{$weekly_url}\\'>', LEFT" . $config['overlib_defaults'] . ");\" onmouseout=\"return nd();\">\n        <img src='{$weekly_traffic}' border=0></a> ";
echo "<a href='/device/" . $device['device_id'] . "/interface/" . $interface['interface_id'] . "/' onmouseover=\"return overlib('<img src=\\'{$monthly_url}\\'>', LEFT" . $config['overlib_defaults'] . ", WIDTH, 350);\" onmouseout=\"return nd();\">\n        <img src='{$monthly_traffic}' border=0></a> ";
echo "<a href='/device/" . $device['device_id'] . "/interface/" . $interface['interface_id'] . "/' onmouseover=\"return overlib('<img src=\\'{$yearly_url}\\'>', LEFT" . $config['overlib_defaults'] . ", WIDTH, 350);\" onmouseout=\"return nd();\">\n        <img src='{$yearly_traffic}' border=0></a>";
$members = mysql_query("SELECT * FROM `ports` WHERE `pagpGroupIfIndex` = '" . $interface['ifIndex'] . "' and `device_id` = '" . $device['device_id'] . "'");
while ($member = mysql_fetch_array($members)) {
    echo "{$br}<img src='images/16/brick_link.png' align=absmiddle> <strong>" . generateiflink($member) . " (PAgP)</strong>";
    $br = "<br />";
}
예제 #13
0
    list(, $customer) = preg_split("/[\\:\\[\\]\\{\\}\\(\\)]/", $interface['ifAlias']);
    list(, $circuit) = preg_split("/[\\{\\}]/", $interface['ifAlias']);
    list(, $notes) = preg_split("/[\\(\\)]/", $interface['ifAlias']);
    list(, $speed) = preg_split("/[\\[\\]]/", $interface['ifAlias']);
    $customer = trim($customer);
    if ($customer == $prev_customer) {
        unset($customer);
    } else {
        if (isset($prev_customer)) {
            echo "<tr bgcolor='{$bg_colour}'><td></td><td colspan=6>\n       <img src='" . $config['base_url'] . "/graph.php?cust=" . rawurlencode($prev_customer) . "&type=customer_bits&from={$day}&to={$now}&width=215&height=100'>\n       <img src='" . $config['base_url'] . "/graph.php?cust=" . rawurlencode($prev_customer) . "&type=customer_bits&from={$week}&to={$now}&width=215&height=100'>\n       <img src='" . $config['base_url'] . "/graph.php?cust=" . rawurlencode($prev_customer) . "&type=customer_bits&from={$month}&to={$now}&width=215&height=100'>\n       <img src='" . $config['base_url'] . "/graph.php?cust=" . rawurlencode($prev_customer) . "&type=customer_bits&from={$year}&to={$now}&width=215&height=100'>\n       </td></tr>";
        }
        if (is_integer($customers / 2)) {
            $bg_colour = $list_colour_a;
        } else {
            $bg_colour = $list_colour_b;
        }
        $customers++;
        $prev_customer = $customer;
    }
    if ($device['os'] == "ios") {
        if ($interface['ifTrunk']) {
            $vlan = "<span class=box-desc><span class=red>" . $interface['ifTrunk'] . "</span></span>";
        } elseif ($interface['ifVlan']) {
            $vlan = "<span class=box-desc><span class=blue>VLAN " . $interface['ifVlan'] . "</span></span>";
        } else {
            $vlan = "";
        }
    }
    echo "\n           <tr bgcolor='{$bg_colour}'>\n             <td width='7'></td>\n             <td width='250'><span style='font-weight: bold;' class=interface>{$customer}</span></td>\n             <td width='150'>" . generatedevicelink($device) . "</td>\n             <td width='100'>" . generateiflink($interface, makeshortif($interface['ifDescr'])) . "</td>\n             <td width='100'>{$speed}</td>\n             <td width='100'>{$circuit}</td>\n             <td>{$notes}</td>\n           </tr>\n         ";
}
echo "</table>";
예제 #14
0
function printEntPhysical($ent, $level, $class)
{
    global $device;
    $query = mysql_query("SELECT * FROM `entPhysical` WHERE device_id = '" . $_GET['id'] . "' AND entPhysicalContainedIn = '" . $ent . "' ORDER BY entPhysicalContainedIn,entPhysicalIndex");
    while ($ent = mysql_fetch_array($query)) {
        echo "\n    <li class='{$class}'>";
        if ($ent['entPhysicalClass'] == "chassis") {
            echo "<img src='images/16/server.png' style='vertical-align:middle'/> ";
        }
        if ($ent['entPhysicalClass'] == "module") {
            echo "<img src='images/16/drive.png' style='vertical-align:middle'/> ";
        }
        if ($ent['entPhysicalClass'] == "port") {
            echo "<img src='images/16/connect.png' style='vertical-align:middle'/> ";
        }
        if ($ent['entPhysicalClass'] == "container") {
            echo "<img src='images/16/box.png' style='vertical-align:middle'/> ";
        }
        if ($ent['entPhysicalClass'] == "sensor") {
            echo "<img src='images/16/contrast.png' style='vertical-align:middle'/> ";
            $link = " href='" . $config['base_url'] . "/device/" . $device['device_id'] . "/ciscosensors/" . $ent['entSensorType'] . "/' onmouseover=\"return overlib('<img src=\\'graph.php?host=49&type=cisco_entity_sensor&from=-2d&to=now&width=400&height=150&a=" . $ent['entPhysical_id'] . "\\'><img src=\\'graph.php?host=49&type=cisco_entity_sensor&from=-2w&to=now&width=400&height=150&a=" . $ent['entPhysical_id'] . "\\'>', LEFT,FGCOLOR,'#e5e5e5', BGCOLOR, '#c0c0c0', BORDER, 5, CELLPAD, 4, CAPCOLOR, '#050505');\" onmouseout=\"return nd();\"";
        } else {
            unset($link);
        }
        if ($ent['entPhysicalClass'] == "backplane") {
            echo "<img src='images/16/brick.png' style='vertical-align:middle'/> ";
        }
        if ($ent['entPhysicalParentRelPos'] > '-1') {
            echo "<strong>" . $ent['entPhysicalParentRelPos'] . ".</strong> ";
        }
        if ($link) {
            echo "<a {$link}>";
        }
        if ($ent['ifIndex']) {
            $interface = mysql_fetch_array(mysql_query("SELECT * FROM `ports` WHERE ifIndex = '" . $ent['ifIndex'] . "' AND device_id = '" . $device['device_id'] . "'"));
            $ent['entPhysicalName'] = generateiflink($interface);
        }
        if ($ent['entPhysicalModelName'] && $ent['entPhysicalName']) {
            echo "<strong>" . $ent['entPhysicalModelName'] . "</strong> (" . $ent['entPhysicalName'] . ")";
        } elseif ($ent['entPhysicalModelName']) {
            echo "<strong>" . $ent['entPhysicalModelName'] . "</strong>";
        } elseif ($ent['entPhysicalName']) {
            echo "<strong>" . $ent['entPhysicalName'] . "</strong>";
        } elseif ($ent['entPhysicalDescr']) {
            echo "<strong>" . $ent['entPhysicalDescr'] . "</strong>";
        }
        if ($ent['entPhysicalClass'] == "sensor") {
            echo " (" . $ent['entSensorValue'] . " " . $ent['entSensorType'] . ")";
        }
        echo "<br /><div class='interface-desc' style='margin-left: 20px;'>" . $ent['entPhysicalDescr'];
        if ($link) {
            echo "</a>";
        }
        if ($ent['entPhysicalSerialNum']) {
            echo " <br /><span style='color: #000099;'>Serial No. " . $ent['entPhysicalSerialNum'] . "</span> ";
        }
        echo "</div>";
        $count = mysql_result(mysql_query("SELECT COUNT(*) FROM `entPhysical` WHERE device_id = '" . $_GET['id'] . "' AND entPhysicalContainedIn = '" . $ent['entPhysicalIndex'] . "'"), 0);
        if ($count) {
            echo "<ul>";
            printEntPhysical($ent['entPhysicalIndex'], $level + 1, '');
            echo "</ul>";
        }
        echo "</li>";
    }
}
예제 #15
0
 $pw_b = mysql_fetch_array(mysql_query("SELECT * from `devices` AS D, `ports` AS I, `pseudowires` AS P WHERE D.device_id = '" . $pw_a['peer_device_id'] . "' AND\n                                                                                                          D.device_id = I.device_id AND\n                                                                                                          P.cpwVcID = '" . $pw_a['cpwVcID'] . "' AND\n                                                                                                          P.interface_id = I.interface_id"));
 if (!interfacepermitted($pw_a['interface_id'])) {
     $skip = "yes";
 }
 if (!interfacepermitted($pw_b['interface_id'])) {
     $skip = "yes";
 }
 if ($skip) {
     unset($skip);
 } else {
     if ($bg == "ffffff") {
         $bg = "e5e5e5";
     } else {
         $bg = "ffffff";
     }
     echo "<tr style=\"background-color: #{$bg};\"><td rowspan=2 style='font-size:18px; padding:4px;'>" . $pw_a['cpwVcID'] . "</td><td>" . generatedevicelink($pw_a) . "</td><td>" . generateiflink($pw_a) . "</td>\n                                                                                          <td rowspan=2> <img src='" . $config['base_url'] . "/images/16/arrow_right.png'> </td>\n                                                                                          <td>" . generatedevicelink($pw_b) . "</td><td>" . generateiflink($pw_b) . "</td></tr>";
     echo "<tr style=\"background-color: #{$bg};\"><td colspan=2>" . $pw_a['ifAlias'] . "</td><td colspan=2>" . $pw_b['ifAlias'] . "</td></tr>";
     if ($opta == "graphs") {
         echo "<tr style=\"background-color: #{$bg};\"><td></td><td colspan=2>";
         if (!$optb) {
             $optb = "mini";
         }
         if ($pw_a) {
             $pw_a['width'] = "150";
             $pw_a['height'] = "30";
             $pw_a['from'] = $day;
             $pw_a['to'] = $now;
             $pw_a['bg'] = $bg;
             $types = array('bits', 'pkts', 'errors');
             foreach ($types as $graph_type) {
                 $pw_a['graph_type'] = $graph_type;
예제 #16
0
    echo "<div style=' margin:0px; float: left;';>\n            <div style='margin: 0px 10px 5px 0px; padding:5px; background: #e5e5e5;'>\n            <span class=device-head>Day</span><br />\n            <a href='" . $config['base_url'] . "/device/" . $device['device_id'] . "/interface/" . $interface['interface_id'] . "/macaccounting/{$stat}/top10/1day/{$sort}/'>\n              <img style='border: #5e5e5e 2px;' valign=middle src='" . $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&stat={$stat}&type=mac_acc_total&sort={$sort}&from=-1day&to=now&width=150&height=50' />\n            </a> \n            </div>\n            <div style='margin: 0px 10px 5px 0px; padding:5px; background: #e5e5e5;'>\n            <span class=device-head>Two Day</span><br />\n            <a href='" . $config['base_url'] . "/device/" . $device['device_id'] . "/interface/" . $interface['interface_id'] . "/macaccounting/{$stat}/top10/2day/{$sort}/'>\n              <img style='border: #5e5e5e 2px;' valign=middle src='" . $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&stat={$stat}&type=mac_acc_total&sort={$sort}&from=-2day&to=now&width=150&height=50' />\n            </a>\n            </div>\n            <div style='margin: 0px 10px 5px 0px; padding:5px; background: #e5e5e5;'>\n            <span class=device-head>Week</span><br />\n             <a href='" . $config['base_url'] . "/device/" . $device['device_id'] . "/interface/" . $interface['interface_id'] . "/macaccounting/{$stat}/top10/1week/{$sort}/'>\n             <img style='border: #5e5e5e 2px;' valign=middle src='" . $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=mac_acc_total&sort={$sort}&stat={$stat}&from=-1week&to=now&width=150&height=50' /> \n             </a>\n             </div>\n             <div style='margin: 0px 10px 5px 0px; padding:5px; background: #e5e5e5;'>\n             <span class=device-head>Month</span><br />\n             <a href='" . $config['base_url'] . "/device/" . $device['device_id'] . "/interface/" . $interface['interface_id'] . "/macaccounting/{$stat}/top10/1month/{$sort}/'>\n             <img style='border: #5e5e5e 2px;' valign=middle src='" . $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=mac_acc_total&sort={$sort}&stat={$stat}&from=-1month&to=now&width=150&height=50' /> \n             </a>\n             </div>\n             <div style='margin: 0px 10px 5px 0px; padding:5px; background: #e5e5e5;'>\n             <span class=device-head>Year</span><br />\n             <a href='" . $config['base_url'] . "/device/" . $device['device_id'] . "/interface/" . $interface['interface_id'] . "/macaccounting/{$stat}/top10/1year/{$sort}/'>\n             <img style='border: #5e5e5e 2px;' valign=middle src='" . $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=mac_acc_total&sort={$sort}&stat={$stat}&from=-1year&to=now&width=150&height=50' /> \n             </a>\n             </div>\n        </div>\n        <div style='float: left;'>\n          <img src='" . $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=mac_acc_total&sort={$sort}&stat={$stat}&from={$from}&to=now&width=750&height=245' />\n        </div>\n        <div style=' margin:0px; float: left;';>\n             <div style='margin: 0px 0px 5px 10px; padding:5px; background: #e5e5e5;'>\n            <span class=device-head>Traffic</span><br />\n            <a href='" . $config['base_url'] . "/device/" . $device['device_id'] . "/interface/" . $interface['interface_id'] . "/macaccounting/bits/top10/{$period}/{$sort}/'>\n              <img style='border: #5e5e5e 2px;' valign=middle src='" . $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&stat=bits&type=mac_acc_total&sort={$sort}&from={$from}&to=now&width=150&height=50' />\n            </a>\n            </div>\n            <div style='margin: 0px 0px 5px 10px; padding:5px; background: #e5e5e5;'>\n            <span class=device-head>Packets</span><br />\n            <a href='" . $config['base_url'] . "/device/" . $device['device_id'] . "/interface/" . $interface['interface_id'] . "/macaccounting/pkts/top10/{$period}/{$sort}/'>\n              <img style='border: #5e5e5e 2px;' valign=middle src='" . $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&stat=pkts&type=mac_acc_total&sort={$sort}&from={$from}&to=now&width=150&height=50' />\n            </a>\n            </div>\n            <div style='margin: 0px 0px 5px 10px; padding:5px; background: #e5e5e5;'>\n            <span class=device-head>Top Input</span><br />\n            <a href='" . $config['base_url'] . "/device/" . $device['device_id'] . "/interface/" . $interface['interface_id'] . "/macaccounting/{$stat}/top10/{$period}/in/'>\n              <img style='border: #5e5e5e 2px;' valign=middle src='" . $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&stat={$stat}&type=mac_acc_total&sort=in&from={$from}&to=now&width=150&height=50' />\n            </a>\n            </div>\n            <div style='margin: 0px 0px 5px 10px; padding:5px; background: #e5e5e5;'>\n            <span class=device-head>Top Output</span><br />\n            <a href='" . $config['base_url'] . "/device/" . $device['device_id'] . "/interface/" . $interface['interface_id'] . "/macaccounting/{$stat}/top10/{$period}/out/'>\n              <img style='border: #5e5e5e 2px;' valign=middle src='" . $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&stat={$stat}&type=mac_acc_total&sort=out&from={$from}&to=now&width=150&height=50' />\n            </a>\n            </div>\n            <div style='margin: 0px 0px 5px 10px; padding:5px; background: #e5e5e5;'>\n            <span class=device-head>Top Aggregate</span><br />\n            <a href='" . $config['base_url'] . "/device/" . $device['device_id'] . "/interface/" . $interface['interface_id'] . "/macaccounting/{$stat}/top10/{$period}/both/'>\n              <img style='border: #5e5e5e 2px;' valign=middle src='" . $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&stat={$stat}&type=mac_acc_total&sort=both&from={$from}&to=now&width=150&height=50' />\n            </a>\n            </div>\n\n        </div>\n \n";
    unset($query);
} else {
    $query = mysql_query("SELECT *, (M.cipMacHCSwitchedBytes_input_rate + M.cipMacHCSwitchedBytes_output_rate) as bps FROM `mac_accounting` AS M,\n                      `ports` AS I, `devices` AS D WHERE M.interface_id = '" . $interface['interface_id'] . "' AND I.interface_id = M.interface_id\n                      AND I.device_id = D.device_id ORDER BY bps DESC");
    while ($acc = mysql_fetch_array($query)) {
        if (!is_integer($i / 2)) {
            $row_colour = $list_colour_a;
        } else {
            $row_colour = $list_colour_b;
        }
        $addy = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_mac where mac_address = '" . $acc['mac'] . "'"));
        $name = gethostbyaddr($addy['ipv4_address']);
        $arp_host = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = '" . $addy['ipv4_address'] . "' AND I.interface_id = A.interface_id AND D.device_id = I.device_id"));
        if ($arp_host) {
            $arp_name = generatedevicelink($arp_host);
            $arp_name .= " " . generateiflink($arp_host);
        } else {
            unset($arp_if);
        }
        if ($name == $addy['ipv4_address']) {
            unset($name);
        }
        if (mysql_result(mysql_query("SELECT count(*) FROM bgpPeers WHERE device_id = '" . $acc['device_id'] . "' AND bgpPeerIdentifier = '" . $addy['ipv4_address'] . "'"), 0)) {
            $peer_query = mysql_query("SELECT * FROM bgpPeers WHERE device_id = '" . $acc['device_id'] . "' AND bgpPeerIdentifier = '" . $addy['ipv4_address'] . "'");
            $peer_info = mysql_fetch_array($peer_query);
        } else {
            unset($peer_info);
        }
        if ($peer_info) {
            $asn = "AS" . $peer_info['bgpPeerRemoteAs'];
            $astext = $peer_info['astext'];