Page 2 of 2

Re: How to check SQL jobs (particular jobs)

Posted: Tue Oct 29, 2019 2:19 pm
by dlukinski
mbellerue wrote:What is the actual result of the query?
CRITICAL: Query result cdc.Siebeldb_QA_capture was higher than Query critical threshold 2

Re: How to check SQL jobs (particular jobs)

Posted: Tue Oct 29, 2019 2:41 pm
by lmiltchev
Hi, query works now, but provides a strange result:

CRITICAL: Query result cdc.Siebeldb_QA_capture was higher than Query critical threshold 2.

- we need this to be critical if the job is not running (--querywarning 1 --querycritical 2 --result "Expected result")
When your result exceeds the querywarning or querycritical threshold, then you would get a non-OK state. This is by design.

See the usage of the plugin by running:

Code: Select all

/usr/local/nagios/libexec/check_mssql -h
-w, --warning Warning threshold in seconds on duration of check
-c, --critical Critical threshold in seconds on duration of check
-W, --querywarning Query warning threshold
-C, --querycritical Query critical threshold

Re: How to check SQL jobs (particular jobs)

Posted: Wed Oct 30, 2019 10:51 am
by lmiltchev
One more thing to clarify... If you are expecting an integer as a result, then you can use the querywarning and querycritical thresholds.

Example:

Code: Select all

/usr/local/nagios/libexec/check_mssql -H x.x.x.x --username test --password test --database master --instance test --query "SELECT+COUNT%28%2A%29+FROM+sys.sysperfinfo" --result "1008" --decode --warning 1 --critical 2 --querywarning 1500 --querycritical 2000
OK: Query duration=0.001114 seconds. Query result=1008|query_duration=0.001114s;1;2 'computed0'=1008;1500;2000

/usr/local/nagios/libexec/check_mssql -H x.x.x.x --username test --password "test" --database master --instance test --query "SELECT+COUNT%28%2A%29+FROM+sys.sysperfinfo" --result "1008" --decode --warning 1 --critical 2 --querywarning 500 --querycritical 1000
CRITICAL: Query result 1008 was higher than Query critical threshold 1000.|query_duration=0.000929s;1;2 'computed0'=1008;500;1000
If however, your output is a string, you don't pass the querywarning and querycritical thresholds... If are expecting "cdc.Siebeldb_QA_capture", then you should use:

Code: Select all

--result "cdc.Siebeldb_QA_capture"
in your command, and NOT use the querywarning and querycritical thresholds. If the result matches, then you would get "OK", if not - you would get "CRITICAL".

Let us know if you have any further questions.