Page 1 of 1

MSSQL Query Issue

Posted: Thu Apr 16, 2020 9:51 am
by FrontlineIT
Hello,
We're having issues with a MSSQL query check that works on a older version of Nagios XI (5.4.13) but not on a newer Nagios XI version (5.6.7). Here are examples of the query issues we're having. You can see the query works fine on v5.4.13. But not on v5.6.7 Can someone assist me with this?


--username ***** --password ***** --database ***** --query "declare @t table (Result VARCHAR(10)) INSERT INTO @t EXEC DBA_NumJobsFailed 540 SELECT CASE WHEN Result > 0 THEN 'True' ELSE 'False' end FROM @t" --result "False" --decode --warning 50 --critical 200


Old Nagios XI Result (5.4.13)

/usr/local/nagios/libexec/check_mssql -H ***** --username ***** --password ***** --database ***** --query " declare @t table (Result VARCHAR(10)) INSERT INTO @t EXEC DBA_NumJobsFailed 540 SELECT CASE WHEN Result > 0 THEN 'True' ELSE 'False' end FROM @t" --result "False" --decode --warning 50 --critical 200
OK: Query results matched, query duration=0.021611 seconds.|query_duration=0.021611s;50;200

Newer Nagios XI Result (5.6.7)

/usr/local/nagios/libexec/check_mssql -H ***** --username ***** --password ***** --database ***** --query "declare @t table (Result VARCHAR(10)) INSERT INTO @t EXEC DBA_NumJobsFailed 540 SELECT CASE WHEN Result > 0 THEN 'True' ELSE 'False' end FROM @t" --result "False" --decode --warning 50 --critical 200
CRITICAL: Query expected "False" but got "".|query_duration=0.008701s;50;200 ''=;

Re: MSSQL Query Issue

Posted: Thu Apr 16, 2020 1:30 pm
by cdienger
What version of check_mssql is on both machines? Check by running "/usr/local/nagios/libexec/check_mssql -V"

Re: MSSQL Query Issue

Posted: Thu Apr 16, 2020 1:38 pm
by tgriep
In addition to the previous post, there is a configuration file that the plugin uses when connecting to MSSQL servers.
Check this file on the old server and add the changes to the new server and see if that resolves the issue.

Code: Select all

/etc/freetds.conf