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

Display messages for drives with UNKNOWN status #89

Merged
merged 1 commit into from
Apr 29, 2023

Conversation

nabertrand
Copy link
Contributor

The plugin currently discards messages for drives that have an UNKNOWN status. This patch causes those messages to be included in the output. Example:

$ /usr/lib64/nagios/plugins/check_smart.pl -b 40 -g /dev/sg8 -i 'cciss,[1-21]' -q
UNKNOWN: [cciss,21] - No health status line found[cciss,21] - [cciss,21] -  --- Other drives OK|

@Napsty
Copy link
Owner

Napsty commented Apr 26, 2023

I finally had a few minutes to look at this. I like the idea. But there might be users which use the glob expression to quickly parse through all drives and willingly ignore UNKNOWN status. If they update the plugin they might get a ton of alerts on servers which they are monitoring like this.

So I suggest we add a parameter to disable the unknown drives in the output. E.g. --skip-unknown-drive or --ignore-unknown-drives . By default this should be enabled though.

@Napsty
Copy link
Owner

Napsty commented Apr 29, 2023

OK I misunderstood the PR. Now I see the need to implement this:

root@nas:~# ./check_smart.pl -g '/dev/sd[a-z]' -i auto
UNKNOWN: [/dev/sda] - Device is clean --- [/dev/sdb] - Device is clean --- [/dev/sdc] - Device is clean --- [/dev/sdd] - Device is clean --- [/dev/sdf] - Device is clean|

In this system, the drive /dev/sde is a MMC/Memory Stick. The plugin exits with status UNKNOWN but the output does not indicate which drive caused the unknown status.

With your PR, this makes more sense now:

root@nas:~/check_smart# ./check_smart.pl -g '/dev/sd[a-z]' -i auto
UNKNOWN: [/dev/sde] - No health status line found[/dev/sde] - [/dev/sde] -  --- [/dev/sda] - Device is clean --- [/dev/sdb] - Device is clean --- [/dev/sdc] - Device is clean --- [/dev/sdd] - Device is clean --- [/dev/sdf] - Device is clean|

Thanks to the additional output, the drive /dev/sde is immediately shown as the cause for the UNKNOWN status. Saves troubleshooting time.

Awesome, thanks!

@Napsty Napsty merged commit e352544 into Napsty:master Apr 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants