Page 1 of 2

Issue with SQL server check since update to R2.6

Posted: Mon Mar 02, 2015 5:42 am
by WillemDH
Hello,

We seem to experience one issue with MSSQL server checks since the update to R2.6:

These are the errors I get in service detail for one average wait time MSSQL service check.

Code: Select all

File "/usr/local/nagios/libexec/check_mssql_server.py", line 464, in 
main()
File "/usr/local/nagios/libexec/check_mssql_server.py", line 430, in main
execute_query(mssql, options, host)
File "/usr/local/nagios/libexec/check_mssql_server.py", line 443, in execute_query
mssql_query.do(mssql)
File "/usr/local/nagios/libexec/check_mssql_server.py", line 283, in do
self.calculate_result()
File "/usr/local/nagios/libexec/check_mssql_server.py", line 292, in calculate_result
self.result = (float(self.query_result[0]) / self.query_result[1]) * self.modifier
ZeroDivisionError: float division
I see this only on one service. The others seem to work correctly.

Grtz

Willem

Re: Issue with SQL server check since update to R2.6

Posted: Mon Mar 02, 2015 10:21 am
by cmerchant
Willem, No change was made in the python script check_mssql_server.py v 2.0.2 since 4 April 2013 . Could you show us what version of pymssql is:

Code: Select all

rpm -qi pymssql 

Re: Issue with SQL server check since update to R2.6

Posted: Mon Mar 02, 2015 10:25 am
by WillemDH

Code: Select all

 rpm -qi pymssql
Name        : pymssql                      Relocations: (not relocatable)
Version     : 1.0.2                             Vendor: Fedora Project
Release     : 4.el6                         Build Date: Sat 19 Mar 2011 07:13:35 PM CET
Install Date: Wed 10 Oct 2012 02:08:58 AM CEST      Build Host: x86-17.phx2.fedoraproject.org
Group       : Development/Languages         Source RPM: pymssql-1.0.2-4.el6.src.rpm
Size        : 127535                           License: LGPLv2+
Signature   : RSA/8, Sun 20 Mar 2011 01:56:09 PM CET, Key ID 3b49df2a0608b895
Packager    : Fedora Project
URL         : http://pymssql.sourceforge.net/
Summary     : A simple database interface to MS-SQL for Python
Description :
pymssql is the Python language extension module that provides access to
Microsoft SQL Servers from Python scripts. It is compliant with Python
DB-API 2.0 Specification.

Re: Issue with SQL server check since update to R2.6

Posted: Mon Mar 02, 2015 10:52 am
by cmerchant
The check is throwing an exception divide by zero. Could you double check the to make sure you are using the correct IP address, and correct credentials. Can you run the following command and show the output?

Code: Select all

/usr/local/nagios/libexec/check_mssql_server.py -H xx.xx.xx.xx -U 'user' -P 'password' -T 'table' -I instancename --averagewait --warning 2000 --critical 3000

Re: Issue with SQL server check since update to R2.6

Posted: Tue Mar 03, 2015 9:26 am
by WillemDH
It seems to work fine from cli:

Code: Select all

/usr/local/nagios/libexec/check_mssql_database.py -H gensaptherthtrhr0 -U 'nagiosql' -P 'O6eSyyuvxS' -T 'EXP' -I EXP --activetrans
OK: Active Transactions is 0.0|log_file_usage=0.0;;;;
In XI gui I still get:

Code: Select all

(No output on stdout) stderr: Traceback (most recent call last):
File "/usr/local/nagios/libexec/check_mssql_server.py", line 464, in 
main()
File "/usr/local/nagios/libexec/check_mssql_server.py", line 430, in main
execute_query(mssql, options, host)
File "/usr/local/nagios/libexec/check_mssql_server.py", line 443, in execute_query
mssql_query.do(mssql)
File "/usr/local/nagios/libexec/check_mssql_server.py", line 283, in do
self.calculate_result()
File "/usr/local/nagios/libexec/check_mssql_server.py", line 292, in calculate_result
self.result = (float(self.query_result[0]) / self.query_result[1]) * self.modifier
ZeroDivisionError: float division
Grtz

Willem

Re: Issue with SQL server check since update to R2.6

Posted: Tue Mar 03, 2015 10:42 am
by lmiltchev
Willem, go to Home->Service Detail, click on the "problem" service->Configure->Re-configure this service, and show us what you have in the "Monitor the service with this command ..." field.

Re: Issue with SQL server check since update to R2.6

Posted: Wed Mar 04, 2015 7:24 am
by WillemDH
This would be in the field you requested Ludmill:

Code: Select all

check_xi_mssql_server!-U 'nagios_sql_user' -P 'O6eeeNvxS' -I EXP --averagewait !!!!!!!
Comparing this to another service checking average wait for a SQL DB which does work, I get:

Code: Select all

check_xi_mssql_server!-U 'nagios_sql_user' -P 'O6eSeeNvxS' -I DEV --averagewait !!!!!!!
I'm not really seeing any difference.

Grtz

Re: Issue with SQL server check since update to R2.6

Posted: Wed Mar 04, 2015 9:58 am
by cmerchant
I'm not sure if you were comparing the same check -- one was with --averagewait, and the other was with --activetrans. Could you retry the CLI with the --averagewait on the server that failed.
It seems to work fine from cli:

Code: Select all
/usr/local/nagios/libexec/check_mssql_database.py -H gensaptherthtrhr0 -U 'nagiosql' -P 'O6eSyyuvxS' -T 'EXP' -I EXP --activetrans
OK: Active Transactions is 0.0|log_file_usage=0.0;;;;

Re: Issue with SQL server check since update to R2.6

Posted: Mon Mar 09, 2015 6:05 am
by WillemDH
It seems I was indeed wrong in my cli example. Sorry for that. The problem is with averagewait.

In cli this check also gives float division error:

Code: Select all

/usr/local/nagios/libexec/check_mssql_server.py -H serverdb -U 'nagios' -P 'O6eefezNvxS' -I EXP --averagewait
Traceback (most recent call last):
  File "/usr/local/nagios/libexec/check_mssql_server.py", line 464, in <module>
    main()
  File "/usr/local/nagios/libexec/check_mssql_server.py", line 430, in main
    execute_query(mssql, options, host)
  File "/usr/local/nagios/libexec/check_mssql_server.py", line 443, in execute_query
    mssql_query.do(mssql)
  File "/usr/local/nagios/libexec/check_mssql_server.py", line 283, in do
    self.calculate_result()
  File "/usr/local/nagios/libexec/check_mssql_server.py", line 292, in calculate_result
    self.result = (float(self.query_result[0]) / self.query_result[1]) * self.modifier
ZeroDivisionError: float division
Grtz

Willem

Re: Issue with SQL server check since update to R2.6

Posted: Mon Mar 09, 2015 11:16 am
by cmerchant
Not sure if this is going to be your fix - There is an updated check_mssql_collection here on github from Jan 2015:

Please download the two plugins from:
https://github.com/NagiosEnterprises/ch ... collection

Upload them via Admin > System Extensions > Manage Plugins