I am attempting to use the check_xi_ncpa command to verify if a string exists when I query the api and then define what the output status should be if it does exist.
Current Check:
-t 'token' -P 5693 -M 'disk/logical/|data/opts'
Current Output:
OK: Opts was ['rw,nosuid,nodev,relatime,attr2,inode64,sunit=16,swidth=8192,noquota']
Is it possible to set the check options to return a Critical status if "nosuid" exists in the output? I am attempting to do some sort of match regex but no luck so far. Ideally if "nosuid" exists when running the check this is what the output would look like:
CRITICAL: Opts was ['rw,nosuid,nodev,relatime,attr2,inode64,sunit=16,swidth=8192,noquota']
define check_xi_ncpa output status using regex
-
meganwilliford
- Posts: 101
- Joined: Tue Aug 06, 2019 7:49 am
Re: define check_xi_ncpa output status using regex
The functionality to do that doesn't currently exist. Your only options would be to find a plugin that checks for nosuid and call that plugin, write your own plugin and call that, or write a wrapper script on the XI side that would run the NCPA command, parse it to do what you'd like, then adjust the exit code/output accordingly.
If you would like that functionality added, you can submit a feature request here:
https://github.com/NagiosEnterprises/ncpa/issues
If you would like that functionality added, you can submit a feature request here:
https://github.com/NagiosEnterprises/ncpa/issues
-
meganwilliford
- Posts: 101
- Joined: Tue Aug 06, 2019 7:49 am
Re: define check_xi_ncpa output status using regex
Thanks for the response! I was actually able to figure out another way:
/usr/local/nagios/libexec/check_http -H <hostname> -p 5693 -S -u '/api/disk/logical/|data/opts?token=<token>&check=1' -r .*nosuid.* --invert-regex
You can close this thread.
/usr/local/nagios/libexec/check_http -H <hostname> -p 5693 -S -u '/api/disk/logical/|data/opts?token=<token>&check=1' -r .*nosuid.* --invert-regex
You can close this thread.
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: define check_xi_ncpa output status using regex
Greatmeganwilliford wrote:Thanks for the response! I was actually able to figure out another way:
/usr/local/nagios/libexec/check_http -H <hostname> -p 5693 -S -u '/api/disk/logical/|data/opts?token=<token>&check=1' -r .*nosuid.* --invert-regex
You can close this thread.
Locking thread