mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
* refactor: advanced sensor states mark create_state_index($state_name) as E_USER_DEPRECATED? * fix: minor corrections * fix: mib has partialSync(9) and incompatibleVersion(8) * fix: corrected netagent2upsstate - Sleeping(5) * fix: NetAgent2 upsThreePhaseUPSStatusInverterOperating correction * refactor: array() be gone * Refactoring includes/discovery/sensors/state/extendair.inc.php with arrays And tidying up array formatting in other files * fix: minor typo * standardising array item names removed redundant "if ($state_index_id !== null) {" * workaround: procurve & serverscheck a sensor is causing create_state_index($state) to return null. The updated code doesn't allow for this and thus a hybrid is being used. * standardised naming of state info. Caused a typo $state_name instead of $status_name $state_name is the standard * converted compas to square arrays * Converted APC states using preg_match to new create_state_index() call * Update boss.inc.php
51 lines
2.1 KiB
PHP
51 lines
2.1 KiB
PHP
<?php
|
|
/*
|
|
* LibreNMS QNAP NAS temperature information module
|
|
*
|
|
* Copyright (c) 2016 Cercel Valentin <crc@nuamchefazi.ro>
|
|
* This program is free software: you can redistribute it and/or modify it
|
|
* under the terms of the GNU General Public License as published by the
|
|
* Free Software Foundation, either version 3 of the License, or (at your
|
|
* option) any later version. Please see LICENSE.txt at the top level of
|
|
* the source code distribution for details.
|
|
*/
|
|
|
|
echo 'QNAP: ';
|
|
|
|
|
|
$cpu_temperature_oid = '.1.3.6.1.4.1.24681.1.3.5.0';
|
|
$cpu_temperature = snmp_get($device, $cpu_temperature_oid, '-Oqv');
|
|
discover_sensor($valid['sensor'], 'temperature', $device, $cpu_temperature_oid, '98', 'snmp', 'CPU Temperature', '1', '1', null, null, null, null, $cpu_temperature);
|
|
|
|
$system_temperature_oid = '.1.3.6.1.4.1.24681.1.3.6.0';
|
|
$system_temperature = snmp_get($device, $system_temperature_oid, '-Oqv');
|
|
discover_sensor($valid['sensor'], 'temperature', $device, $system_temperature_oid, '99', 'snmp', 'System Temperature', '1', '1', null, null, null, null, $system_temperature);
|
|
|
|
$disk_temperature_oid = '.1.3.6.1.4.1.24681.1.2.11.1.3';
|
|
$disk_serial_oid = '.1.3.6.1.4.1.24681.1.2.11.1.5';
|
|
|
|
$hdd_temps = snmpwalk_cache_numerical_oid($device, $disk_temperature_oid, [], null, null, '-OQUsn');
|
|
$hdd_serials = snmpwalk_cache_numerical_oid($device, $disk_serial_oid, [], null, null, '-OQUsn');
|
|
|
|
if (is_array($hdd_temps) && !empty($hdd_temps)) {
|
|
foreach ($hdd_temps as $index => $entry) {
|
|
$oid = $disk_temperature_oid . '.' . $index;
|
|
$disk_oid = $disk_serial_oid . '.' . $index;
|
|
$disk_temperature = $entry[$oid];
|
|
$disk_serial = $hdd_serials[$index][$disk_oid];
|
|
if ($disk_serial == '--') {
|
|
$disk_descr = "HDD $index empty bay";
|
|
} else {
|
|
$disk_descr = "HDD $index $disk_serial";
|
|
}
|
|
if ($disk_temperature) {
|
|
discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, 'snmp', $disk_descr, '1', '1', null, null, null, null, $disk_temperature);
|
|
}
|
|
}
|
|
}
|
|
|
|
unset(
|
|
$hdd_temps,
|
|
$hdd_serials
|
|
);
|