second
This commit is contained in:
parent
1ae7c39614
commit
a4c7af68ac
@ -91,7 +91,14 @@ sub _get_temperature_sensors {
|
||||
return $data;
|
||||
}
|
||||
|
||||
$data = JSON->new->pretty->encode({ "PVE MOD lm-sensors Enhanced" => $sensors_json });
|
||||
$data = JSON->new->pretty->encode({
|
||||
cpu => $config{lm_sensors}{enable_cpu} ? \1 : \0,
|
||||
nvme => $config{lm_sensors}{enable_nvme_temp} ? \1 : \0,
|
||||
fans => $config{lm_sensors}{enable_fan_speed} ? \1 : \0,
|
||||
hdd => $config{lm_sensors}{enable_hdd_temp} ? \1 : \0,
|
||||
other => $config{lm_sensors}{enable_other_temp} ? \1 : \0,
|
||||
data => { 'PVE MOD lm-sensors Enhanced' => $sensors_json },
|
||||
});
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
@ -69,6 +69,7 @@ our %config = (
|
||||
enable_ram_temp => 0,
|
||||
enable_hdd_temp => 0,
|
||||
enable_nvme_temp => 0,
|
||||
enable_other_temp => 0,
|
||||
enable_fan_speed => 0,
|
||||
display_zero_speed_fans => 0,
|
||||
temp_unit => 'C',
|
||||
|
||||
@ -10,8 +10,8 @@ use PVE::PVEMod::Collector::SystemInformation qw(get_system_information_data);
|
||||
|
||||
# Per-endpoint state caches (module-level, reset on worker restart)
|
||||
my $graphics_cache = { data => {}, mtime => 0 };
|
||||
my $sensors_cache = { data => '{}', mtime => 0 };
|
||||
my $ups_cache = { data => '{}', mtime => 0 };
|
||||
my $sensors_cache = { data => {}, mtime => 0 };
|
||||
my $ups_cache = { data => {}, mtime => 0 };
|
||||
my $system_info_cache = undef;
|
||||
|
||||
|
||||
@ -153,7 +153,7 @@ sub get_graphics_info {
|
||||
debug(__LINE__, "get_graphics_info called");
|
||||
if (!($config{gpu}{intel_enabled} || !$config{gpu}{nvidia_enabled} || !$config{gpu}{amd_enabled})) {
|
||||
debug(__LINE__, "GPU information collection is disabled");
|
||||
return { };
|
||||
return { disabled => \1 };
|
||||
}
|
||||
|
||||
# Start PVE Mod
|
||||
@ -171,13 +171,13 @@ sub get_sensors_info {
|
||||
debug(__LINE__, "get_sensors_info called");
|
||||
if (!$config{lm_sensors}{enabled}) {
|
||||
debug(__LINE__, "LM Sensors collection is disabled");
|
||||
return {};
|
||||
return { disabled => \1 };
|
||||
}
|
||||
|
||||
# Start PVE Mod
|
||||
pve_mod_starter();
|
||||
|
||||
my $data = _read_state_file_cached($sensors_state_file, $sensors_cache, 1, '{}');
|
||||
my $data = _read_state_file_cached($sensors_state_file, $sensors_cache, 0, {});
|
||||
|
||||
# Notify pve_mod_worker of activity
|
||||
notify_pve_mod_worker();
|
||||
@ -189,13 +189,13 @@ sub get_ups_info {
|
||||
debug(__LINE__, "get_ups_info called");
|
||||
if (!$config{ups}{enabled}) {
|
||||
debug(__LINE__, "UPS collection is disabled");
|
||||
return {};
|
||||
return { disabled => \1 };
|
||||
}
|
||||
|
||||
# Start PVE Mod
|
||||
pve_mod_starter();
|
||||
|
||||
my $data = _read_state_file_cached($ups_state_file, $ups_cache, 1, '{}');
|
||||
my $data = _read_state_file_cached($ups_state_file, $ups_cache, 0, {});
|
||||
|
||||
# Notify pve_mod_worker of activity
|
||||
notify_pve_mod_worker();
|
||||
@ -217,6 +217,11 @@ sub get_pve_mod_version {
|
||||
sub get_system_information {
|
||||
debug(__LINE__, "get_system_information called");
|
||||
|
||||
if (!$config{system_info}{enabled}) {
|
||||
debug(__LINE__, "System information collection is disabled");
|
||||
return { disabled => \1 };
|
||||
}
|
||||
|
||||
if (defined $system_info_cache) {
|
||||
debug(__LINE__, "Returning cached system information");
|
||||
return $system_info_cache;
|
||||
|
||||
@ -288,8 +288,15 @@ Ext.define('PVE.node.StatusView', {
|
||||
// ---
|
||||
let objValue;
|
||||
try {
|
||||
objValue = JSON.parse(value) || {};
|
||||
objValue = objValue[Object.keys(objValue)[0]] || {};
|
||||
const parsed = value || {};
|
||||
if (parsed.disabled === true) {
|
||||
this.hide();
|
||||
return '';
|
||||
} else if (parsed.cpu !== true) {
|
||||
this.hide();
|
||||
return '';
|
||||
}
|
||||
objValue = (parsed.data && parsed.data[Object.keys(parsed.data)[0]]) || {};
|
||||
} catch(e) {
|
||||
objValue = {};
|
||||
}
|
||||
@ -576,8 +583,15 @@ Ext.define('PVE.node.StatusView', {
|
||||
// ---
|
||||
let objValue;
|
||||
try {
|
||||
objValue = JSON.parse(value) || {};
|
||||
objValue = objValue[Object.keys(objValue)[0]] || {};
|
||||
const parsed = value || {};
|
||||
if (parsed.disabled === true) {
|
||||
this.hide();
|
||||
return '';
|
||||
} else if (parsed.nvme !== true) {
|
||||
this.hide();
|
||||
return '';
|
||||
}
|
||||
objValue = (parsed.data && parsed.data[Object.keys(parsed.data)[0]]) || {};
|
||||
} catch(e) {
|
||||
objValue = {};
|
||||
}
|
||||
@ -661,6 +675,9 @@ Ext.define('PVE.node.StatusView', {
|
||||
if (parsed.disabled === true) {
|
||||
this.hide();
|
||||
return '';
|
||||
} else if (parsed.other !== true) {
|
||||
this.hide();
|
||||
return '';
|
||||
}
|
||||
objValue = (parsed.data && parsed.data[Object.keys(parsed.data)[0]]) || {};
|
||||
} catch(e) {
|
||||
@ -754,8 +771,15 @@ Ext.define('PVE.node.StatusView', {
|
||||
// ---
|
||||
let objValue;
|
||||
try {
|
||||
objValue = JSON.parse(value) || {};
|
||||
objValue = objValue[Object.keys(objValue)[0]] || {};
|
||||
const parsed = value || {};
|
||||
if (parsed.disabled === true) {
|
||||
this.hide();
|
||||
return '';
|
||||
} else if (parsed.fans !== true) {
|
||||
this.hide();
|
||||
return '';
|
||||
}
|
||||
objValue = (parsed.data && parsed.data[Object.keys(parsed.data)[0]]) || {};
|
||||
} catch(e) {
|
||||
objValue = {};
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ _check_nvidia_tool() {
|
||||
node_info_defaults() {
|
||||
LM_SENSORS_ENABLED=0
|
||||
ENABLE_CPU=0; CPU_TEMP_TARGET="Core"
|
||||
ENABLE_RAM_TEMP=0; ENABLE_HDD_TEMP=0; ENABLE_NVME_TEMP=0
|
||||
ENABLE_RAM_TEMP=0; ENABLE_HDD_TEMP=0; ENABLE_NVME_TEMP=0; ENABLE_OTHER_TEMP=0
|
||||
ENABLE_FAN_SPEED=0; DISPLAY_ZERO_SPEED_FANS=0; TEMP_UNIT="C"
|
||||
ENABLE_INTEL_GPU_INFO=0; ENABLE_NVIDIA_GPU_INFO=0; ENABLE_AMD_GPU_INFO=0
|
||||
ENABLE_GPU_HISTORY=0
|
||||
@ -101,6 +101,7 @@ node_info_load_conf() {
|
||||
lm_sensors.enable_ram_temp) ENABLE_RAM_TEMP="$val" ;;
|
||||
lm_sensors.enable_hdd_temp) ENABLE_HDD_TEMP="$val" ;;
|
||||
lm_sensors.enable_nvme_temp) ENABLE_NVME_TEMP="$val" ;;
|
||||
lm_sensors.enable_other_temp) ENABLE_OTHER_TEMP="$val" ;;
|
||||
lm_sensors.enable_fan_speed) ENABLE_FAN_SPEED="$val" ;;
|
||||
lm_sensors.display_zero_speed_fans) DISPLAY_ZERO_SPEED_FANS="$val" ;;
|
||||
lm_sensors.temp_unit) TEMP_UNIT="$val" ;;
|
||||
@ -131,7 +132,7 @@ node_info_configure() {
|
||||
# Initialize all variables to off
|
||||
LM_SENSORS_ENABLED=0
|
||||
ENABLE_CPU=0; CPU_TEMP_TARGET="Core"
|
||||
ENABLE_RAM_TEMP=0; ENABLE_HDD_TEMP=0; ENABLE_NVME_TEMP=0
|
||||
ENABLE_RAM_TEMP=0; ENABLE_HDD_TEMP=0; ENABLE_NVME_TEMP=0; ENABLE_OTHER_TEMP=0
|
||||
ENABLE_FAN_SPEED=0; DISPLAY_ZERO_SPEED_FANS=0; TEMP_UNIT="C"
|
||||
ENABLE_INTEL_GPU_INFO=0; ENABLE_NVIDIA_GPU_INFO=0; ENABLE_AMD_GPU_INFO=0
|
||||
ENABLE_GPU_HISTORY=0
|
||||
@ -253,8 +254,17 @@ node_info_configure() {
|
||||
|
||||
#region Other thermals
|
||||
msgb "\n=== Detecting other thermal sensors ==="
|
||||
local otherCount
|
||||
local otherTempCount
|
||||
otherTempCount=$(echo "$sanitisedSensorsOutput" \
|
||||
| grep -Ev '"(coretemp|k10temp-pci|cpu_thermal-virtual|nvme|drivetemp-scsi|SODIMM)[^"]*"' \
|
||||
| grep -c '"temp[0-9]*_input"' || true)
|
||||
|
||||
if [[ "$otherTempCount" -gt 0 ]]; then
|
||||
info "Detected $otherTempCount other temperature reading(s)."
|
||||
ENABLE_OTHER_TEMP=1; sensors_detected=true
|
||||
else
|
||||
warn "No other (non-CPU/RAM/HDD/NVMe) temperature sensors found."
|
||||
fi
|
||||
#region Other thermals
|
||||
|
||||
#region Fans
|
||||
@ -465,6 +475,7 @@ cpu_temp_target=${CPU_TEMP_TARGET}
|
||||
enable_ram_temp=${ENABLE_RAM_TEMP}
|
||||
enable_hdd_temp=${ENABLE_HDD_TEMP}
|
||||
enable_nvme_temp=${ENABLE_NVME_TEMP}
|
||||
enable_other_temp=${ENABLE_OTHER_TEMP}
|
||||
enable_fan_speed=${ENABLE_FAN_SPEED}
|
||||
display_zero_speed_fans=${DISPLAY_ZERO_SPEED_FANS}
|
||||
temp_unit=${TEMP_UNIT}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user