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

Use of uninitialized value in addition (+) #4703

Closed
Benoit221 opened this issue Oct 17, 2023 · 4 comments · Fixed by #4892
Closed

Use of uninitialized value in addition (+) #4703

Benoit221 opened this issue Oct 17, 2023 · 4 comments · Fixed by #4892
Labels

Comments

@Benoit221
Copy link

Hello,

When executing this command :
perl centreon_plugins.pl --plugin=hardware::sensors::apc::snmp::plugin --mode=sensors --hostname=192.168.1.1 --snmp-community=public --snmp-version=2c --component humidity --warning='humidity,.,45:65' --critical='humidity,.,35:70'

I obtain this result :
Use of uninitialized value in addition (+) at /usr/lib/centreon/plugins/centreon-plugins/centreon/plugins/templates/hardware.pm line 303.
Use of uninitialized value in addition (+) at /usr/lib/centreon/plugins/centreon-plugins/centreon/plugins/templates/hardware.pm line 304.
Use of uninitialized value in concatenation (.) or string at /usr/lib/centreon/plugins/centreon-plugins/centreon/plugins/templates/hardware.pm line 305.
WARNING: Humidity 'Main Module:Sonde de temperature' is 36 % | 'Main Module:Sonde de temperature#hardware.sensor.humidity.percentage'=36%;45:65;35:70;0;100 'hardware.temperature.count'=1;;;;

Notice that it's working as expected for temperature sensor but not for humidity

Best regards,
B LORAND

@omercier
Copy link
Contributor

Hi @Benoit221,
Can you give me more context by adding the --debug option to the command line ?

@omercier omercier added the bug label Oct 23, 2023
@Benoit221
Copy link
Author

Hi @omercier,

We are using Centreon 23.04.9 on Debian 11. Actual centreon plugin is 20230912-083720.

root@Deb-Centreon:~/centreon-plugins# perl centreon_plugins.pl --plugin=hardware::sensors::apc::snmp::plugin --mode=sensors --hostname=192.168.1.1 --snmp-community=public --snmp-version=2c --component humidity --warning='humidity,.,45:65' --critical='humidity,.,35:70' --debug
Use of uninitialized value in addition (+) at /usr/lib/centreon/plugins/centreon-plugins/centreon/plugins/templates/hardware.pm line 303.
Use of uninitialized value in addition (+) at /usr/lib/centreon/plugins/centreon-plugins/centreon/plugins/templates/hardware.pm line 304.
Use of uninitialized value in concatenation (.) or string at /usr/lib/centreon/plugins/centreon-plugins/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;;;;
.1.3.6.1.4.1.318.1.1.10.4.1.2.1.2.0 = Main Module
.1.3.6.1.4.1.318.1.1.10.3.12.11.0 = 1
Checking humidities
.1.3.6.1.4.1.318.1.1.10.4.2.3.1.1.0.1 = 0
.1.3.6.1.4.1.318.1.1.10.4.2.3.1.2.0.1 = 1
.1.3.6.1.4.1.318.1.1.10.4.2.3.1.3.0.1 = Sonde de temperature
.1.3.6.1.4.1.318.1.1.10.4.2.3.1.4.0.1 = salle serveur 1
.1.3.6.1.4.1.318.1.1.10.4.2.3.1.5.0.1 = 23
.1.3.6.1.4.1.318.1.1.10.4.2.3.1.6.0.1 = 35
.1.3.6.1.4.1.318.1.1.10.4.2.3.1.7.0.1 = 2
.1.3.6.1.4.1.318.1.1.10.4.2.3.1.8.0.1 = 1
humidity 'Main Module:Sonde de temperature' alarm status is normal [instance: module.0.1] [value: 35] [comm: ok]

@omercier
Copy link
Contributor

omercier commented Nov 5, 2023

@Benoit221 I've tested it with your data (see PR comment) so it should work well if you add this simple line to your local code.
I cannot guarantee this fix will be the right one though, since it locates in a widely shared part of the code, so it might affect the behaviour of other plugins, so the real developers may reject it.

@omercier
Copy link
Contributor

Hi @Benoit221,
Your issue has been fixed.
The fix will be out mid-march in the rpm/deb packaged plugins.
Feel free to give feedback here!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants