2008-11-04 12:34:30 +00:00
< table border = 0 cellpadding = 10 cellspacing = 10 width = 100 %>
< tr >
< td bgcolor = #e5e5e5 valign=top>
< ? php
2014-01-13 17:43:58 +00:00
2008-11-04 12:34:30 +00:00
# <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>
?>
< ? php
$nodes = array ();
2014-01-13 17:43:58 +00:00
$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' AND A.attrib_value < '86400' " ;
2008-11-04 12:34:30 +00:00
2014-01-13 17:43:58 +00:00
foreach ( dbFetchRows ( $sql ) as $device )
2011-03-17 00:09:20 +00:00
{
2008-11-04 12:34:30 +00:00
unset ( $already );
$i = 0 ;
2011-03-17 00:09:20 +00:00
while ( $i <= count ( $nodes ))
{
2008-11-04 12:34:30 +00:00
$thisnode = $device [ 'device_id' ];
2011-03-17 00:09:20 +00:00
if ( $nodes [ $i ] == $thisnode )
{
2008-11-04 12:34:30 +00:00
$already = " yes " ;
}
$i ++ ;
}
2011-03-17 00:09:20 +00:00
if ( ! $already ) { $nodes [] = $device [ 'device_id' ]; }
2008-11-04 12:34:30 +00:00
}
2014-01-13 17:43:58 +00:00
$sql = " SELECT * FROM `devices` WHERE `status` = '0' AND `ignore` = '0' " ;
foreach ( dbFetchRows ( $sql ) as $device )
{
2008-11-04 12:34:30 +00:00
echo ( " <div style='border: solid 2px #d0D0D0; float: left; padding: 5px; width: 120px; height: 90px; background: #ffbbbb; margin: 4px;'>
2010-08-02 22:09:52 +00:00
< center >< strong > " .generate_device_link( $device , shorthost( $device['hostname'] )). " </ strong >< br />
2011-03-17 00:09:20 +00:00
< span style = 'font-size: 14px; font-weight: bold; margin: 5px; color: #c00;' > Device Down </ span >
2008-11-04 12:34:30 +00:00
< span class = body - date - 1 > " .truncate( $device['location'] , 20). " </ span >
</ center ></ div > " );
}
2014-01-13 17:43:58 +00:00
$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 )
{
2008-11-04 12:34:30 +00:00
echo ( " <div style='border: solid 2px #D0D0D0; float: left; padding: 5px; width: 120px; height: 90px; background: #ffddaa; margin: 4px;'>
2010-08-02 22:09:52 +00:00
< center >< strong > " .generate_device_link( $interface , shorthost( $interface['hostname'] )). " </ strong >< br />
2011-03-17 00:09:20 +00:00
< span style = 'font-size: 14px; font-weight: bold; margin: 5px; color: #c00;' > Port Down </ span >
2010-08-02 22:09:52 +00:00
< strong > " .generate_port_link( $interface , makeshortif( $interface['ifDescr'] )). " </ strong > < br />
2008-11-04 12:34:30 +00:00
< span class = body - date - 1 > " .truncate( $interface['ifAlias'] , 20). " </ span >
</ center ></ div > " );
}
2014-01-13 17:43:58 +00:00
$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 )
{
2008-11-04 12:34:30 +00:00
echo ( " <div style='border: solid 2px #D0D0D0; float: left; padding: 5px; width: 120px; height: 90px; background: #ffddaa; margin: 4px;'>
2010-08-02 22:09:52 +00:00
< center >< strong > " .generate_device_link( $service , shorthost( $service['hostname'] )). " </ strong >< br />
2011-03-17 00:09:20 +00:00
< span style = 'font-size: 14px; font-weight: bold; margin: 5px; color: #c00;' > Service Down </ span >
2008-11-04 12:34:30 +00:00
< strong > " . $service['service_type'] . " </ strong >< br />
< span class = body - date - 1 > " .truncate( $interface['ifAlias'] , 20). " </ span >
</ center ></ div > " );
}
2014-01-13 17:43:58 +00:00
$sql = " SELECT * FROM `devices` AS D, bgpPeers AS B WHERE bgpPeerState != 'established' AND B.device_id = D.device_id " ;
foreach ( dbFetchRows ( $sql ) as $peer )
{
2008-11-04 12:34:30 +00:00
echo ( " <div style='border: solid 2px #d0D0D0; float: left; padding: 5px; width: 120px; height: 90px; background: #ffddaa; margin: 4px;'>
2010-08-02 22:09:52 +00:00
< center >< strong > " .generate_device_link( $peer , shorthost( $peer['hostname'] )). " </ strong >< br />
2011-03-17 00:09:20 +00:00
< span style = 'font-size: 14px; font-weight: bold; margin: 5px; color: #c00;' > BGP Down </ span >
2008-11-04 12:34:30 +00:00
< strong > " . $peer['bgpPeerIdentifier'] . " </ strong > < br />
< span class = body - date - 1 > AS " . $peer['bgpPeerRemoteAs'] . " " .truncate( $peer['astext'] , 10). " </ span >
</ center ></ div > " );
}
2011-09-20 09:55:11 +00:00
if ( filter_var ( $config [ 'uptime_warning' ], FILTER_VALIDATE_FLOAT ) !== FALSE && $config [ 'uptime_warning' ] > 0 )
2011-04-13 16:37:29 +00:00
{
2014-01-13 17:43:58 +00:00
$sql = " SELECT * FROM `devices` AS D, devices_attribs AS A WHERE A.device_id = D.device_id AND A.attrib_type = 'uptime' AND A.attrib_value < ' " . $config [ 'uptime_warning' ] . " ' " ;
foreach ( dbFetchRows ( $sql ) as $device )
{
2011-04-13 16:37:29 +00:00
echo ( " <div style='border: solid 2px #d0D0D0; float: left; padding: 5px; width: 120px; height: 90px; background: #ddffdd; margin: 4px;'>
< center >< strong > " .generate_device_link( $device , shorthost( $device['hostname'] )). " </ strong >< br />
< span style = 'font-size: 14px; font-weight: bold; margin: 5px; color: #090;' > Device < br /> Rebooted </ span >< br />
< span class = body - date - 1 > " .formatUptime( $device['attrib_value'] ). " </ span >
</ center ></ div > " );
}
2008-11-04 12:34:30 +00:00
}
echo ( "
2011-09-20 14:37:54 +00:00
< div style = 'clear: both;' > $errorboxes </ div > < div style = 'margin: 4px; clear: both;' >
2008-11-04 12:34:30 +00:00
< h3 > Recent Syslog Messages </ h3 >
" );
2010-02-19 01:40:38 +00:00
$sql = " SELECT *, DATE_FORMAT(timestamp, '%D %b %T') AS date from syslog ORDER BY timestamp DESC LIMIT 20 " ;
2008-11-04 12:34:30 +00:00
echo ( " <table cellspacing=0 cellpadding=2 width=100%> " );
2014-01-13 17:43:58 +00:00
foreach ( dbFetchRows ( $sql ) as $entry )
{
include ( " includes/print-syslog.inc.php " );
}
2008-11-04 12:34:30 +00:00
echo ( " </table> " );
echo ( " </div>
</ td >
< td bgcolor = #e5e5e5 width=275 valign=top>");
2012-05-25 12:24:34 +00:00
// this stuff can be customised to show whatever you want....
2008-11-04 12:34:30 +00:00
2011-04-06 13:54:50 +00:00
if ( $_SESSION [ 'userlevel' ] >= '5' )
{
2014-01-13 17:43:58 +00:00
$sql = " SELECT * FROM ports AS I, devices AS D WHERE `ifAlias` like 'L2TP: %' AND I.device_id = D.device_id AND D.hostname LIKE '% " ;
2008-11-04 12:34:30 +00:00
$sql .= $config [ 'mydomain' ] . " ' ORDER BY I.ifAlias " ;
unset ( $seperator );
2014-01-13 17:43:58 +00:00
foreach ( dbFetchRows ( $sql ) as $interface )
2011-04-06 13:54:50 +00:00
{
2012-05-16 13:25:50 +00:00
$ports [ 'l2tp' ] .= $seperator . $interface [ 'port_id' ];
2008-11-04 12:34:30 +00:00
$seperator = " , " ;
}
2014-01-13 17:43:58 +00:00
$sql = " SELECT * FROM ports AS I, devices AS D WHERE `ifAlias` like 'Transit: %' AND I.device_id = D.device_id AND D.hostname LIKE '% " ;
2008-11-04 12:34:30 +00:00
$sql .= $config [ 'mydomain' ] . " ' ORDER BY I.ifAlias " ;
unset ( $seperator );
2014-01-13 17:43:58 +00:00
foreach ( dbFetchRows ( $sql ) as $interface )
2011-04-06 13:54:50 +00:00
{
2012-05-16 13:25:50 +00:00
$ports [ 'transit' ] .= $seperator . $interface [ 'port_id' ];
2008-11-04 12:34:30 +00:00
$seperator = " , " ;
}
2014-01-13 17:43:58 +00:00
$sql = " SELECT * FROM ports AS I, devices AS D WHERE `ifAlias` like 'Server: thlon-pbx%' AND I.device_id = D.device_id AND D.hostname LIKE '% " ;
2008-11-04 12:34:30 +00:00
$sql .= $config [ 'mydomain' ] . " ' ORDER BY I.ifAlias " ;
unset ( $seperator );
2014-01-13 17:43:58 +00:00
foreach ( dbFetchRows ( $sql ) as $interface )
2011-04-06 13:54:50 +00:00
{
2012-05-16 13:25:50 +00:00
$ports [ 'voip' ] .= $seperator . $interface [ 'port_id' ];
2008-11-04 12:34:30 +00:00
$seperator = " , " ;
}
2011-04-06 13:54:50 +00:00
if ( $ports [ 'transit' ])
{
2011-03-28 09:11:05 +00:00
echo ( " <a onmouseover= \" return overlib('<img src= \ 'graph.php?type=multi_bits&ports= " . $ports [ 'transit' ] .
2012-05-06 18:38:11 +00:00
" &from= " . $config [ 'time' ][ 'day' ] . " &to= " . $config [ 'time' ][ 'now' ] . " &width=400&height=150 \ '>', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250); \" onmouseout= \" return nd(); \" > " .
2008-11-04 12:34:30 +00:00
" <div style='font-size: 18px; font-weight: bold;'>Internet Transit</div> " .
2011-03-28 09:11:05 +00:00
" <img src='graph.php?type=multi_bits&ports= " . $ports [ 'transit' ] .
2012-05-06 18:38:11 +00:00
" &from= " . $config [ 'time' ][ 'day' ] . " &to= " . $config [ 'time' ][ 'now' ] . " &width=200&height=100'></a> " );
2008-11-04 12:34:30 +00:00
}
2011-04-06 13:54:50 +00:00
if ( $ports [ 'l2tp' ])
{
2011-03-28 09:11:05 +00:00
echo ( " <a onmouseover= \" return overlib('<img src= \ 'graph.php?type=multi_bits&ports= " . $ports [ 'l2tp' ] .
2012-05-06 18:38:11 +00:00
" &from= " . $config [ 'time' ][ 'day' ] . " &to= " . $config [ 'time' ][ 'now' ] . " &width=400&height=150 \ '>', LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250); \" onmouseout= \" return nd(); \" > " .
2008-11-04 12:34:30 +00:00
" <div style='font-size: 18px; font-weight: bold;'>L2TP ADSL</div> " .
2011-03-28 09:11:05 +00:00
" <img src='graph.php?type=multi_bits&ports= " . $ports [ 'l2tp' ] .
2012-05-06 18:38:11 +00:00
" &from= " . $config [ 'time' ][ 'day' ] . " &to= " . $config [ 'time' ][ 'now' ] . " &width=200&height=100'></a> " );
2008-11-04 12:34:30 +00:00
}
2011-04-06 13:54:50 +00:00
if ( $ports [ 'voip' ])
{
2011-03-28 09:11:05 +00:00
echo ( " <a onmouseover= \" return overlib('<img src= \ 'graph.php?type=multi_bits&ports= " . $ports [ 'voip' ] .
2012-05-06 18:38:11 +00:00
" &from= " . $config [ 'time' ][ 'day' ] . " &to= " . $config [ 'time' ][ 'now' ] . " &width=400&height=150 \ '>', LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250); \" onmouseout= \" return nd(); \" > " .
2008-11-04 12:34:30 +00:00
" <div style='font-size: 18px; font-weight: bold;'>VoIP to PSTN</div> " .
2011-03-28 09:11:05 +00:00
" <img src='graph.php?type=multi_bits&ports= " . $ports [ 'voip' ] .
2012-05-06 18:38:11 +00:00
" &from= " . $config [ 'time' ][ 'day' ] . " &to= " . $config [ 'time' ][ 'now' ] . " &width=200&height=100'></a> " );
2008-11-04 12:34:30 +00:00
}
}
2012-05-25 12:24:34 +00:00
// END VOSTRON
2008-11-04 12:34:30 +00:00
?>
</ td >
</ tr >
< tr >
</ tr ></ table >