MSSQL Query Issue

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
FrontlineIT
Posts: 94
Joined: Tue Jul 26, 2016 8:46 am

MSSQL Query Issue

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

Re: MSSQL Query Issue

Post by cdienger »

What version of check_mssql is on both machines? Check by running "/usr/local/nagios/libexec/check_mssql -V"
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: MSSQL Query Issue

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked