$content "); } echo('
'); if ($config['vertical_summary']) { echo('
'); } else { echo('
'); } echo('
'); echo('
'); echo('
'); $count_boxes = 0; // Device down boxes if ($_SESSION['userlevel'] >= '10') { $sql = "SELECT * FROM `devices` WHERE `status` = '0' AND `ignore` = '0' LIMIT ".$config['front_page_down_box_limit']; } else { $sql = "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' LIMIT".$config['front_page_down_box_limit']; } foreach (dbFetchRows($sql) as $device) { generate_front_box("device-down", generate_device_link($device, shorthost($device['hostname']))."
Device Down
".truncate($device['location'], 20).""); ++$count_boxes; } if ($_SESSION['userlevel'] >= '10') { $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' LIMIT ".$config['front_page_down_box_limit']; } else { $sql = "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' LIMIT ".$config['front_page_down_box_limit']; } // These things need to become more generic, and more manageable across different frontpages... rewrite inc :> // Port down boxes if ($config['warn']['ifdown']) { foreach (dbFetchRows($sql) as $interface) { if (!$interface['deleted']) { $interface = ifNameDescr($interface); generate_front_box("port-down", generate_device_link($interface, shorthost($interface['hostname']))."
Port Down
".generate_port_link($interface, truncate(makeshortif($interface['label']),13,''))."
" . ($interface['ifAlias'] ? ''.truncate($interface['ifAlias'], 20, '').'' : '')); ++$count_boxes; } } } /* FIXME service permissions? seem nonexisting now.. */ // Service down boxes if ($_SESSION['userlevel'] >= '10') { $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' LIMIT ".$config['front_page_down_box_limit']; $param[] = ''; } else { $sql = "SELECT * FROM services AS S, devices AS D, devices_perms AS P WHERE P.`user_id` = ? AND P.`device_id` = D.`device_id` AND S.`device_id` = D.`device_id` AND S.`service_ignore` = '0' AND S.`service_disabled` = '0' AND S.`service_status` = '0' LIMIT ".$config['front_page_down_box_limit']; $param[] = $_SESSION['user_id']; } foreach (dbFetchRows($sql,$param) as $service) { generate_front_box("service-down", generate_device_link($service, shorthost($service['hostname']))."
Service Down ".$service['service_type']."
".truncate($interface['ifAlias'], 20).""); ++$count_boxes; } // BGP neighbour down boxes if (isset($config['enable_bgp']) && $config['enable_bgp']) { if ($_SESSION['userlevel'] >= '10') { $sql = "SELECT * FROM `devices` AS D, bgpPeers AS B WHERE bgpPeerAdminStatus != 'start' AND bgpPeerState != 'established' AND bgpPeerState != '' AND B.device_id = D.device_id AND D.ignore = 0 LIMIT ".$config['front_page_down_box_limit']; } else { $sql = "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 bgpPeerAdminStatus != 'start' AND bgpPeerState != 'established' AND bgpPeerState != '' AND B.device_id = D.device_id AND D.ignore = 0 LIMIT ".$config['front_page_down_box_limit']; } foreach (dbFetchRows($sql) as $peer) { generate_front_box("bgp-down", generate_device_link($peer, shorthost($peer['hostname']))."
BGP Down ".$peer['bgpPeerIdentifier']."
AS".truncate($peer['bgpPeerRemoteAs']." ".$peer['astext'], 14, "").""); ++$count_boxes; } } // Device rebooted boxes if (filter_var($config['uptime_warning'], FILTER_VALIDATE_FLOAT) !== FALSE && $config['uptime_warning'] > 0) { if ($_SESSION['userlevel'] >= '10') { $sql = "SELECT * FROM `devices` AS D WHERE D.status = '1' AND D.uptime > 0 AND D.uptime < '" . $config['uptime_warning'] . "' AND D.ignore = 0 LIMIT ".$config['front_page_down_box_limit']; } else { $sql = "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 > 0 AND D.uptime < '" . $config['uptime_warning'] . "' AND D.ignore = 0 LIMIT ".$config['front_page_down_box_limit']; } foreach (dbFetchRows($sql) as $device) { generate_front_box("device-rebooted", generate_device_link($device, shorthost($device['hostname']))."
Device Rebooted
".formatUptime($device['uptime'], 'short').""); ++$count_boxes; } } if ($count_boxes == 0) { echo("
Nothing here yet

This is where status notifications about devices and services would normally go. You might have none because you run such a great network, or perhaps you've just started using ".$config['project_name'].". If you're new to ".$config['project_name'].", you might want to start by adding one or more devices in the Devices menu.

"); } echo('
'); echo('
'); echo('
'); echo('
'); if ($config['vertical_summary']) { echo('
'); include_once("includes/device-summary-vert.inc.php"); } else { echo('
'); include_once("includes/device-summary-horiz.inc.php"); } echo('
'); if ($config['enable_syslog']) { $sql = "SELECT *, DATE_FORMAT(timestamp, '%D %b %T') AS date from syslog ORDER BY timestamp DESC LIMIT 20"; $query = mysql_query($sql); echo('
 
Syslog entries
'); foreach (dbFetchRows($sql) as $entry) { $entry = array_merge($entry, device_by_id_cache($entry['device_id'])); include("includes/print-syslog.inc.php"); } echo("
"); echo("
"); echo("
"); echo("
"); echo("
"); } else { if ($_SESSION['userlevel'] >= '10') { $query = "SELECT *,DATE_FORMAT(datetime, '%D %b %T') as humandate FROM `eventlog` ORDER BY `datetime` DESC LIMIT 0,15"; $alertquery = "SELECT devices.device_id,name,state,time_logged FROM alert_log LEFT JOIN devices ON alert_log.device_id=devices.device_id RIGHT JOIN alert_rules ON alert_log.rule_id=alert_rules.id ORDER BY `time_logged` DESC LIMIT 0,15"; } else { $query = "SELECT *,DATE_FORMAT(datetime, '%D %b %T') as humandate FROM `eventlog` AS E, devices_perms AS P WHERE E.host = P.device_id AND P.user_id = " . $_SESSION['user_id'] . " ORDER BY `datetime` DESC LIMIT 0,15"; $alertquery = "SELECT devices.device_id,name,state,time_logged FROM alert_log LEFT JOIN devices ON alert_log.device_id=devices.device_id RIGHT JOIN alert_rules ON alert_log.rule_id=alert_rules.id RIGHT JOIN devices_perms ON alert_log.device_id = devices_perms.device_id AND devices_perms.user_id = " . $_SESSION['user_id'] . " ORDER BY `time_logged` DESC LIMIT 0,15"; } $data = mysql_query($query); $alertdata = mysql_query($alertquery); echo('
 
Alertlog entries
'); foreach (dbFetchRows($alertquery) as $alert_entry) { include("includes/print-alerts.inc.php"); } echo('
Eventlog entries
'); foreach (dbFetchRows($query) as $entry) { include("includes/print-event.inc.php"); } echo("
"); echo("
"); echo("
"); echo("
"); echo("
"); } echo("
"); echo('
'); ?>