Page 2 of 2

Re: Problems with check_mssql_database.py wizard script

Posted: Tue Sep 04, 2018 11:05 am
by lmiltchev
User permissions account on my MSSQL server has Server Role = sysadmin.
This check is working for me against Windows 2008 server.

Code: Select all

[root@main-nagios-xi ~]#  /usr/local/nagios/libexec/check_mssql_database.py -H x.x.x.x -U 'username' -P 'password' -T 'master' -I INSTANCE --logcachehit --warning 0:95 --critical 0:97
OK: Log Cache Hit Ratio is 57.1428571429%|log_cache_hit_ratio=57.1428571429%;0:95;0:97;;
We haven't been able to recreate the issue in-house. I wonder if this issue has to do with the version of the Windows server that you are running your check against. What is the version of the Windows server that you are using?

Also, it wouldn't hurt to double check the permissions just in case. You can log in the MSSQL server, and run the query to view permissions, e.g.

Code: Select all

SELECT * FROM fn_my_permissions(null, 'DATABASE')
if warning and critical have the same value will 2 messages/alerts be sent?
No, only critical notifications will be sent. Most of nagios plugins, including this one, are checking for a critical to exit before checking for warning. If you ran the check from the CLI with the same threshold for warning and critical, you would see that the only status that is returned is critical.

Re: Problems with check_mssql_database.py wizard script

Posted: Wed Sep 05, 2018 3:00 am
by nagiosEngie
Hello lmiltchev,
our SQL cluster is based on windows 2012 R2 servers.
I checked permissions and they are OK.
This thing is driving me crazy.
Sandro

Re: Problems with check_mssql_database.py wizard script

Posted: Wed Sep 05, 2018 9:11 am
by lmiltchev
It's strange that you are getting this error with the Windows 2012 R2 servers... The type 'exceptions.ZeroDivisionError' error with the check_mssql_database.py plugin is a known issue, but it is only seen with the SQL 2016 servers as far as we know.

See this post:
https://github.com/NagiosEnterprises/ch ... /issues/15

Can you log in the mssql server as the user you are running the check with, select the database, run the following query, and show us a screenshot of the results?

Code: Select all

SELECT     object_name, counter_name, instance_name, cntr_value, cntr_type
FROM         sys.sysperfinfo
WHERE     (counter_name = 'Log Cache Hit Ratio')