mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Juniper JunOSe temperatures (sponsored by redLED Industries Inc.)
git-svn-id: http://www.observium.org/svn/observer/trunk@987 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@ -109,6 +109,30 @@ function discover_mempool(&$valid_mempool, $device, $index, $type, $descr, $prec
|
||||
}
|
||||
}
|
||||
|
||||
function discover_temperature(&$valid_temp, $device, $oid, $index, $type, $descr, $precision = 1, $low_limit = NULL, $high_limit = NULL, $current)
|
||||
{
|
||||
global $config; global $debug;
|
||||
if($debug) { echo("$oid, $index, $type, $descr, $precision\n"); }
|
||||
if (mysql_result(mysql_query("SELECT COUNT(temp_id) FROM `temperature` WHERE temp_type = '$type' AND temp_index = '$index' AND device_id = '".$device['device_id']."'"),0) == '0')
|
||||
{
|
||||
$query = "INSERT INTO temperature (`device_id`, `temp_type`,`temp_index`,`temp_oid`, `temp_descr`, `temp_limit`, `temp_current`, `temp_precision`)";
|
||||
$query .= " values ('".$device['device_id']."', '$type','$index','$oid', '$descr','" . ($high_limit ? $high_limit : $config['defaults']['temp_limit']) . "', '$current', '$precision')";
|
||||
mysql_query($query);
|
||||
echo("+");
|
||||
} else {
|
||||
$entry = mysql_fetch_array(mysql_query("SELECT * FROM `temperature` WHERE device_id = '".$device['device_id']."' AND `temp_type` = '$type' AND `temp_index` = '$index'"));
|
||||
echo(mysql_error());
|
||||
if($oid == $entry['temp_oid'] && $descr == $entry['temp_descr'] && $precision == $ntry['temp_precision']) {
|
||||
echo(".");
|
||||
} else {
|
||||
mysql_query("UPDATE temperature SET `temp_descr` = '$descr', `temp_oid` = '$oid', `temp_precision` = '$precision' WHERE `temp_id` = '".$entry['temp_id']."'");
|
||||
echo("U");
|
||||
}
|
||||
}
|
||||
echo(mysql_error());
|
||||
$valid_temp[$type][$index] = 1;
|
||||
return $return;
|
||||
}
|
||||
|
||||
function discover_fan($device, $oid, $index, $type, $descr, $precision = 1, $low_limit = NULL, $high_limit = NULL, $current = NULL) {
|
||||
|
||||
|
25
includes/discovery/temperatures-junose.inc.php
Normal file
25
includes/discovery/temperatures-junose.inc.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
## JunOSe Temperatures
|
||||
|
||||
if ($device['os'] == "junose")
|
||||
{
|
||||
echo("JunOSe: ");
|
||||
$oids = snmpwalk_cache_multi_oid($device, "juniSystemTempValue", array(), "Juniper-System-MIB", "+".$config['install_dir']."/mibs/junose");
|
||||
if(is_array($oids[$device['device_id']])) {
|
||||
foreach($oids[$device[device_id]] as $index => $entry) {
|
||||
if(is_numeric($entry['juniSystemTempValue']) && is_numeric($index) && $entry['juniSystemTempValue'] > "0") {
|
||||
$entPhysicalIndex = snmp_get($device, "juniSystemTempPhysicalIndex.".$index, "-Oqv", "Juniper-System-MIB", "+".$config['install_dir']."/mibs/junose");
|
||||
$descr = snmp_get($device, "entPhysicalDescr.".$entPhysicalIndex, "-Oqv", "ENTITY-MIB");
|
||||
$descr = preg_replace("/^Juniper\ [0-9a-zA-Z\-]+/", "", $descr); ## Wipe out ugly Juniper crap. Why put vendor and model in here? Idiots!
|
||||
$descr = str_replace("temperature sensor on", "", trim($descr));
|
||||
$oid = ".1.3.6.1.4.1.4874.2.2.2.1.9.4.1.3.".$index;
|
||||
$current = $entry['juniSystemTempValue'];
|
||||
discover_temperature($valid_temp, $device, $oid, $index, "junose", $descr, "1", NULL, NULL, $current);
|
||||
$temp_exists[] = $device['device_id'] . " $oid";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -7,6 +7,8 @@ $port = $device['port'];
|
||||
|
||||
echo("Temperatures : ");
|
||||
|
||||
include("temperatures-junose.inc.php");
|
||||
|
||||
|
||||
if($device['os'] == "ironware")
|
||||
{
|
||||
|
Reference in New Issue
Block a user