Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(err-msg): attempt to fix #4703 #4725

Closed
wants to merge 1 commit into from

Conversation

omercier
Copy link
Contributor

@omercier omercier commented Nov 5, 2023

Description

Attempt to fix #4703

Not understanding such a simple thing as "why this value comes undefined" has been vexing me, so I had to look for the truth and tried perl -d. What does not kill you makes you stronger, they said :')

Tested with data provided by the issue creator:

.1.3.6.1.4.1.318.1.1.10.3.12.11.0 = INTEGER: 1
.1.3.6.1.4.1.318.1.1.10.4.1.2.1.2.0 = STRING: Main Module
.1.3.6.1.4.1.318.1.1.10.4.2.3.1.1.0.1 = INTEGER: 0
.1.3.6.1.4.1.318.1.1.10.4.2.3.1.2.0.1 = INTEGER: 1
.1.3.6.1.4.1.318.1.1.10.4.2.3.1.3.0.1 = STRING: Sonde de temperature
.1.3.6.1.4.1.318.1.1.10.4.2.3.1.4.0.1 = STRING: salle serveur 1
.1.3.6.1.4.1.318.1.1.10.4.2.3.1.5.0.1 = INTEGER: 23
.1.3.6.1.4.1.318.1.1.10.4.2.3.1.6.0.1 = INTEGER: 35
.1.3.6.1.4.1.318.1.1.10.4.2.3.1.7.0.1 = INTEGER: 2
.1.3.6.1.4.1.318.1.1.10.4.2.3.1.8.0.1 = INTEGER: 1

Results without fix (for regression check)

All components checked

$ perl  centreon_plugins.pl --plugin=hardware::sensors::apc::snmp::plugin --mode=sensors --hostname=192.168.59.1 --snmp-port=8161 --snmp-community=issue_4703 --snmp-version=2c --component '.*' --warning='humidity,.,45:65' --critical='humidity,.,35:70' --verbose
WARNING: Humidity 'Main Module:Sonde de temperature' is 35 % | 'Main Module:Sonde de temperature#hardware.sensor.temperature.celsius'=23C;;;; 'Main Module:Sonde de temperature#hardware.sensor.humidity.percentage'=35%;45:65;35:70;0;100 'hardware.temperature.count'=2;;;;
Checking temperatures
temperature 'Main Module:Sonde de temperature' alarm status is normal [instance: module.0.1] [value: 23] [comm: ok]
Checking humidities
humidity 'Main Module:Sonde de temperature' alarm status is normal [instance: module.0.1] [value: 35] [comm: ok]
Checking fluids

Only humidity (when the error from #4703 appears)

$ perl  centreon_plugins.pl --plugin=hardware::sensors::apc::snmp::plugin --mode=sensors --hostname=192.168.59.1 --snmp-port=8161 --snmp-community=issue_4703 --snmp-version=2c --component 'humidity' --warning='humidity,.,45:65' --critical='humidity,.,35:70' 
Use of uninitialized value in addition (+) at /var/lib/centreon-engine/centreon-plugins/src/centreon/plugins/templates/hardware.pm line 303.
Use of uninitialized value in addition (+) at /var/lib/centreon-engine/centreon-plugins/src/centreon/plugins/templates/hardware.pm line 304.
Use of uninitialized value in concatenation (.) or string at /var/lib/centreon-engine/centreon-plugins/src/centreon/plugins/templates/hardware.pm line 305.
WARNING: Humidity 'Main Module:Sonde de temperature' is 35 % | 'Main Module:Sonde de temperature#hardware.sensor.humidity.percentage'=35%;45:65;35:70;0;100 'hardware.temperature.count'=1;;;;

Only temperature

$ perl  centreon_plugins.pl --plugin=hardware::sensors::apc::snmp::plugin --mode=sensors --hostname=192.168.59.1 --snmp-port=8161 --snmp-community=issue_4703 --snmp-version=2c --component 'temperature' --warning='humidity,.,45:65' --critical='humidity,.,35:70' 
OK: All 1 components are ok [1/1 temperatures]. | 'Main Module:Sonde de temperature#hardware.sensor.temperature.celsius'=23C;;;; 'hardware.temperature.count'=1;;;;

Results with fix

All components checked

$ perl  centreon_plugins.pl --plugin=hardware::sensors::apc::snmp::plugin --mode=sensors --hostname=192.168.59.1 --snmp-port=8161 --snmp-community=issue_4703 --snmp-version=2c --warning='humidity,.,45:65' --critical='humidity,.,35:70' --verbose
WARNING: Humidity 'Main Module:Sonde de temperature' is 35 % | 'Main Module:Sonde de temperature#hardware.sensor.temperature.celsius'=23C;;;; 'Main Module:Sonde de temperature#hardware.sensor.humidity.percentage'=35%;45:65;35:70;0;100 'hardware.temperature.count'=2;;;;
Checking temperatures
temperature 'Main Module:Sonde de temperature' alarm status is normal [instance: module.0.1] [value: 23] [comm: ok]
Checking humidities
humidity 'Main Module:Sonde de temperature' alarm status is normal [instance: module.0.1] [value: 35] [comm: ok]
Checking fluids

NB: the result is the same without the --component option.

Only humidity

$ perl  centreon_plugins.pl --plugin=hardware::sensors::apc::snmp::plugin --mode=sensors --hostname=192.168.59.1 --snmp-port=8161 --snmp-community=issue_4703 --snmp-version=2c --component 'humidity' --warning='humidity,.,45:65' --critical='humidity,.,35:70' 
WARNING: Humidity 'Main Module:Sonde de temperature' is 35 % | 'Main Module:Sonde de temperature#hardware.sensor.humidity.percentage'=35%;45:65;35:70;0;100

Only temperature

$ perl  centreon_plugins.pl --plugin=hardware::sensors::apc::snmp::plugin --mode=sensors --hostname=192.168.59.1 --snmp-port=8161 --snmp-community=issue_4703 --snmp-version=2c --component 'temperature' --warning='humidity,.,45:65' --critical='humidity,.,35:70' 
OK: All 1 components are ok [1/1 temperatures]. | 'Main Module:Sonde de temperature#hardware.sensor.temperature.celsius'=23C;;;; 'hardware.temperature.count'=1;;;;

Type of change

  • Patch fixing an issue (non-breaking change)
  • New functionality (non-breaking change)
  • [?] Breaking change (patch or feature) that might cause side effects breaking part of the Software

@omercier omercier requested review from a team and itoussies November 5, 2023 21:40
@omercier omercier mentioned this pull request Nov 5, 2023
3 tasks
@omercier
Copy link
Contributor Author

omercier commented Feb 9, 2024

Abandoned because of many conflicts, replaced by #4892

@omercier omercier closed this Feb 9, 2024
@omercier omercier deleted the MON-24199-avoid-uninitialized-values branch February 9, 2024 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use of uninitialized value in addition (+)
1 participant