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

If statement added when $total == 0 #5141

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

jouleSoft
Copy link

@jouleSoft jouleSoft commented Aug 21, 2024

Community contributors

Description

There are cases when storage-pools with totalCapacity property equal to "0". For example, Casette Tape Backup Libraries:

<Api_GetStoragePoolListResp>
    <storagePoolList numberOfNodes="1" poolRetentionPeriodDays="365" cloudStorageClassNumber="-1" isArchiveStorage="0" libraryVendorType="0" totalFreeSpace="0" storagePoolType="2" storageSubType="0" totalCapacity="0" wormStoragePoolFlag="0" storageType="4" reserved1="1" status="Online" statusCode="0">
        [... text omited ...]
    </storagePoolList>
</Api_GetStoragePoolListResp>

Type of change

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

How this pull request can be tested ?

Just executing the plugin against a CommServe API when StoragePools with totalCapacity property equal to "0".

Without the fix, the return string will be:

UNKNOWN: Illegal division by zero at /usr/lib/centreon/plugins//centreon_commvault_commserve_restapi.pl line 1547.

Checklist

  • I have followed the coding style guidelines provided by Centreon
  • I have commented my code, especially hard-to-understand areas of the PR.
  • I have rebased my development branch on the base branch (develop).
  • I have provide data or shown output displaying the result of this code in the plugin area concerned.

@gagzou
Copy link

gagzou commented Nov 6, 2024

Hi, fix is ok for me (OK: All storage pools are ok)

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

Successfully merging this pull request may close these issues.

3 participants