mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-12 16:06:25 +02:00
fix some security nonsense
git-svn-id: http://www.observium.org/svn/observer/trunk@246 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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"; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user