NagiosEnterprises / check_mssql_collection

Suite of Plugins For MSSQL Checks
http://www.nagios.com
GNU General Public License v2.0
26 stars 21 forks source link

check_mssql_database.py Caught unexpected error #2

Closed rchekaluk closed 7 years ago

rchekaluk commented 10 years ago

Receive the following error on Ubuntu 14.04, Python 2.7.6

<type 'exceptions.TypeError'>
Caught unexpected error. This could be caused by your sysperfinfo not containing the proper entries for this query, and you may delete this service check.

After commenting out the final 4 lines of check_mssql_database.py, the exception is:

$ /tmp/check_mssql_database.py --hostname=$host --user=$dbuser --password=$dbpswd --table=dbadmin --datasize
Traceback (most recent call last):
  File "/tmp/check_mssql_database.py", line 352, in <module>
    main()
  File "/tmp/check_mssql_database.py", line 318, in main
    execute_query(mssql, options, host)
  File "/tmp/check_mssql_database.py", line 331, in execute_query
    mssql_query.do(mssql)
  File "/tmp/check_mssql_database.py", line 167, in do
    self.run_on_connection(connection)
  File "/tmp/check_mssql_database.py", line 154, in run_on_connection
    self.query_result = cur.fetchone()[0]
TypeError: 'NoneType' object has no attribute '__getitem__'

The solution mentioned in https://github.com/NagiosEnterprises/check_mssql_collection/issues/1#issuecomment-51666680 does not help, even after installing cython:

$ pip freeze | egrep -i pymssql\|cython
Cython==0.20.2
pymssql==2.1.0
hedenface commented 7 years ago

I'm closing this since this issue is ~3 years old. @rchekaluk if you're still having this issue, please re-open the issue or inform me and we will try and get it resolved!

curtbay commented 6 years ago

Hi, I have the same problem and I don't know how to fix it. Can you help me please ? I have this error when I do my check : <type 'exceptions.TypeError'> Caught unexpected error. This could be caused by your sysperfinfo not containing the proper entries for this query, and you may delete this service check.

Thank you Bests Regards

jomann09 commented 6 years ago

What version of MSSQL are you checking again?

curtbay commented 6 years ago

Sorry , I did'nt say it. It's MSSQL express 2016. Thank you for your help.

jomann09 commented 6 years ago

I didn't think it was an issue with 2016, but would you be able to change line 38-39 in your plugin to use sys.dm_os_performance_counters instead of sys.sysperfinfo and try it, and let me know if you get results instead of an empty counter?

curtbay commented 6 years ago

Ok , I think I'm able change line 38-39 to use sys.dm_os_performance_counters. I will try it tomorrow morning because I don't have access to the server now. I will let you know the result. Thank you.

curtbay commented 6 years ago

Hi, I changed lines 38-39 but I have the same error message : <type 'exceptions.TypeError'> Caught unexpected error. This could be caused by your sysperfinfo not containing the proper entries for this query, and you may delete this service check.

Thanks.