mirror of
				https://github.com/librenms/librenms.git
				synced 2024-10-07 16:52:45 +00:00 
			
		
		
		
	move from port_id to interface_id. make ports discovery only discover. add some cleaner functions. add a tiny bit of alerting infrastructure.
git-svn-id: http://www.observium.org/svn/observer/trunk@3195 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
		@@ -42,7 +42,7 @@ if ($config['warn']['ifdown'])
 | 
			
		||||
     $interface = ifNameDescr($interface);
 | 
			
		||||
     generate_front_box("#ffdd99", "<center><strong>".generate_device_link($interface, shorthost($interface['hostname']))."</strong><br />
 | 
			
		||||
      <span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>Port Down</span><br />
 | 
			
		||||
<!--      <img src='graph.php?type=bits&if=".$interface['interface_id']."&from=".$config['time']['day']."&to=".$config['time']['now']."&width=100&height=32' /> -->
 | 
			
		||||
<!--      <img src='graph.php?type=bits&if=".$interface['port_id']."&from=".$config['time']['day']."&to=".$config['time']['now']."&width=100&height=32' /> -->
 | 
			
		||||
        <strong>".generate_port_link($interface, truncate(makeshortif($interface['label']),13,''))."</strong> <br />
 | 
			
		||||
        " . ($interface['ifAlias'] ? '<span class="body-date-1">'.truncate($interface['ifAlias'], 20, '').'</span>' : '') . "
 | 
			
		||||
        </center>");
 | 
			
		||||
 
 | 
			
		||||
@@ -96,7 +96,7 @@ if ($config['warn']['ifdown'])
 | 
			
		||||
  $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'");
 | 
			
		||||
  while ($interface = mysql_fetch_array($sql))
 | 
			
		||||
  {
 | 
			
		||||
     if (port_permitted($interface['interface_id']))
 | 
			
		||||
     if (port_permitted($interface['port_id']))
 | 
			
		||||
     {
 | 
			
		||||
       echo("<div style='text-align: center; margin: 2px; border: solid 2px #D0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ffddaa;'>
 | 
			
		||||
       <strong>".generate_device_link($interface, shorthost($interface['hostname']))."</strong><br />
 | 
			
		||||
 
 | 
			
		||||
@@ -116,7 +116,7 @@ if ($_SESSION['userlevel'] >= '5')
 | 
			
		||||
  unset ($seperator);
 | 
			
		||||
  while ($interface = mysql_fetch_assoc($query))
 | 
			
		||||
  {
 | 
			
		||||
    $ports['l2tp'] .= $seperator . $interface['interface_id'];
 | 
			
		||||
    $ports['l2tp'] .= $seperator . $interface['port_id'];
 | 
			
		||||
    $seperator = ",";
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@@ -126,7 +126,7 @@ if ($_SESSION['userlevel'] >= '5')
 | 
			
		||||
  unset ($seperator);
 | 
			
		||||
  while ($interface = mysql_fetch_assoc($query))
 | 
			
		||||
  {
 | 
			
		||||
    $ports['transit'] .= $seperator . $interface['interface_id'];
 | 
			
		||||
    $ports['transit'] .= $seperator . $interface['port_id'];
 | 
			
		||||
    $seperator = ",";
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@@ -136,7 +136,7 @@ if ($_SESSION['userlevel'] >= '5')
 | 
			
		||||
  unset ($seperator);
 | 
			
		||||
  while ($interface = mysql_fetch_assoc($query))
 | 
			
		||||
  {
 | 
			
		||||
    $ports['voip'] .= $seperator . $interface['interface_id'];
 | 
			
		||||
    $ports['voip'] .= $seperator . $interface['port_id'];
 | 
			
		||||
    $seperator = ",";
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -101,7 +101,7 @@ if ($config['warn']['ifdown'])
 | 
			
		||||
     $interface = ifNameDescr($interface);
 | 
			
		||||
     generate_front_box("#ffdd99", "<center><strong>".generate_device_link($interface, shorthost($interface['hostname']))."</strong><br />
 | 
			
		||||
      <span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>Port Down</span><br />
 | 
			
		||||
<!--      <img src='graph.php?type=bits&if=".$interface['interface_id']."&from=".$config['time']['day']."&to=".$config['time']['now']."&width=100&height=32' /> -->
 | 
			
		||||
<!--      <img src='graph.php?type=bits&if=".$interface['port_id']."&from=".$config['time']['day']."&to=".$config['time']['now']."&width=100&height=32' /> -->
 | 
			
		||||
        <strong>".generate_port_link($interface, truncate(makeshortif($interface['label']),13,''))."</strong> <br />
 | 
			
		||||
        " . ($interface['ifAlias'] ? '<span class="body-date-1">'.truncate($interface['ifAlias'], 20, '').'</span>' : '') . "
 | 
			
		||||
        </center>");
 | 
			
		||||
 
 | 
			
		||||
@@ -42,7 +42,7 @@ if ($config['warn']['ifdown']) {
 | 
			
		||||
 | 
			
		||||
$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'");
 | 
			
		||||
while ($interface = mysql_fetch_assoc($sql)) {
 | 
			
		||||
   if (port_permitted($interface['interface_id'])) {
 | 
			
		||||
   if (port_permitted($interface['port_id'])) {
 | 
			
		||||
      echo("<div style='text-align: center; margin: 2px; border: solid 2px #D0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ffddaa;'>
 | 
			
		||||
       <strong>".generate_device_link($interface, shorthost($interface['hostname']))."</strong><br />
 | 
			
		||||
       <span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>Port Down</span><br />
 | 
			
		||||
@@ -120,7 +120,7 @@ if ($_SESSION['userlevel'] >= '5')
 | 
			
		||||
  $query = mysql_query($sql);
 | 
			
		||||
  unset ($seperator);
 | 
			
		||||
  while ($interface = mysql_fetch_assoc($query)) {
 | 
			
		||||
    $ports['transit'] .= $seperator . $interface['interface_id'];
 | 
			
		||||
    $ports['transit'] .= $seperator . $interface['port_id'];
 | 
			
		||||
    $seperator = ",";
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@@ -128,7 +128,7 @@ if ($_SESSION['userlevel'] >= '5')
 | 
			
		||||
  $query = mysql_query($sql);
 | 
			
		||||
  unset ($seperator);
 | 
			
		||||
  while ($interface = mysql_fetch_assoc($query)) {
 | 
			
		||||
    $ports['peering'] .= $seperator . $interface['interface_id'];
 | 
			
		||||
    $ports['peering'] .= $seperator . $interface['port_id'];
 | 
			
		||||
    $seperator = ",";
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -42,7 +42,7 @@ if ($config['warn']['ifdown']) {
 | 
			
		||||
 | 
			
		||||
foreach (dbFetchRows("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'") as $interface)
 | 
			
		||||
{
 | 
			
		||||
   if (port_permitted($interface['interface_id'])) {
 | 
			
		||||
   if (port_permitted($interface['port_id'])) {
 | 
			
		||||
      echo("<div style='text-align: center; margin: 2px; border: solid 2px #D0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ffddaa;'>
 | 
			
		||||
       <strong>".generate_device_link($interface, shorthost($interface['hostname']))."</strong><br />
 | 
			
		||||
       <span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>Port Down</span><br />
 | 
			
		||||
@@ -119,7 +119,7 @@ if ($_SESSION['userlevel'] >= '5')
 | 
			
		||||
  $query = mysql_query($sql);
 | 
			
		||||
  unset ($seperator);
 | 
			
		||||
  while ($interface = mysql_fetch_assoc($query)) {
 | 
			
		||||
    $ports['transit'] .= $seperator . $interface['interface_id'];
 | 
			
		||||
    $ports['transit'] .= $seperator . $interface['port_id'];
 | 
			
		||||
    $seperator = ",";
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@@ -127,7 +127,7 @@ if ($_SESSION['userlevel'] >= '5')
 | 
			
		||||
  $query = mysql_query($sql);
 | 
			
		||||
  unset ($seperator);
 | 
			
		||||
  while ($interface = mysql_fetch_assoc($query)) {
 | 
			
		||||
    $ports['peering'] .= $seperator . $interface['interface_id'];
 | 
			
		||||
    $ports['peering'] .= $seperator . $interface['port_id'];
 | 
			
		||||
    $seperator = ",";
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@@ -135,7 +135,7 @@ if ($_SESSION['userlevel'] >= '5')
 | 
			
		||||
  $query = mysql_query($sql);
 | 
			
		||||
  unset ($seperator);
 | 
			
		||||
  while ($interface = mysql_fetch_assoc($query)) {
 | 
			
		||||
    $ports['core'] .= $seperator . $interface['interface_id'];
 | 
			
		||||
    $ports['core'] .= $seperator . $interface['port_id'];
 | 
			
		||||
    $seperator = ",";
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user