centreon-plugins icon indicating copy to clipboard operation
centreon-plugins copied to clipboard

enh(os::linux::local): added enhancements in storage mode

Open SavCent opened this issue 2 years ago • 1 comments

ummary of the modifications made to the script:

  • Added a new option --free-mountpoint to check free space instead of used space for a specific mount point.
  • Adjusted the usage of the --free-mountpoint option in the script to determine whether to use free space or used space for a specific mount point.
  • Removed the global --units option since thresholds are now explicitly set with --threshold-XX.
  • Modified the threshold calculation and usage output functions to consider the --free-mountpoint option and adjust the label accordingly.
  • Updated the set_counters method to use the new --free-mountpoint option instead of the obsolete --free option.

These changes allow users to specify different units and thresholds for each mount point individually, including the option to check free space instead of used space for a specific mount point.

Description

PLEASE MAKE SURE THAT THE BRANCH PR INCLUDES JIRA TICKET ID (for centreon-internal)

Please include a short resume of the changes and what is the purpose of PR. Any relevant information should be added to help:

  • QA Team (Quality Assurance) with tests.
  • reviewers to understand what are the stakes of the pull request.

Fixes # (issue)

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

Target serie

  • [ ] 22.04.x
  • [ ] 22.10.x
  • [ ] 23.04.x
  • [ ] 23.10.x
  • [ ] 24.04.x (master)

How this pull request can be tested ?

Please describe the procedure to verify that the goal of the PR is matched. Provide clear instructions so that it can be correctly tested.

Any relevant details of the configuration to perform the test should be added.

Checklist

Community contributors & Centreon team

  • [ ] I have followed the coding style guidelines provided by Centreon
  • [ ] I have commented my code, especially new classes, functions or any legacy code modified. (docblock)
  • [ ] I have commented my code, especially hard-to-understand areas of the PR.
  • [ ] I have rebased my development branch on the base branch (master, maintenance).

SavCent avatar Jan 31 '24 12:01 SavCent

Hi @SavCent, I'm sorry but no. This PR does not respect any Centreon Plugins designs. It breaks several options, metrics label. And I'm not even sure it does what you want to do. If you want to have a specific behaviour on a specific mountpoint, you'll need to focus on this mountpoint, like :

perl centreon_plugins.pl --plugin=os::linux::local::plugin --mode=storage --filter-mountpoint='^/var/log$' --free --units=B --critical-usage='400:' --change-perfdata='storage.space.free.bytes,storage.space.used.bytes,invert()' --change-perfdata='.*#(.*),$1'
OK: Storage '/var/log' Usage Total: 4.85 GB Used: 626.25 MB (13.25%) Free: 4.00 GB (86.75%) | 'storage.space.used.bytes'=909668352B;;~:5208964720;0;5208965120

Sure the --critical-usage is odd if you dealing with free space but, well, that's how it is. There are lots of options to do lots of things and cover lots of use cases over the years.

cgagnaire avatar Mar 07 '24 11:03 cgagnaire