Trouble with check_mssql

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
proxibid
Posts: 30
Joined: Fri Aug 15, 2014 2:19 pm

Trouble with check_mssql

Post 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.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Trouble with check_mssql

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
proxibid
Posts: 30
Joined: Fri Aug 15, 2014 2:19 pm

Re: Trouble with check_mssql

Post by proxibid »

Attaching screenshot.

I'll try setting that down to 0.
You do not have the required permissions to view the files attached to this post.
proxibid
Posts: 30
Joined: Fri Aug 15, 2014 2:19 pm

Re: Trouble with check_mssql

Post 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.
You do not have the required permissions to view the files attached to this post.
proxibid
Posts: 30
Joined: Fri Aug 15, 2014 2:19 pm

Re: Trouble with check_mssql

Post by proxibid »

Our fault. Passing bad params.

after changing from -wrc and -crc to -W and -C functions as expected.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Trouble with check_mssql

Post by cdienger »

Glad to hear!
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked