feat(node_info): add configurable mod_debug toggle for verbose logging in config

This commit is contained in:
Meliox 2026-08-23 15:51:43 +02:00
parent 2a122ef3eb
commit 02f44f77ec
3 changed files with 14 additions and 1 deletions

View File

@ -17,7 +17,7 @@ our @EXPORT_OK = qw(
# Debug / Version # Debug / Version
# ============================================================================ # ============================================================================
our $DEBUG_ENABLED = 1; our $DEBUG_ENABLED; # derived from %config{debug}{mod_debug} after ini load, below
our $VERSION = 'version-placeholder'; our $VERSION = 'version-placeholder';
# ============================================================================ # ============================================================================
@ -43,6 +43,7 @@ our %config = (
gpu_history => 0, gpu_history => 0,
}, },
debug => { debug => {
mod_debug => 0,
log_enabled => 0, log_enabled => 0,
log_file => '/tmp/pve-mod-debug.log', log_file => '/tmp/pve-mod-debug.log',
lm_sensors_mode => 0, lm_sensors_mode => 0,
@ -159,4 +160,6 @@ sub _load_ini_file {
_load_ini_file($CONF_FILE); _load_ini_file($CONF_FILE);
_load_ini_file($_) for glob("$CONFD_DIR/*.conf"); _load_ini_file($_) for glob("$CONFD_DIR/*.conf");
$DEBUG_ENABLED = $config{debug}{mod_debug};
1; 1;

View File

@ -30,7 +30,11 @@ ignore_temp_below=5
# Debug mode: when a collector's mode is 1, the real tool is not required. # Debug mode: when a collector's mode is 1, the real tool is not required.
# Data is read from the file path instead. Useful for development/testing. # Data is read from the file path instead. Useful for development/testing.
# Note: debug settings are only read at pveproxy startup — restart pveproxy
# after changing them. Debug output goes to the journal (journalctl -u pveproxy),
# plus log_file if log_enabled=1.
[debug] [debug]
mod_debug=0
lm_sensors_mode=0 lm_sensors_mode=0
lm_sensors_output_file=/tmp/sensors-output.json lm_sensors_output_file=/tmp/sensors-output.json
intel_mode=0 intel_mode=0

View File

@ -78,6 +78,7 @@ node_info_defaults() {
DEBUG_AMD=0; DEBUG_AMD_FILE="/tmp/amd-gpu-devices.json" DEBUG_AMD=0; DEBUG_AMD_FILE="/tmp/amd-gpu-devices.json"
DEBUG_UPS=0; DEBUG_UPS_FILE="/tmp/ups-output.json" DEBUG_UPS=0; DEBUG_UPS_FILE="/tmp/ups-output.json"
DEBUG_LOG=0; DEBUG_LOG_FILE="/tmp/pve-mod-debug.log" DEBUG_LOG=0; DEBUG_LOG_FILE="/tmp/pve-mod-debug.log"
DEBUG_MOD=0
} }
node_info_load_conf() { node_info_load_conf() {
@ -124,6 +125,7 @@ node_info_load_conf() {
debug.ups_output_file) DEBUG_UPS_FILE="$val" ;; debug.ups_output_file) DEBUG_UPS_FILE="$val" ;;
debug.log_enabled) DEBUG_LOG="$val" ;; debug.log_enabled) DEBUG_LOG="$val" ;;
debug.log_file) DEBUG_LOG_FILE="$val" ;; debug.log_file) DEBUG_LOG_FILE="$val" ;;
debug.mod_debug) DEBUG_MOD="$val" ;;
esac esac
done < "$NODE_INFO_CONF" done < "$NODE_INFO_CONF"
} }
@ -512,7 +514,11 @@ ignore_temp_below=${IGNORE_TEMP_BELOW}
# Debug mode: when a collector's mode is 1, the real tool is not required. # Debug mode: when a collector's mode is 1, the real tool is not required.
# Data is read from the file path instead. Useful for development/testing. # Data is read from the file path instead. Useful for development/testing.
# Note: debug settings are only read at pveproxy startup — restart pveproxy
# after changing them. Debug output goes to the journal (journalctl -u pveproxy),
# plus log_file if log_enabled=1.
[debug] [debug]
mod_debug=${DEBUG_MOD}
lm_sensors_mode=${DEBUG_LM_SENSORS} lm_sensors_mode=${DEBUG_LM_SENSORS}
lm_sensors_output_file=${DEBUG_LM_SENSORS_FILE} lm_sensors_output_file=${DEBUG_LM_SENSORS_FILE}
intel_mode=${DEBUG_INTEL} intel_mode=${DEBUG_INTEL}