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(errmsg): attempt to fix #4703 (renew old PR) #4892

Merged
merged 3 commits into from
Feb 27, 2024

Conversation

omercier
Copy link
Contributor

@omercier omercier commented Feb 9, 2024

Description

Attempt to fix #4703
Replaces #4725 and adds robot tests

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 mentioned this pull request Feb 9, 2024
2 tasks
@omercier omercier marked this pull request as ready for review February 9, 2024 10:03
@omercier omercier requested review from a team as code owners February 9, 2024 10:03
@omercier omercier merged commit a38259a into develop Feb 27, 2024
14 checks passed
@omercier omercier deleted the CTOR-74-avoid-uninitialized-values branch February 27, 2024 13:32
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 (+)
3 participants