Page 1 of 1

check_disk permission denied as warning instead of cirtical

Posted: Fri Dec 14, 2018 8:29 am
by DooMRunneR
Hello,

i don't run the check_disk binary (2.2.1) as root/sudo and i don't want to, i exclude "permission denied" deivce paths or filesystems for the affected systems.

But something that bothers me is the fact that a "permission denied" always runs into a critical error. Nagios automatically calls our 24/7 support on the phone on Critical errors but something like a "permission denied" was always a bind mount, overlay fs or something similar.

Is it somehow possible to change this to a warning instead of a critical error, warnings are errors we fix on the next business day and not in the middle of the night.

Kind Regards

Re: check_disk permission denied as warning instead of cirti

Posted: Fri Dec 14, 2018 1:29 pm
by npolovenko
Hello, @DooMRunneR. The logic on when to return a Critical state is hardcoded in the plugin itself. The only way to change the condition for this particular plugin is to modify the source code and then recompile it.
https://github.com/nagios-plugins/nagio ... eck_disk.c

We do have a check_negate plugin that can revert all critical states of this plugin into warnings.
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
But I'm guessing you still want to see a critical output when a disk is running out of space?

Re: check_disk permission denied as warning instead of cirti

Posted: Fri Dec 14, 2018 1:34 pm
by mcapra
Shy of rebuilding check_disk, you could probably write a wrapper script in Bash pretty easily to translate stdout matching "permission denied" and a return code of "CRITICAL" to "UNKNOWN" or some other output more convenient for your use case. I'd be happy to give pointers on such an implementation.

Alternatively, you could request such native functionality for check_disk by filing an issue on GitHub:
https://github.com/nagios-plugins/nagios-plugins/issues

Re: check_disk permission denied as warning instead of cirti

Posted: Fri Dec 14, 2018 2:53 pm
by npolovenko
Shy of rebuilding check_disk, you could probably write a wrapper script in Bash pretty easily to translate stdout matching "permission denied" and a return code of "CRITICAL" to "UNKNOWN" or some other output more convenient for your use case. I'd be happy to give pointers on such an implementation.
Good idea.