All MSSQL instance monitoring

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
kranthi6
Posts: 13
Joined: Mon Sep 10, 2012 2:43 am

Re: All MSSQL instance monitoring

Post by kranthi6 »

Please find attached the screen shot from Studio Express. Studio express is not a problem. When I run the same query in Nagios XI then its an issue
You do not have the required permissions to view the files attached to this post.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: All MSSQL instance monitoring

Post by ssax »

Edit this file:

Code: Select all

/usr/local/nagios/libexec/check_mssql
Change line 104 from:

Code: Select all

if (!$query_data = @mssql_query("$query")) {
To:

Code: Select all

var_dump(mssql_query("$query"));
if (!$query_data = @mssql_query("$query")) {
Then run it again and post the entire output.


Thank you
kranthi6
Posts: 13
Joined: Mon Sep 10, 2012 2:43 am

Re: All MSSQL instance monitoring

Post by kranthi6 »

Hi SSAX,

Are you sure is it at line 104? in my code its at line 326. Anyways I have updated the code which you have advised and please find the output from CLI:

Code: Select all

 libexec]# ./check_mssql -H xx.xx.xx.xx --username sa --password "xxxx" --database master --port 1433 --query "SELECT+name+%2B+%27%2C+%27+AS+%5Btext%28%29%5D+FROM+sys.databases+WHERE+state+%21%3D+0+FOR+XML+PATH%28%27%27%29%3B" --result "" --decode
PHP Warning:  mssql_query(): message: Unicode data in a Unicode-only collation or ntext data cannot be sent to clients using DB-Library (such as ISQL) or ODBC version 3.7 or earlier. (severity 16) in /usr/local/nagios/libexec/check_mssql on line 326
PHP Warning:  mssql_query(): General SQL Server error: Check messages from the SQL Server (severity 16) in /usr/local/nagios/libexec/check_mssql on line 326
PHP Warning:  mssql_query(): Query failed in /usr/local/nagios/libexec/check_mssql on line 326
bool(false)
CRITICAL: Could not execute the query.
Any thoughts!
Thanks
Last edited by tmcdonald on Wed Apr 06, 2016 4:50 pm, edited 1 time in total.
Reason: Please use [code][/code] tags around long output
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: All MSSQL instance monitoring

Post by tmcdonald »

Looking around at those errors, I found some references to querying the wrong DB/schema:

http://stackoverflow.com/questions/2958 ... ry-failing

Beyond that, the Unicode might be something to look into as well.
Former Nagios employee
Locked