Page 1 of 1
System Timezone Using check_xi_ncpa
Posted: Thu Jun 18, 2020 11:03 am
by esostarich
Hello,
I am using the check_xi_ncpa command with an argument of -M 'system/timezone', which is successfully listing the timezone. That said, I am unable to create a critical threshold that will error when the timezone is anything other than the desired timezone. For example, error when timezone does not equal UTC.
Re: System Timezone Using check_xi_ncpa
Posted: Thu Jun 18, 2020 4:55 pm
by cdienger
It doesn't appear that string match is an option. I would suggest adding your name to the enhancement request at
https://github.com/NagiosEnterprises/ncpa/issues/550.
Re: System Timezone Using check_xi_ncpa
Posted: Fri Jun 19, 2020 10:17 am
by esostarich
Thank you for your response. Is there a preferred plugin that you could recommend for this use case, in the meantime?
Re: System Timezone Using check_xi_ncpa
Posted: Fri Jun 19, 2020 3:06 pm
by cdienger
The check_http plugin could be used. For example:
Code: Select all
/usr/local/nagios/libexec/check_http -H IP -p 5693 -S -u '/api/system/timezone/?token=<TOKEN>&check=1' -v -r .*UTC.*
where <TOKEN> is the NCPA token assigned to the agent.
The above will connect to the NCPA service, pull that URL(passing it the token to authenticate), and then check the results to see if it contains UTC. A CRITICAL state will be triggered if it doesn't find a match. You can see all the options for check_http with:
Code: Select all
/usr/local/nagios/libexec/check_http --help
and see verbose output with "-v". For example:
Code: Select all
/usr/local/nagios/libexec/check_http -H IP -p 5693 -S -u '/api/system/timezone/?token=<TOKEN>&check=1' -v -r .*UTC.* -v