0)
{
$uptimesql = " AND A.attrib_value < '" . $config['uptime_warning'] . "'";
}
$sql = "SELECT * FROM `devices` AS D, `devices_attribs` AS A WHERE D.status = '1' AND A.device_id = D.device_id AND A.attrib_type = 'uptime' AND A.attrib_value > '0' " . $uptimesql;
foreach (dbFetchRows($sql) as $device)
{
unset($already);
$i = 0;
while ($i <= count($nodes)) {
$thisnode = $device['device_id'];
if ($nodes[$i] == $thisnode) {
$already = "yes";
}
$i++;
}
if (!$already) { $nodes[] = $device['device_id']; }
}
$sql = "SELECT * FROM `devices` WHERE `status` = '0' AND `ignore` = '0'";
foreach (dbFetchRows($sql) as $device)
{
if (device_permitted($device['device_id'])) {
echo("
".generate_device_link($device, shorthost($device['hostname']))."
Device Down
".truncate($device['location'], 35)."
");
}
}
if ($config['warn']['ifdown']) {
$sql = "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'";
foreach (dbFetchRows($sql) as $interface)
{
if (port_permitted($interface['port_id'])) {
echo("
".generate_device_link($interface, shorthost($interface['hostname']))."
Port Down
".generate_port_link($interface, makeshortif($interface['ifDescr']))."
".truncate($interface['ifAlias'], 15)."
");
}
}
}
$sql = "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'";
foreach (dbFetchRows($sql) as $service)
{
if (device_permitted($service['device_id'])) {
echo("
".generate_device_link($service, shorthost($service['hostname']))."
Service Down
".$service['service_type']."
".truncate($interface['ifAlias'], 15)."
");
}
}
$sql = "SELECT * FROM `devices` AS D, bgpPeers AS B WHERE bgpPeerAdminStatus = 'start' AND bgpPeerState != 'established' AND B.device_id = D.device_id";
foreach (dbFetchRows($sql) as $peer)
{
if (device_permitted($peer['device_id'])) {
echo("
".generate_device_link($peer, shorthost($peer['hostname']))."
BGP Down
".$peer['bgpPeerIdentifier']."
AS".$peer['bgpPeerRemoteAs']." ".truncate($peer['astext'], 10)."
");
}
}
if (filter_var($config['uptime_warning'], FILTER_VALIDATE_FLOAT) !== FALSE && $config['uptime_warning'] > 0)
{
$sql = "SELECT * FROM devices_attribs AS A, `devices` AS D WHERE A.attrib_value < '" . $config['uptime_warning'] . "' AND A.attrib_type = 'uptime' AND A.device_id = D.device_id AND ignore = '0' AND disabled = '0'";
foreach (dbFetchRows($sql) as $device) {
if (device_permitted($device['device_id']) && $device['attrib_value'] < $config['uptime_warning'] && $device['attrib_type'] == "uptime") {
echo("
".generate_device_link($device, shorthost($device['hostname']))."
Device Rebooted
".formatUptime($device['attrib_value'])."
");
}
}
}
echo("
$errorboxes
Recent Syslog Messages
");
$sql = "SELECT *, DATE_FORMAT(timestamp, '".$config['dateformat']['mysql']['compact']."') AS date from syslog,devices WHERE syslog.device_id = devices.device_id ORDER BY seq DESC LIMIT 20";
echo(" ");
foreach (dbFetchRows($sql) as $entry)
{
include("includes/print-syslog.inc.php");
}
echo(" ");
echo("
|
");
// this stuff can be customised to show whatever you want....
if ($_SESSION['userlevel'] >= '5')
{
$sql = "SELECT * FROM ports AS I, devices AS D WHERE `ifAlias` like 'Transit: %' AND I.device_id = D.device_id ORDER BY I.ifAlias";
unset ($seperator);
foreach (dbFetchRows($sql) as $interface)
{
$ports['transit'] .= $seperator . $interface['port_id'];
$seperator = ",";
}
$sql = "SELECT * FROM ports AS I, devices AS D WHERE `ifAlias` like 'Peering: %' AND I.device_id = D.device_id ORDER BY I.ifAlias";
unset ($seperator);
foreach (dbFetchRows($sql) as $interface)
{
$ports['peering'] .= $seperator . $interface['port_id'];
$seperator = ",";
}
$ports['broadband'] = "3294,3295,688,3534";
$ports['wave_broadband'] = "827";
$ports['new_broadband'] = "3659,4149,4121,4108,3676,4135";
echo("");
if ($ports['peering'] && $ports['transit']) {
echo("
\
\
', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >".
"Aggregate Internet Traffic ".
" ");
}
echo(" ");
echo("");
if ($ports['transit']) {
echo("
\
\
', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >".
"Internet Transit ".
" ");
}
if ($ports['peering']) {
echo("
\
\
', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >".
"Internet Peering ".
" ");
}
echo(" ");
echo("");
if ($ports['broadband'] && $ports['wave_broadband'] && $ports['new_broadband']) {
echo("
\
\
', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >".
"Aggregate Broadband Traffic ".
" ");
}
echo(" ");
if ($ports['broadband']) {
echo(" ");
}
echo(" ");
if ($ports['new_broadband']) {
echo(" ");
}
echo(" ");
if ($ports['wave_broadband']) {
echo(" ");
}
echo(" ");
}
?>
|