Issue with SQL server check since update to R2.6

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Issue with SQL server check since update to R2.6

Post 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
Nagios XI 5.8.1
https://outsideit.net
cmerchant
Posts: 546
Joined: Wed Sep 24, 2014 11:19 am

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

Post 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 
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

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

Post 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.
Nagios XI 5.8.1
https://outsideit.net
cmerchant
Posts: 546
Joined: Wed Sep 24, 2014 11:19 am

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

Post 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
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

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

Post 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
Nagios XI 5.8.1
https://outsideit.net
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

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

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

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

Post 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
Nagios XI 5.8.1
https://outsideit.net
cmerchant
Posts: 546
Joined: Wed Sep 24, 2014 11:19 am

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

Post 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;;;;
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

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

Post 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
Nagios XI 5.8.1
https://outsideit.net
cmerchant
Posts: 546
Joined: Wed Sep 24, 2014 11:19 am

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

Post 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
Locked