Example #1
0
}
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";
    }
Example #2
0
    foreach (dbFetchRows($sql) as $peer) {
        generate_front_box('bgp-down', generate_device_link($peer, shorthost($peer['hostname'])) . "<br />\n    <span class=bgp-down>BGP Down</span>\n    <span class='" . (strstr($peer['bgpPeerIdentifier'], ':') ? 'front-page-bgp-small' : 'front-page-bgp-normal') . "'>" . $peer['bgpPeerIdentifier'] . '</span><br />
    <span class=body-date-1>AS' . truncate($peer['bgpPeerRemoteAs'] . ' ' . $peer['astext'], 14, '') . '</span>');
        ++$count_boxes;
    }
}
// Device rebooted boxes
if (filter_var($config['uptime_warning'], FILTER_VALIDATE_FLOAT) !== false && $config['uptime_warning'] > 0) {
    if (is_admin() === true || is_read() === true) {
        $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'])) . '<br />
      <span class=device-rebooted>Device Rebooted</span><br />
      <span class=body-date-1>' . formatUptime($device['uptime'], 'short') . '</span>');
        ++$count_boxes;
    }
}
if ($count_boxes == 0) {
    echo "<h5>Nothing here yet</h5><p class=welcome>This is where status notifications about devices and services would normally go. You might have none\n  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.</p>';
}
echo '</div>';
echo '</div>';
echo '</div>';
echo '
  </div>
  </div>
';
Example #3
0
        $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 AND `D`.`status` = '1' LIMIT " . $config['front_page_down_box_limit'];
    }
    foreach (dbFetchRows($sql) as $peer) {
        generate_front_box("bgp-down", generate_device_link($peer, shorthost($peer['hostname'])) . "<br />\n    <span class=bgp-down>BGP Down</span>\n    <span class='" . (strstr($peer['bgpPeerIdentifier'], ':') ? 'front-page-bgp-small' : 'front-page-bgp-normal') . "'>" . $peer['bgpPeerIdentifier'] . "</span><br />\n    <span class=body-date-1>AS" . truncate($peer['bgpPeerRemoteAs'] . " " . $peer['astext'], 14, "") . "</span>");
        ++$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'])) . "<br />\n      <span class=device-rebooted>Device Rebooted</span><br />\n      <span class=body-date-1>" . formatUptime($device['uptime'], 'short') . "</span>");
        ++$count_boxes;
    }
}
if ($count_boxes == 0) {
    echo "<h5>Nothing here yet</h5><p class=welcome>This is where status notifications about devices and services would normally go. You might have none\n  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\n  want to start by adding one or more devices in the Devices menu.</p>";
}
echo '</div>';
echo '</div>';
echo '</div>';
echo '
  </div>
  </div>
';
if ($config['vertical_summary']) {
    echo '   <div class="col-md-3">';