Page 2 of 2

Re: All MSSQL instance monitoring

Posted: Tue Apr 05, 2016 2:36 pm
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

Re: All MSSQL instance monitoring

Posted: Tue Apr 05, 2016 5:46 pm
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

Re: All MSSQL instance monitoring

Posted: Tue Apr 05, 2016 9:11 pm
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

Re: All MSSQL instance monitoring

Posted: Wed Apr 06, 2016 4:53 pm
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.