diff --git a/html/pages/adduser.php b/html/pages/adduser.php index 0eb0e364d..76579e409 100644 --- a/html/pages/adduser.php +++ b/html/pages/adduser.php @@ -8,7 +8,7 @@ if($_SESSION['userlevel'] != '10') { echo("You do not have the if($_POST['action'] == "add") { - mysql_query("INSERT INTO `users` (`username`, `realname`, `password`, `level`) VALUES ('" . mres($_POST['new_username']) . "', '" . mres($_POST['new_realname']) . "', MD5('" . mres(_POST['new_password']) . "'), '" . mres($_POST['new_level']) . "')"); + mysql_query("INSERT INTO `users` (`username`, `realname`, `password`, `level`) VALUES ('" . mres($_POST['new_username']) . "', '" . mres($_POST['new_realname']) . "', MD5('" . mres($_POST['new_password']) . "'), '" . mres($_POST['new_level']) . "')"); if(mysql_affected_rows()) { echo("User " . $_GET['username'] . " added!"); } diff --git a/html/pages/device/dev-graphs.inc b/html/pages/device/dev-graphs.inc index 96f54a805..8c70688b1 100644 --- a/html/pages/device/dev-graphs.inc +++ b/html/pages/device/dev-graphs.inc @@ -11,6 +11,11 @@ while($device = mysql_fetch_array($device_query)) { case "JunOS": echo("
Processor Utilisation
"); $graph_type = "cpu"; include ("includes/print-device-graph.php"); + if(mysql_result(mysql_query("SELECT count(*) FROM temperature WHERE temp_host = '" . $device['device_id'] . "'"),0)) { + echo("
Temperatures
"); + $graph_type = "dev_temp"; include ("includes/print-device-graph.php"); + echo("
"); + } break; diff --git a/includes/discovery/temperatures.php b/includes/discovery/temperatures.php index 27887ca2e..7099af7f0 100755 --- a/includes/discovery/temperatures.php +++ b/includes/discovery/temperatures.php @@ -6,6 +6,37 @@ echo("Temperatures : "); + ## JunOS Temperatures + if($device['os'] == "JunOS") { + echo("JunOS "); + $oids = shell_exec($config['snmpwalk'] . " -v2c -CI -Osqn -c $community $hostname 1.3.6.1.4.1.2636.3.1.13.1.7"); + $oids = trim($oids); + foreach(explode("\n", $oids) as $data) { + $data = trim($data); + $data = substr($data, 29); + if($data) { + list($oid) = explode(" ", $data); + $temp_oid = "1.3.6.1.4.1.2636.3.1.13.1.7.$oid"; + $descr_oid = "1.3.6.1.4.1.2636.3.1.13.1.5.$oid"; + $descr = trim(shell_exec("snmpget -O qv -v2c -c $community $hostname $descr_oid")); + $temp = trim(shell_exec("snmpget -O qv -v2c -c $community $hostname $temp_oid")); + if(!strstr($descr, "No") && !strstr($temp, "No") && $descr != "" && $temp != "0") { + $descr = `snmpget -O qv -v2c -c $community $hostname $descr_oid`; + $descr = str_replace("\"", "", $descr); + $descr = str_replace("temperature", "", $descr); + $descr = str_replace("temp", "", $descr); + $descr = trim($descr); + if(mysql_result(mysql_query("SELECT count(temp_id) FROM `temperature` WHERE temp_oid = '$temp_oid' AND temp_host = '$id'"),0) == '0') { + $query = "INSERT INTO temperature (`temp_host`, `temp_oid`, `temp_descr`) values ('$id', '$temp_oid', '$descr')"; + mysql_query($query); + echo("+"); + } else { echo("."); } + $temp_exists[] = "$id $temp_oid"; + } + } + } + } + ## Begin Observer-Style if($device['os'] == "Linux") { echo("Observer-Style "); @@ -84,7 +115,7 @@ } } } - } + } ## End Cisco Temperatures ## Delete removed sensors diff --git a/includes/osdiscovery/discover-screenos.php b/includes/osdiscovery/discover-screenos.php index fe982e4a2..af2538a97 100755 --- a/includes/osdiscovery/discover-screenos.php +++ b/includes/osdiscovery/discover-screenos.php @@ -3,7 +3,8 @@ if(!$os) { $sysObjectId = shell_exec($config['snmpget'] . " -Ovq -v2c -c ". $community ." ". $hostname ." .1.3.6.1.2.1.1.2.0"); - if(strstr($sysObjectId, "netscreen")) { $os = "ScreenOS"; } + if(strstr($sysObjectId, "netscreen")) { $os = "ScreenOS"; } elseif (strstr($sysObjectId, "enterprises.3224.1")) { $os = "ScreenOS"; } + }