Page 1 of 1

Trouble with check_mssql

Posted: Mon May 18, 2020 1:11 pm
by proxibid
Running directly on my xi host -

Code: Select all

php /usr/local/nagios/libexec/check_mssql -H 10.50.103.33 -U nagios -P password -d database -q "SELECT COUNT(*) FROM database.dbo.AuctionHouses WHERE (APN_ID IS NULL OR FTNI_Site_ID IS NULL) AND ApplicationStep > 0 AND AuctionHouseID >= 6284" -wrc 1 -crc 1

OK: Query duration=0.035825 seconds. Query result=1|query_duration=0.035825s;; 'computed0'=1;
1) Since the row count is 1, should this be showing as OK?

2) Running check command from XI GUI, I get this -

Code: Select all

 php /usr/local/nagios/libexec/check_mssql -H 10.50.103.33 -U nagios -P password-d database -q "SELECT COUNT(*) FROM database.dbo.AuctionHouses WHERE (APN_ID IS NULL OR FTNI_Site_ID IS NULL) AND ApplicationStep > 0 AND AuctionHouseID >= 6284" -wrc 1 -crc 1

CRITICAL: Could not execute the Query.
Is the check running properly at all? Is it just Check command that is not working?

This check is showing green in XI but should be in critical state.

Re: Trouble with check_mssql

Posted: Tue May 19, 2020 1:15 pm
by cdienger
The test may be failing but the check may be working. Can you provide us a screenshot of the Service Status Detail page(where it shows green) so that we can see the status and the values returned?

Do you want CRITICAL to be returned when there are 1 more lines returned? If so, try running it like this:

Code: Select all

php /usr/local/nagios/libexec/check_mssql -H 10.50.103.33 -U nagios -P password -d database -q "SELECT COUNT(*) FROM database.dbo.AuctionHouses WHERE (APN_ID IS NULL OR FTNI_Site_ID IS NULL) AND ApplicationStep > 0 AND AuctionHouseID >= 6284" -wrc 0 -crc 0

Re: Trouble with check_mssql

Posted: Tue May 19, 2020 1:31 pm
by proxibid
Attaching screenshot.

I'll try setting that down to 0.

Re: Trouble with check_mssql

Posted: Tue May 19, 2020 1:36 pm
by proxibid
Set down to 0 - query is returning 1 -

This is what is in the box for Monitor the service with this command:

check_mssql_table_row_count!"SELECT COUNT(*) FROM proxibid.dbo.AuctionHouses WHERE (APN_ID IS NULL OR FTNI_Site_ID IS NULL) AND ApplicationStep > 0 AND AuctionHouseID >= 6284"!0!0!!!!!

Screenshot attached is service detail with that command.

Re: Trouble with check_mssql

Posted: Wed May 20, 2020 8:32 am
by proxibid
Our fault. Passing bad params.

after changing from -wrc and -crc to -W and -C functions as expected.

Re: Trouble with check_mssql

Posted: Wed May 20, 2020 9:37 am
by cdienger
Glad to hear!