minor fixes for method call references

This commit is contained in:
Meliox 2026-04-06 16:56:32 +02:00
parent edd4b6b6ac
commit 890b956f39
3 changed files with 22 additions and 35 deletions

View File

@ -19,7 +19,7 @@ my %config = (
gpu => { gpu => {
intel_enabled => 1, intel_enabled => 1,
amd_enabled => 0, amd_enabled => 0,
nvidia_enabled => 1, nvidia_enabled => 0,
}, },
debug => { debug => {
nvidia_mode => 1, nvidia_mode => 1,
@ -174,22 +174,6 @@ sub _acquire_exclusive_lock {
return $fh; return $fh;
} }
sub _is_lock_stale {
my ($lock_path) = @_;
return 0 unless open(my $fh, '<', $lock_path);
my $lock_pid = <$fh>;
chomp $lock_pid if defined $lock_pid;
close($fh);
# Invalid or missing PID
return 1 unless defined $lock_pid && $lock_pid =~ /^\d+$/;
# Valid PID but process is dead
return !_is_process_alive($lock_pid);
}
sub _ensure_pve_mod_directory_exists { sub _ensure_pve_mod_directory_exists {
unless (-d $pve_mod_working_dir) { unless (-d $pve_mod_working_dir) {
_debug(__LINE__, "Creating directory $pve_mod_working_dir"); _debug(__LINE__, "Creating directory $pve_mod_working_dir");
@ -1383,7 +1367,7 @@ sub _parse_upsc_output {
# API calls # API calls
# ============================================================================ # ============================================================================
sub get_graphic_stats { sub get_graphic_info {
# todo name the process without overruling other processes # todo name the process without overruling other processes
_debug(__LINE__, "get_graphic_stats called"); _debug(__LINE__, "get_graphic_stats called");
@ -1483,7 +1467,7 @@ sub get_graphic_stats {
return $last_snapshot; return $last_snapshot;
} }
sub get_sensors_stats { sub get_sensors_info {
_debug(__LINE__, "get_sensors_stats called"); _debug(__LINE__, "get_sensors_stats called");
# Start PVE Mod # Start PVE Mod
@ -1516,7 +1500,7 @@ sub get_sensors_stats {
return $sensors_data; return $sensors_data;
} }
sub get_ups_stats { sub get_ups_info {
_debug(__LINE__, "get_ups_stats called"); _debug(__LINE__, "get_ups_stats called");
# Start PVE Mod # Start PVE Mod
@ -2006,4 +1990,4 @@ END {
} }
} }
1; 1;

View File

@ -158,7 +158,7 @@ Ext.define('PVE.node.StatusView', {
iconCls: 'fa fa-fw fa-desktop', iconCls: 'fa fa-fw fa-desktop',
title: gettext('GPU Usage'), title: gettext('GPU Usage'),
printBar: false, printBar: false,
textField: 'gpuStats', textField: 'PveMod_graphicsInfo',
renderer: function(gpuStats) { renderer: function(gpuStats) {
if (!gpuStats || !gpuStats.Graphics) { if (!gpuStats || !gpuStats.Graphics) {
return ''; return '';
@ -279,7 +279,7 @@ Ext.define('PVE.node.StatusView', {
printBar: false, printBar: false,
title: gettext('CPU Thermal State'), title: gettext('CPU Thermal State'),
iconCls: 'fa fa-fw fa-thermometer-half', iconCls: 'fa fa-fw fa-thermometer-half',
textField: 'pveMod_sensorInfo_json', textField: 'PveMod_JsonSensorInfo',
renderer: function(value){ renderer: function(value){
// sensors configuration // sensors configuration
const cpuTempHelper = Ext.create('PVE.mod.TempHelper', {srcUnit: PVE.mod.TempHelper.CELSIUS, dstUnit: PVE.mod.TempHelper.CELSIUS}); const cpuTempHelper = Ext.create('PVE.mod.TempHelper', {srcUnit: PVE.mod.TempHelper.CELSIUS, dstUnit: PVE.mod.TempHelper.CELSIUS});
@ -453,7 +453,7 @@ Ext.define('PVE.node.StatusView', {
iconCls: 'fa fa-fw fa-desktop', iconCls: 'fa fa-fw fa-desktop',
title: gettext('GPU Details'), title: gettext('GPU Details'),
printBar: false, printBar: false,
textField: 'gpuStats', textField: 'PveMod_graphicsInfo',
renderer: function(gpuStats) { renderer: function(gpuStats) {
if (!gpuStats || !gpuStats.Graphics) { if (!gpuStats || !gpuStats.Graphics) {
return ''; return '';
@ -564,7 +564,7 @@ Ext.define('PVE.node.StatusView', {
printBar: false, printBar: false,
title: gettext('NVMe Temperatures'), title: gettext('NVMe Temperatures'),
iconCls: 'fa fa-fw fa-thermometer-half', iconCls: 'fa fa-fw fa-thermometer-half',
textField: 'pveMod_sensorInfo_json', textField: 'PveMod_JsonSensorInfo',
renderer: function(value) { renderer: function(value) {
// sensors configuration // sensors configuration
const addressPrefix = "nvme-pci-"; const addressPrefix = "nvme-pci-";
@ -649,7 +649,7 @@ Ext.define('PVE.node.StatusView', {
printBar: false, printBar: false,
title: gettext('System Fans'), title: gettext('System Fans'),
iconCls: 'fa fa-fw fa-snowflake-o', iconCls: 'fa fa-fw fa-snowflake-o',
textField: 'pveMod_sensorInfo_json', textField: 'PveMod_JsonSensorInfo',
renderer: function(value) { renderer: function(value) {
// --- // ---
let objValue; let objValue;
@ -711,13 +711,15 @@ Ext.define('PVE.node.StatusView', {
printBar: false, printBar: false,
title: gettext('GPU Fans'), title: gettext('GPU Fans'),
iconCls: 'fa fa-fw fa-snowflake-o', iconCls: 'fa fa-fw fa-snowflake-o',
textField: 'gpuStats', textField: 'PveMod_graphicsInfo',
renderer: function(gpuStats) { renderer: function(gpuStats) {
if (!gpuStats || !gpuStats.Graphics || !gpuStats.Graphics.NVIDIA) { if (!gpuStats || !gpuStats.Graphics || !gpuStats.Graphics.NVIDIA) {
return 'N/A'; return '';
} }
let rows = []; let rows = [];
// todo: handle intel, amd
Object.keys(gpuStats.Graphics.NVIDIA).sort().forEach(key => { Object.keys(gpuStats.Graphics.NVIDIA).sort().forEach(key => {
const gpuData = gpuStats.Graphics.NVIDIA[key]; const gpuData = gpuStats.Graphics.NVIDIA[key];
@ -737,7 +739,7 @@ Ext.define('PVE.node.StatusView', {
'</tr>', '</tr>',
); );
}); });
if (rows.length === 0) { if (rows.length === 0) {
return 'N/A'; return 'N/A';
} }
@ -751,7 +753,7 @@ Ext.define('PVE.node.StatusView', {
printBar: false, printBar: false,
title: gettext('UPS Status'), title: gettext('UPS Status'),
iconCls: 'fa fa-fw fa-battery-three-quarters', iconCls: 'fa fa-fw fa-battery-three-quarters',
textField: 'upsStats', textField: 'PveMod_upsInfo',
renderer: function(value) { renderer: function(value) {
let objValue = {}; let objValue = {};
try { try {
@ -985,7 +987,7 @@ Ext.define('PVE.node.StatusView', {
colspan: 2, colspan: 2,
printBar: false, printBar: false,
title: gettext('Sensor Mod Version'), title: gettext('Sensor Mod Version'),
textField: 'pveMod_sensorInfo_version', textField: 'PveMod_Version',
value: '', value: '',
}, },
{ {
@ -993,7 +995,7 @@ Ext.define('PVE.node.StatusView', {
colspan: 2, colspan: 2,
printBar: false, printBar: false,
title: gettext('Information'), title: gettext('Information'),
textField: 'pveMod_sensorInfo_systemInfo', textField: 'PveMod_systemInfo',
renderer: function(value) { renderer: function(value) {
if (value === null || value === undefined) { if (value === null || value === undefined) {
return ''; return '';
@ -1029,4 +1031,4 @@ Ext.define('PVE.node.StatusView', {
me.callParent(); me.callParent();
}, },
}); });

View File

@ -569,8 +569,9 @@ insert_sensor_monitor_into_pve() {
# Collect sensor data from PveMod_SensorInfo\ # Collect sensor data from PveMod_SensorInfo\
# Bad practice to add use here, but cleaner implementation would require several extensive modifications.\ # Bad practice to add use here, but cleaner implementation would require several extensive modifications.\
use PVE::API2::PVEMod_SensorInfo;\ use PVE::API2::PVEMod_SensorInfo;\
$res->{pveMod_sensorInfo_json} = PVE::API2::PVEMod_SensorInfo::get_sensors_stats();\ $res->{PveMod_JsonSensorInfo} = PVE::API2::PVEMod_SensorInfo::get_sensors_info();\
$res->{pveMod_sensorInfo_version} = PVE::API2::PVEMod_SensorInfo::get_pve_mod_version();\ $res->{PveMod_graphicsInfo} = PVE::API2::PVEMod_SensorInfo::get_pve_mod_version();\
$res->{PveMod_upsInfo} = PVE::API2::PVEMod_SensorInfo::get_ups_info();\
' "$NODES_PM_FILE" ' "$NODES_PM_FILE"
#endregion PveSensorInfoMod heredoc #endregion PveSensorInfoMod heredoc
info "Sensor data retriever added to \"$NODES_PM_FILE\"." info "Sensor data retriever added to \"$NODES_PM_FILE\"."