Skip to content

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

@paulgevers

Description

@paulgevers

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugUndesired behaviourresolvedA fixed issue

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions