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

Utilities view has calculation errors when there are no data sources #4472

Closed
paulgevers opened this issue Nov 21, 2021 · 2 comments
Closed
Labels
bug Undesired behaviour resolved A fixed issue
Milestone

Comments

@paulgevers
Copy link
Contributor

Describe the bug

[Background / thanks]
I am in the process of packaging Cacti 1.2.19 and found that you adopted my CI test. Thanks for doing that.

[Issue]
I ran tests/tools/check_all_pages.sh (after minor tweaks for Debian specifics) on a fresh installed cacti in a fresh container and it fails with:

ERROR: Fail - Unexpected output in /usr/share/cacti/site/log/cacti.log:
2021-11-21 08:18:55 - ERROR PHP WARNING: Division by zero in file: /usr/share/cacti/site/utilities.php  on line: 2229
2021-11-21 08:18:55 - CMDPHP PHP ERROR WARNING Backtrace:  (/utilities.php[84]:boost_display_run_status(), /utilities.php[2229]:CactiErrorHandler())
2021-11-21 08:18:55 - ERROR PHP WARNING: Division by zero in file: /usr/share/cacti/site/utilities.php  on line: 2339
2021-11-21 08:18:55 - CMDPHP PHP ERROR WARNING Backtrace:  (/utilities.php[84]:boost_display_run_status(), /utilities.php[2339]:CactiErrorHandler())

As this is a fresh install, I'm not surprised that $data_sources is zero. However, utilities.php#L2229 and utilities.php#L2239 unilaterally divide by the value.

As this obviously is a weird situation (no data_sources at all) I'm not sure if you want to properly fix this, but it would make the test simpler (I now added the error to the list of ignored errors).

To Reproduce

Steps to reproduce the behavior:

  1. On a fresh install without any data sources run tests/tools/check_all_pages.sh

Expected behavior

check_all_pages.sh should pass.

Desktop (please complete the following information)

  • OS: Debian testing

  • wget

  • 1.21.2

@paulgevers paulgevers added bug Undesired behaviour unverified Some days we don't have a clue labels Nov 21, 2021
@netniV netniV changed the title [1.2.19] Debian CI: "Division by zero in file: utilities.php" Utilities view has calculation errors when there are no data sources Nov 22, 2021
@majed17
Copy link

majed17 commented Nov 29, 2021

i upgraded from php7 to 8, also this version of cacti, and applied the change mentioned here, but i am still getting:

-  CMDPHP PHP ERROR WARNING Backtrace:   (/cmd_realtime.php[201]:cacti_snmp_session_get(),  /lib/snmp.php[492]:SNMP->get(), CactiErrorHandler())
--
2021/11/29 16:12:55 - ERROR PHP WARNING: SNMP::get(): Fatal error:  USM generic error in file: /usr/share/cacti/lib/snmp.php  on line: 492

@netniV
Copy link
Member

netniV commented Nov 29, 2021

@majed17 that should be logged as a separate issue. Whilst they are all PHP 8 related, it is easier to track them individually. The USM generic may be something out of our hands though if it's in the core PHP libraries, all we would do is trap the error. There is a change we made to suppress PHP errors around SNMP-GET for that reason though I'm not sure if that's in 1.2.19 or not without searching.

@TheWitness TheWitness added resolved A fixed issue and removed unverified Some days we don't have a clue labels Dec 10, 2021
@TheWitness TheWitness added this to the v1.2.20 milestone Dec 10, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Mar 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Undesired behaviour resolved A fixed issue
Projects
None yet
Development

No branches or pull requests

4 participants