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

feat: Fix and improve state evaluation for "disk status" check #28

Merged
merged 1 commit into from
Apr 22, 2022

Conversation

amotl
Copy link
Contributor

@amotl amotl commented Mar 14, 2022

Dear Frederic,

it's me again ;]. While looking at the code in more detail, we discovered a minor flaw and thought it would be a good idea to submit a patch. Beforehand, the code would only detect disk status SystemPartitionFailed, while Crashed would have been missed.

After fixing that, the code has been expanded to offer a more general approach for converging sensor states of multiple items (here: disks) into a single outcome state. Now, the state evaluation flow is more linear and can easily be reused for all other checks involving multiple items. We hope you like it.

With kind regards,
Andreas.

Comment on lines -124 to -125
if critical and critical < int(disk_temp) or int(disk_status_nr) == (4 or 5):
state = 'CRITICAL'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

>>> 4 or 5
4

☝️ 🤷

Beforehand, the code would only detect `SystemPartitionFailed`, while
`Crashed` would have been missed.

After fixing that, the code has been expanded to offer a more general
approach for converging sensor states of *multiple* items (here: disks)
into a single outcome state. Now, the state evaluation flow is more
linear and can easily be reused for all other checks involving multiple
items.
Copy link
Owner

@wernerfred wernerfred left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wernerfred wernerfred merged commit 396ea24 into wernerfred:master Apr 22, 2022
@amotl amotl deleted the fix-disk-status branch April 26, 2022 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants