Page 1 of 2
Problems with check_mssql_database.py wizard script
Posted: Mon Aug 27, 2018 5:32 am
by nagiosEngie
Hello Nagios Crew,
I hope you are all doing well.
So I am having some problems with the check_mssql_database.py script.
when launched I get the following error:
/usr/local/nagios/libexec/check_mssql_database.py -H <x.x.x.x> -U 'username' -P 'password' -I 'instancename' -T master --datasize --critical 10
<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.
Is there any solution?
Thanks
SAndro
Re: Problems with check_mssql_database.py wizard script
Posted: Mon Aug 27, 2018 2:02 pm
by tgriep
Can you look at the following link to make sure the MSSQL prerequisites are installed on the server?
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
Another cause is in newer versions of the Microsoft database, some of the default settings were removed which causes some of the checks to fail with that error.
Third cause could be cause by a permission issue with the user account on the MSSQL server. If you can setup the account as a read only DBO account, that is usually sufficient enough for the check to run.
Re: Problems with check_mssql_database.py wizard script
Posted: Wed Aug 29, 2018 9:24 am
by nagiosEngie
Hi
I have checked all your suggestions but still am unable to execute.
Sandro
Re: Problems with check_mssql_database.py wizard script
Posted: Wed Aug 29, 2018 9:28 am
by mcapra
Which version of SQL Server are you running this script against?
Re: Problems with check_mssql_database.py wizard script
Posted: Wed Aug 29, 2018 10:09 am
by tgriep
Another question, what are the user permissions set to in the MSSQL database?
Re: Problems with check_mssql_database.py wizard script
Posted: Fri Aug 31, 2018 8:56 am
by nagiosEngie
The MS sql versions we are using are:
we have 2 farms with different versions Mssql 2012 and Mssql 2014
User permission on our user is sysadmin
Consider that with the same credentials we are able to successfuly execute the other check_mssql_server.py script (I do not know if this can be relevant)
Thanks
Sandro
Re: Problems with check_mssql_database.py wizard script
Posted: Fri Aug 31, 2018 9:55 am
by lmiltchev
I believe the check fails as you don't specify a warning threshold. Try running:
Code: Select all
/usr/local/nagios/libexec/check_mssql_database.py -H <x.x.x.x> -U 'username' -P 'password' -I 'instancename' -T master --datasize --warning 5 --critical 10
Are you getting the expected output now?
Re: Problems with check_mssql_database.py wizard script
Posted: Mon Sep 03, 2018 4:29 am
by nagiosEngie
Hi lmiltchev
Ok it works!

The only way to avoid the warning is to filter it in the messages?
I also have now this check that is failing:
/usr/local/nagios/libexec/check_mssql_database.py -H <IP> -U 'xxxUSER' -P 'xxxPASS' -T 'master' -I <Instancename> --logcachehit --warning 0:95 --critical 0:97
<type 'exceptions.ZeroDivisionError'>
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.
All other checks are working now.
Thanks
SAndro
Re: Problems with check_mssql_database.py wizard script
Posted: Tue Sep 04, 2018 8:39 am
by lmiltchev
The only way to avoid the warning is to filter it in the messages?
You can set up warning and critical thresholds to be the same:
Code: Select all
/usr/local/nagios/libexec/check_mssql_database.py -H <x.x.x.x> -U 'username' -P 'password' -I 'instancename' -T master --datasize --warning 10 --critical 10
I also have now this check that is failing:
/usr/local/nagios/libexec/check_mssql_database.py -H <IP> -U 'xxxUSER' -P 'xxxPASS' -T 'master' -I <Instancename> --logcachehit --warning 0:95 --critical 0:97
<type 'exceptions.ZeroDivisionError'>
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.
I believe that in order to make this particular check to work, you would need to set up the user account on your MSSQL server with Server Role = sysadmin. Can you try fixing the permissions, and let us know if this helped?
Re: Problems with check_mssql_database.py wizard script
Posted: Tue Sep 04, 2018 8:48 am
by nagiosEngie
Hi lmiltchev,
the strange thing about the logcachehit check I am trying, is that all other checks on the same db work as you can see in attached image. mssql.jpg.
User permissions account on my MSSQL server has Server Role = sysadmin.
if warning and critical have the same value will 2 messages/alerts be sent?
SAndro