mirror of
				https://github.com/librenms/librenms.git
				synced 2024-10-07 16:52:45 +00:00 
			
		
		
		
	Changes!
git-svn-id: http://www.observium.org/svn/observer/trunk@117 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
		@@ -7,7 +7,6 @@ exit;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if($_POST['hostname'] && $_POST['community']) {
 | 
			
		||||
  if($_SESSION['userlevel'] > '5') {
 | 
			
		||||
    $hostname = $_POST['hostname'];
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,7 @@ if($_SESSION['userlevel'] < '10') {
 | 
			
		||||
} else {
 | 
			
		||||
 | 
			
		||||
if($_POST['addsrv']) {
 | 
			
		||||
  if($userlevel == '10') {
 | 
			
		||||
  if($_SESSION['userlevel'] == '10') {
 | 
			
		||||
    include("includes/add-srv.inc");
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@@ -21,7 +21,7 @@ if ($handle = opendir($installdir . "/includes/services/")) {
 | 
			
		||||
 | 
			
		||||
$query = mysql_query("SELECT * FROM `devices` ORDER BY `hostname`");
 | 
			
		||||
while($device = mysql_fetch_array($query)) {
 | 
			
		||||
  $devicesform .= "<option value='" . $device[id] . "'>" . $device['hostname'] . "</option>";
 | 
			
		||||
  $devicesform .= "<option value='" . $device['device_id'] . "'>" . $device['hostname'] . "</option>";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if($updated) { print_message("Device Settings Saved"); }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
  $sql  = "SELECT * FROM `interfaces` AS I, `devices` AS D";
 | 
			
		||||
  $sql .= " WHERE `ifAlias` like 'Cust: %' AND I.device_id = D.device_id AND D.hostname LIKE '%" . $mydomain . "' ORDER BY I.ifAlias";
 | 
			
		||||
  $sql .= " WHERE `ifAlias` like 'Cust: %' AND I.device_id = D.device_id AND D.hostname LIKE '%" . $config['mydomain'] . "' ORDER BY I.ifAlias";
 | 
			
		||||
  $query = mysql_query($sql);
 | 
			
		||||
 | 
			
		||||
  if($bg == "#ffffff") { $bg = "#e5e5e5"; } else { $bg="#ffffff"; }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,20 +1,28 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
$sql = mysql_query("SELECT * FROM `devices` AS D, `devices_attribs` AS U WHERE D.device_id = U.device_id AND U.attrib_type = 'uptime' AND U.attrib_value > '0' AND U.attrib_value < '86400'");
 | 
			
		||||
while($device = mysql_fetch_array($sql)){
 | 
			
		||||
  $rebooted[] = "$device[device_id]";
 | 
			
		||||
}
 | 
			
		||||
?>
 | 
			
		||||
 | 
			
		||||
<table border=0 cellpadding=15 cellspacing=10 width=100%>
 | 
			
		||||
<table border=0 cellpadding=10 cellspacing=10 width=100%>
 | 
			
		||||
  <tr>
 | 
			
		||||
    <td bgcolor=#e5e5e5 width=50% valign=top>
 | 
			
		||||
      <div class=graphhead>Nodes with Outages</div>
 | 
			
		||||
      <table width=100% border=0><tr><td></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>
 | 
			
		||||
    <td bgcolor=#e5e5e5 valign=top>
 | 
			
		||||
      <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();
 | 
			
		||||
 | 
			
		||||
$sql = mysql_query("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'");
 | 
			
		||||
 | 
			
		||||
while($device = mysql_fetch_array($sql)){
 | 
			
		||||
  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 = mysql_query("SELECT * FROM `devices` WHERE `status` = '0'");
 | 
			
		||||
while($device = mysql_fetch_array($sql)){
 | 
			
		||||
  unset($already);
 | 
			
		||||
@@ -68,6 +76,9 @@ foreach($nodes as $node) {
 | 
			
		||||
 | 
			
		||||
  $intlist = array();
 | 
			
		||||
  $sql = mysql_query("SELECT `ifDescr`, `ifAlias` FROM interfaces WHERE `ifOperStatus` = 'down' AND `ifAdminStatus` = 'up' AND `device_id` = '$node'");
 | 
			
		||||
 | 
			
		||||
  $rebooted = mysql_result(mysql_query("SELECT attrib_value FROM `devices` AS D, `devices_attribs` AS A WHERE D.device_id = '$node' AND 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'"),0);
 | 
			
		||||
 | 
			
		||||
  while($int = mysql_fetch_row($sql)) { $intlist[] = "<b>$int[0]</b> - $int[1]"; } 
 | 
			
		||||
  foreach ($intlist as $intname) { $intpop .= "$br $intname"; $br = "<br />"; }
 | 
			
		||||
  unset($br);
 | 
			
		||||
@@ -88,24 +99,103 @@ foreach($nodes as $node) {
 | 
			
		||||
 | 
			
		||||
  if(hoststatus($node)) { $statimg = "<img align=absmiddle src=images/16/lightbulb.png alt='Host Up'>"; } 
 | 
			
		||||
                   else { $statimg = "<img align=absmiddle src=images/16/lightbulb_off.png alt='Host Down'>";}
 | 
			
		||||
  if($rebooted) { $statimg = "<img align=absmiddle src=images/16/lightning.png alt='Host Rebooted'>"; }
 | 
			
		||||
 | 
			
		||||
  if($bg == "#ffffff") { $bg = "#e5e5e5"; } else { $bg="#ffffff"; }
 | 
			
		||||
 | 
			
		||||
  if(devicepermitted($node)) {
 | 
			
		||||
 | 
			
		||||
  echo("<tr bgcolor=$bg>
 | 
			
		||||
          <td><a href='?page=device&id=$node' $mouseover>$host</a></td>
 | 
			
		||||
          <td align=center>$statimg</td>
 | 
			
		||||
          <td align=center><a $intpop>$ints</a></td>
 | 
			
		||||
          <td align=center><a $srvpop>$services</a></td></tr>");
 | 
			
		||||
 | 
			
		||||
  }
 | 
			
		||||
  unset($int, $ints, $intlist, $intpop, $srv, $srvlist, $srvname, $srvpop);
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
echo("</table>");
 | 
			
		||||
 | 
			
		||||
echo("    </td>
 | 
			
		||||
    <td bgcolor=#e5e5e5 width=400 valign=top>
 | 
			
		||||
  ");
 | 
			
		||||
 | 
			
		||||
  if($_SESSION['userlevel'] >= '5') {
 | 
			
		||||
    echo("
 | 
			
		||||
      <div style='font-size: 18px; font-weight: bold;'>Network Infrastructure Diagram</div>
 | 
			
		||||
      <img style='margin-top: 10px;' src='network.png' alt='Auto-generated network diagram'>
 | 
			
		||||
    ");
 | 
			
		||||
  }
 | 
			
		||||
?>
 | 
			
		||||
    </td>
 | 
			
		||||
    <td bgcolor=#e5e5e5 width=50% valign=top>
 | 
			
		||||
      <div class=graphhead>Network Infrastructure Diagram</div>
 | 
			
		||||
      <img src="network.png" alt="Auto-generated network diagram">
 | 
			
		||||
 | 
			
		||||
   </td>
 | 
			
		||||
   <td bgcolor=#e5e5e5 width=275 valign=top>
 | 
			
		||||
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
/// VOSTRON
 | 
			
		||||
 | 
			
		||||
if($_SESSION['userlevel'] >= '5') {
 | 
			
		||||
 | 
			
		||||
  $sql  = "select * from interfaces as I, devices as D WHERE `ifAlias` like 'L2TP: %' AND I.device_id = D.device_id AND D.hostname LIKE '%";
 | 
			
		||||
  $sql .= $config['mydomain'] . "' ORDER BY I.ifAlias";
 | 
			
		||||
  $query = mysql_query($sql);
 | 
			
		||||
  unset ($seperator);
 | 
			
		||||
  while($interface = mysql_fetch_array($query)) {
 | 
			
		||||
    $interfaces['l2tp'] .= $seperator . $interface['interface_id'];
 | 
			
		||||
    $seperator = ",";
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  $sql  = "select * from interfaces as I, devices as D WHERE `ifAlias` like 'Transit: %' AND I.device_id = D.device_id AND D.hostname LIKE '%";
 | 
			
		||||
  $sql .= $config['mydomain'] . "' ORDER BY I.ifAlias";
 | 
			
		||||
  $query = mysql_query($sql);
 | 
			
		||||
  unset ($seperator);
 | 
			
		||||
  while($interface = mysql_fetch_array($query)) {
 | 
			
		||||
    $interfaces['transit'] .= $seperator . $interface['interface_id'];
 | 
			
		||||
    $seperator = ",";
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  $sql  = "select * from interfaces as I, devices as D WHERE `ifAlias` like 'Server: thlon-pbx%' AND I.device_id = D.device_id AND D.hostname LIKE '%";
 | 
			
		||||
  $sql .= $config['mydomain'] . "' ORDER BY I.ifAlias";
 | 
			
		||||
  $query = mysql_query($sql);
 | 
			
		||||
  unset ($seperator);
 | 
			
		||||
  while($interface = mysql_fetch_array($query)) {
 | 
			
		||||
    $interfaces['voip'] .= $seperator . $interface['interface_id'];
 | 
			
		||||
    $seperator = ",";
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if($interfaces['transit']) {
 | 
			
		||||
    echo("<a onmouseover=\"return overlib('<img src=\'graph.php?type=multi_bits&interfaces=".$interfaces['transit'].
 | 
			
		||||
    "&from=".$day."&to=".$now."&width=400&height=150\'>', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\"  >".
 | 
			
		||||
    "<div style='font-size: 18px; font-weight: bold;'>Internet Transit</div>".
 | 
			
		||||
    "<img src='http://network.vostron.net/graph.php?type=multi_bits&interfaces=".$interfaces['transit'].
 | 
			
		||||
    "&from=".$day."&to=".$now."&width=200&height=100'></a>");
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if($interfaces['l2tp']) {
 | 
			
		||||
    echo("<a onmouseover=\"return overlib('<img src=\'graph.php?type=multi_bits&interfaces=".$interfaces['l2tp'].
 | 
			
		||||
    "&from=".$day."&to=".$now."&width=400&height=150\'>', LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\"  >".
 | 
			
		||||
    "<div style='font-size: 18px; font-weight: bold;'>L2TP ADSL</div>".
 | 
			
		||||
    "<img src='graph.php?type=multi_bits&interfaces=".$interfaces['l2tp'].
 | 
			
		||||
    "&from=".$day."&to=".$now."&width=200&height=100'></a>");
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if($interfaces['voip']) {
 | 
			
		||||
    echo("<a onmouseover=\"return overlib('<img src=\'graph.php?type=multi_bits&interfaces=".$interfaces['voip'].
 | 
			
		||||
    "&from=".$day."&to=".$now."&width=400&height=150\'>', LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\"  >".
 | 
			
		||||
    "<div style='font-size: 18px; font-weight: bold;'>VoIP to PSTN</div>".
 | 
			
		||||
    "<img src='graph.php?type=multi_bits&interfaces=".$interfaces['voip'].
 | 
			
		||||
    "&from=".$day."&to=".$now."&width=200&height=100'></a>");
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// END VOSTRON
 | 
			
		||||
 | 
			
		||||
?>
 | 
			
		||||
</td>
 | 
			
		||||
 | 
			
		||||
  </tr>
 | 
			
		||||
</table>
 | 
			
		||||
  <tr>
 | 
			
		||||
</tr></table>
 | 
			
		||||
 
 | 
			
		||||
@@ -5,8 +5,8 @@ if($_SESSION['userlevel'] < 10) {
 | 
			
		||||
  exit;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if($_POST['id'] {
 | 
			
		||||
  delHost($id);  
 | 
			
		||||
if($_POST['id']) {
 | 
			
		||||
  delHost($id);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
?>
 | 
			
		||||
@@ -17,11 +17,11 @@ if($_POST['id'] {
 | 
			
		||||
  <p><select name="id">
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
$query = mysql_query("SELECT id,hostname FROM `devices` ORDER BY `hostname`");
 | 
			
		||||
$query = mysql_query("SELECT * FROM `devices` ORDER BY `hostname`");
 | 
			
		||||
 | 
			
		||||
while($data = mysql_fetch_array($query)) {
 | 
			
		||||
 | 
			
		||||
  echo("<option value='$data[id]'>$data[hostname]</option>");
 | 
			
		||||
  echo("<option value='".$data['device_id']."'>".$data['hostname']."</option>");
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,7 @@ if($_SESSION[userlevel] < '5') {
 | 
			
		||||
} else {
 | 
			
		||||
 | 
			
		||||
if($_POST['delsrv']) {
 | 
			
		||||
  if($userlevel > "5") {
 | 
			
		||||
  if($_SESSION['userlevel'] > "5") {
 | 
			
		||||
    include("includes/del-srv.inc");
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,7 @@
 | 
			
		||||
<?
 | 
			
		||||
 | 
			
		||||
if(devicepermitted($_GET['id'])) {
 | 
			
		||||
 | 
			
		||||
$selected['iface'] = "selected";
 | 
			
		||||
 | 
			
		||||
if(!$_GET['section']) { 
 | 
			
		||||
@@ -55,16 +57,40 @@ echo("<li class=" . $select['dev-graphs'] . ">
 | 
			
		||||
</li>
 | 
			
		||||
");
 | 
			
		||||
 | 
			
		||||
if(mysql_result(mysql_query("SELECT * FROM `entPhysical` WHERE device_id = '".$_GET['id']."'"), 0) > '0') {
 | 
			
		||||
 | 
			
		||||
  echo("
 | 
			
		||||
<li class=" . $select['dev-enyphysical'] . ">
 | 
			
		||||
  <a href='?page=device&id=" . $device['device_id'] . "§ion=dev-entphysical'>
 | 
			
		||||
    <img src='images/16/bricks.png' align=absmiddle border=0> Inventory
 | 
			
		||||
  </a>
 | 
			
		||||
</li>
 | 
			
		||||
");
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if(mysql_result(mysql_query("select count(temp_id) from temperature WHERE temp_host = '" . $device['device_id'] . "'"), 0) > '0') {
 | 
			
		||||
  echo("
 | 
			
		||||
<li class=" . $select['dev-temp'] . ">
 | 
			
		||||
  <a href='?page=device&id=" . $device['device_id'] . "§ion=dev-temp'>
 | 
			
		||||
    <img src='images/16/weather_sun.png' align=absmiddle border=0> Temps
 | 
			
		||||
    <img src='images/16/flame.png' align=absmiddle border=0> Temps
 | 
			
		||||
  </a>
 | 
			
		||||
</li>
 | 
			
		||||
");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if(mysql_result(mysql_query("select count(storage_id) from storage WHERE host_id = '" . $device['device_id'] . "'"), 0) > '0') {
 | 
			
		||||
  echo("
 | 
			
		||||
<li class=" . $select['dev-storage'] . ">
 | 
			
		||||
  <a href='?page=device&id=" . $device['device_id'] . "§ion=dev-storage'>
 | 
			
		||||
    <img src='images/16/database.png' align=absmiddle border=0> Storage
 | 
			
		||||
  </a>
 | 
			
		||||
</li>
 | 
			
		||||
");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if(mysql_result(mysql_query("select count(service_id) from services WHERE service_host = '" . $device['device_id'] . "'"), 0) > '0') {
 | 
			
		||||
  echo("
 | 
			
		||||
<li class=" . $select['dev-srv'] . ">
 | 
			
		||||
@@ -90,7 +116,7 @@ echo("
 | 
			
		||||
</li>
 | 
			
		||||
");
 | 
			
		||||
 | 
			
		||||
if($_SESSION[userlevel] > "5") {
 | 
			
		||||
if($_SESSION[userlevel] >= "5") {
 | 
			
		||||
  echo("
 | 
			
		||||
<li class=" . $select['dev-edit'] . ">
 | 
			
		||||
  <a href='?page=device&id=" . $device['device_id'] . "§ion=dev-edit'>
 | 
			
		||||
@@ -110,5 +136,7 @@ include("pages/$page/$section.inc");
 | 
			
		||||
echo("</div>
 | 
			
		||||
");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} else { echo("<span class=alert>You do not have the necessary access permissions to view this device.</span>"); }
 | 
			
		||||
?>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,7 @@ if($_SESSION['userlevel'] < '5') {
 | 
			
		||||
} else {
 | 
			
		||||
 | 
			
		||||
if($_POST['editing']) {
 | 
			
		||||
  if($userlevel > "5") {
 | 
			
		||||
  if($_SESSION['userlevel'] > "5") {
 | 
			
		||||
    include("includes/edit-host.inc");
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@@ -19,8 +19,6 @@ if($updated && $update_message) {
 | 
			
		||||
  print_error($update_message);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if($device['type'] == 'server') { $server_select = "selected"; }
 | 
			
		||||
if($device['type'] == 'network') { $network_select = "selected"; }
 | 
			
		||||
if($device['type'] == 'firewall') { $firewall_select = "selected"; }
 | 
			
		||||
@@ -54,12 +52,12 @@ echo("<table cellpadding=0 cellspacing=0><tr><td>
 | 
			
		||||
    </tr>
 | 
			
		||||
    <tr>
 | 
			
		||||
      <td width='300'><div align='right'>Disable</div></td>
 | 
			
		||||
      <td width='300'><input name='disable' type='checkbox' id='disable' value='1'");
 | 
			
		||||
if($device['disabled']) {echo("checked=checked");}
 | 
			
		||||
      <td width='300'><input name='disabled' type='checkbox' id='disabled' value='1'");
 | 
			
		||||
if($device['disabled']) { echo("checked=checked"); }
 | 
			
		||||
echo("/></td>
 | 
			
		||||
      <td width='300'><div align='right'>Ignore</div></td>
 | 
			
		||||
      <td width='300'><input name='ignore' type='checkbox' id='disable' value='1'");
 | 
			
		||||
if($device['ignore']) {echo("checked=checked");}
 | 
			
		||||
if($device['ignore']) { echo("checked=checked"); }
 | 
			
		||||
echo("/></td>
 | 
			
		||||
    </tr>
 | 
			
		||||
    <tr>
 | 
			
		||||
 
 | 
			
		||||
@@ -92,15 +92,15 @@ while($device = mysql_fetch_array($device_query)) {
 | 
			
		||||
      $graph_type = "procs";            include ("includes/print-device-graph.php");
 | 
			
		||||
     echo("<br />");
 | 
			
		||||
      if($device[postfix] == '1') {
 | 
			
		||||
        echo("<div class=graphhead>Postfix Mail Statistics</div>");
 | 
			
		||||
        echo("<div class=graphhead>Postfix Messages</div>");
 | 
			
		||||
        $graph_type = "postfix";        include ("includes/print-device-graph.php");
 | 
			
		||||
        echo("<br />");
 | 
			
		||||
        echo("<div class=graphhead>Postfix Mail Error Statistics</div>");
 | 
			
		||||
        echo("<div class=graphhead>Postfix Errors</div>");
 | 
			
		||||
        $graph_type = "postfixerrors";  include ("includes/print-device-graph.php");
 | 
			
		||||
        echo("<br />");
 | 
			
		||||
      }
 | 
			
		||||
      if($device[courier] == '1') {
 | 
			
		||||
        echo("<div class=graphhead>Postfix Mail Statistics</div>");
 | 
			
		||||
        echo("<div class=graphhead>Courier IMAP/POP3</div>");
 | 
			
		||||
        $graph_type = "courier";        include ("includes/print-device-graph.php");
 | 
			
		||||
        echo("<br />");
 | 
			
		||||
      }
 | 
			
		||||
@@ -119,8 +119,8 @@ while($device = mysql_fetch_array($device_query)) {
 | 
			
		||||
   case "IOS":
 | 
			
		||||
      echo("<div class=graphhead>CPU Usage</div>");
 | 
			
		||||
      $graph_type = "cpu";              include ("includes/print-device-graph.php");
 | 
			
		||||
      echo("<div class=graphhead>Memory Usage</div>");
 | 
			
		||||
      echo("<br />");
 | 
			
		||||
      echo("<div class=graphhead>Memory Usage</div>");
 | 
			
		||||
      $graph_type = "mem";              include ("includes/print-device-graph.php");
 | 
			
		||||
      echo("<br />");
 | 
			
		||||
      if(mysql_result(mysql_query("SELECT count(*) FROM temperature WHERE temp_host = '" . $device['device_id'] . "'"),0)) {
 | 
			
		||||
 
 | 
			
		||||
@@ -2,9 +2,9 @@
 | 
			
		||||
 | 
			
		||||
$overview = 1;
 | 
			
		||||
 | 
			
		||||
$id = $_GET[id];
 | 
			
		||||
#$id = $_GET['id'];
 | 
			
		||||
 | 
			
		||||
$device = mysql_fetch_array(mysql_query("SELECT * FROM `devices` WHERE `device_id` = '$_GET[id]'"));
 | 
			
		||||
#$device = mysql_fetch_array(mysql_query("SELECT * FROM `devices` WHERE `device_id` = '$_GET[id]'"));
 | 
			
		||||
 | 
			
		||||
$interfaces['total'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces  WHERE device_id = '" . $device['device_id'] . "'"),0);
 | 
			
		||||
$interfaces['up'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces  WHERE device_id = '" . $device['device_id'] . "' AND ifOperStatus = 'up'"),0);
 | 
			
		||||
@@ -45,16 +45,24 @@ if(mysql_result(mysql_query("SELECT count(storage_id) from storage WHERE host_id
 | 
			
		||||
  while($drive = mysql_fetch_array($drives)) {
 | 
			
		||||
    $total = $drive['hrStorageSize'] * $drive['hrStorageAllocationUnits'];
 | 
			
		||||
    $used  = $drive['hrStorageUsed'] * $drive['hrStorageAllocationUnits'];
 | 
			
		||||
    $perc  = round($drive['storage_perc'], 0);
 | 
			
		||||
    $drive['perc']  = round($drive['storage_perc'], 0);
 | 
			
		||||
    $total = formatStorage($total);
 | 
			
		||||
    $used = formatStorage($used);
 | 
			
		||||
 | 
			
		||||
    $store_url    = "graph.php?id=" . $drive['storage_id'] . "&type=unixfs&from=$month&to=$now&width=400&height=125";
 | 
			
		||||
    $store_popup = "onmouseover=\"return overlib('<img src=\'$store_url\'>', LEFT);\" onmouseout=\"return nd();\"";
 | 
			
		||||
 | 
			
		||||
    $fs_url   = "?page=device&id=".$device['device_id']."§ion=dev-storage";
 | 
			
		||||
 | 
			
		||||
    $fs_popup  = "onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$drive['hrStorageDescr'];
 | 
			
		||||
    $fs_popup .= "</div><img src=\'graph.php?id=" . $drive['storage_id'] . "&type=unixfs&from=$month&to=$now&width=400&height=125\'>";
 | 
			
		||||
    $fs_popup .= "', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"";
 | 
			
		||||
 | 
			
		||||
    if($perc > '80') { $drv_colour='#cc0000'; } else { $drvclass='#0000cc';  }
 | 
			
		||||
    echo("<tr><td class=tablehead>" . $drive['hrStorageDescr'] . "</td><td><a href='#' $store_popup><img src='percentage.php?per=" . $perc . "'></a>
 | 
			
		||||
          </td><td style='font-weight: bold; color: $drv_colour'>" . $perc . "%</td><td>" . $total . "</td><td>" . $used . "</td></tr>");
 | 
			
		||||
    echo("<tr><td class=tablehead><a href='".$fs_url."' $fs_popup>" . $drive['hrStorageDescr'] . "</a></td>
 | 
			
		||||
            <td><a href='#' $fs_popup><img src='percentage.php?per=" . $drive['perc'] . "'></a></td>
 | 
			
		||||
            <td style='font-weight: bold; color: $drv_colour'>" . $drive['perc'] . "%</td>
 | 
			
		||||
            <td>" . $total . "</td>
 | 
			
		||||
            <td>" . $used . "</td>
 | 
			
		||||
          </tr>");
 | 
			
		||||
    $i++;
 | 
			
		||||
  }
 | 
			
		||||
  echo("</table>");
 | 
			
		||||
@@ -78,9 +86,14 @@ if(mysql_result(mysql_query("SELECT count(temp_id) from temperature WHERE temp_h
 | 
			
		||||
    $temp_perc = $temp['temp_current'] / $temp['temp_limit'] * 100;
 | 
			
		||||
 | 
			
		||||
    $temp_colour = percent_colour($temp_perc);
 | 
			
		||||
    $temp_url  = "graph.php?id=" . $temp['temp_id'] . "&type=temp&from=$month&to=$now&width=400&height=125";
 | 
			
		||||
    $temp_link  = "<a href='?page=device&id=".$device['device_id']."§ion=dev-temp' onmouseover=\"return ";
 | 
			
		||||
    $temp_link .= "overlib('<div class=list-large>".$device['hostname']." - ".$temp['temp_descr'];
 | 
			
		||||
    $temp_link .= "</div><img src=\'$temp_url\'>', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\" >";
 | 
			
		||||
    $temp_link .= $temp['temp_descr'] . "</a>";
 | 
			
		||||
 | 
			
		||||
    $temp['temp_descr'] = truncate($temp['temp_descr'], 25, '');
 | 
			
		||||
    echo("<tr bgcolor='$row_colour'><td>" . $temp['temp_descr'] . "</td><td width=40 class=tablehead><span style='color: $temp_colour'>" . $temp['temp_current'] . "°C</span></td></tr>");
 | 
			
		||||
    echo("<tr bgcolor='$row_colour'><td><strong>$temp_link</strong></td><td width=40 class=tablehead><span style='color: $temp_colour'>" . $temp['temp_current'] . "°C</span></td></tr>");
 | 
			
		||||
    if($i == $rows) { echo("</table></td><td valign=top><table width=100% cellspacing=0 cellpadding=2>"); }
 | 
			
		||||
    $i++;
 | 
			
		||||
  }
 | 
			
		||||
@@ -132,6 +145,7 @@ echo("
 | 
			
		||||
  $sql = "SELECT * FROM interfaces WHERE `device_id` = '" . $device['device_id'] . "'";
 | 
			
		||||
  $query = mysql_query($sql);
 | 
			
		||||
  while($data = mysql_fetch_array($query)) {
 | 
			
		||||
    $data['hostname'] = $device['hostname'];
 | 
			
		||||
    echo("$ifsep" . generateiflink($data, makeshortif(strtolower($data['ifDescr']))));
 | 
			
		||||
    $ifsep = ", ";
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
@@ -14,7 +14,7 @@ $device_query = mysql_query($sql);
 | 
			
		||||
echo("<table cellpadding=7 cellspacing=0 class=devicetable width=100%>");
 | 
			
		||||
 | 
			
		||||
while($device = mysql_fetch_array($device_query)) {
 | 
			
		||||
  if( devicepermitted($device['device_id']) || $_SESSION['userlevel'] == 10 ) {
 | 
			
		||||
  if( devicepermitted($device['device_id']) || $_SESSION['userlevel'] >= '5' ) {
 | 
			
		||||
    $device['uptime'] = @mysql_result(mysql_query("SELECT `attrib_value` FROM `devices_attribs` WHERE `device_id` = '" . $device['device_id'] ."' AND `attrib_type` = 'uptime'"), 0);
 | 
			
		||||
    include("includes/hostbox.inc");
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
@@ -4,23 +4,22 @@ echo("<table cellpadding=7 cellspacing=0 class=devicetable width=100%>");
 | 
			
		||||
 | 
			
		||||
if($_GET['type']) {
 | 
			
		||||
  $type = $_GET['type'];
 | 
			
		||||
  $sql  = "select * from interfaces as I, devices as D WHERE `ifAlias` like '$type: %' AND I.device_id = D.device_id ORDER BY I.ifAlias";
 | 
			
		||||
  $sql  = "select * from interfaces as I, devices as D WHERE `ifAlias` like '$type: %' AND I.device_id = D.device_id AND D.hostname LIKE '%" . $config['mydomain'] . "' ORDER BY I.ifAlias";
 | 
			
		||||
  $query = mysql_query($sql);
 | 
			
		||||
  while($data = mysql_fetch_array($query)) {
 | 
			
		||||
  while($interface = mysql_fetch_array($query)) {
 | 
			
		||||
    $done = "yes";
 | 
			
		||||
    unset($class);
 | 
			
		||||
    $data['ifAlias'] = str_replace($type . ": ", "", $data['ifAlias']);
 | 
			
		||||
    $data['ifAlias'] = str_replace("[PNI]", "Private", $data['ifAlias']);
 | 
			
		||||
    $ifclass = ifclass($data['ifOperStatus'], $data['ifAdminStatus']);
 | 
			
		||||
    $interface['ifAlias'] = str_replace($type . ": ", "", $interface['ifAlias']);
 | 
			
		||||
    $interface['ifAlias'] = str_replace("[PNI]", "Private", $interface['ifAlias']);
 | 
			
		||||
    $ifclass = ifclass($interface['ifOperStatus'], $interface['ifAdminStatus']);
 | 
			
		||||
    if($bg == "#ffffff") { $bg = "#e5e5e5"; } else { $bg="#ffffff"; }
 | 
			
		||||
    echo("<tr bgcolor='$bg'>
 | 
			
		||||
             <td><span class=interface><a href='?page=interface&id=" . $data['interface_id'] . "'>" . $data['ifAlias'] . "</a></span><br /> 
 | 
			
		||||
            <span class=interface-desc><a href='?page=device&id=" . $data['device_id'] . "'>" . $data['hostname'] . "</a> <a href='?page=interface&id=" . $data['interface_id'] . "'>" . $data['ifDescr'] . "</a></span></td></tr><tr bgcolor='$bg'><td>");
 | 
			
		||||
             <td><span class=list-large>" . generateiflink($interface,$interface['ifAlias']) . "</span><br /> 
 | 
			
		||||
            <span class=interface-desc>".generatedevicelink($interface)." ".generateiflink($interface)." </span></td></tr><tr bgcolor='$bg'><td>");
 | 
			
		||||
 | 
			
		||||
if(file_exists("rrd/" . $data['hostname'] . "." . $data['ifIndex'] . ".rrd")) {
 | 
			
		||||
if(file_exists("rrd/" . $interface['hostname'] . "." . $interface['ifIndex'] . ".rrd")) {
 | 
			
		||||
 | 
			
		||||
    $graph_type = "bits";
 | 
			
		||||
    $iid = $data['interface_id'];
 | 
			
		||||
    include("includes/print-interface-graphs.php");
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
if ($_SESSION['userlevel'] == '10') {
 | 
			
		||||
if ($_SESSION['userlevel'] >= '5') {
 | 
			
		||||
  $sql = "SELECT * FROM `interfaces` AS I, `devices` AS D WHERE I.device_id = D.device_id ORDER BY D.hostname, I.ifDescr";
 | 
			
		||||
} else {
 | 
			
		||||
  $sql = "SELECT * FROM `interfaces` AS I, `devices` AS D, `devices_perms` AS P WHERE I.device_id = D.device_id AND D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' ORDER BY D.hostname, I.ifDescr";
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
if($_SESSION['userlevel'] == '10') {
 | 
			
		||||
if($_SESSION['userlevel'] >= '5') {
 | 
			
		||||
  $sql = "SELECT * FROM `temperature` AS T, `devices` AS D WHERE T.temp_host = D.device_id ORDER BY D.hostname, T.temp_descr";
 | 
			
		||||
} else {
 | 
			
		||||
  $sql = "SELECT * FROM `temperature` AS T, `devices` AS D, devices_perms as P WHERE T.temp_host = D.device_id AND D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' ORDER BY D.hostname, T.temp_descr";
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user