Problems with check_mssql_database.py wizard script

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
nagiosEngie
Posts: 104
Joined: Thu May 03, 2018 7:57 am

Problems with check_mssql_database.py wizard script

Post 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
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Problems with check_mssql_database.py wizard script

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
nagiosEngie
Posts: 104
Joined: Thu May 03, 2018 7:57 am

Re: Problems with check_mssql_database.py wizard script

Post by nagiosEngie »

Hi
I have checked all your suggestions but still am unable to execute.

Sandro
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Problems with check_mssql_database.py wizard script

Post by mcapra »

Which version of SQL Server are you running this script against?
Former Nagios employee
https://www.mcapra.com/
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Problems with check_mssql_database.py wizard script

Post by tgriep »

Another question, what are the user permissions set to in the MSSQL database?
Be sure to check out our Knowledgebase for helpful articles and solutions!
nagiosEngie
Posts: 104
Joined: Thu May 03, 2018 7:57 am

Re: Problems with check_mssql_database.py wizard script

Post 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
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Problems with check_mssql_database.py wizard script

Post 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?
Be sure to check out our Knowledgebase for helpful articles and solutions!
nagiosEngie
Posts: 104
Joined: Thu May 03, 2018 7:57 am

Re: Problems with check_mssql_database.py wizard script

Post by nagiosEngie »

Hi lmiltchev
Ok it works! :-D
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
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Problems with check_mssql_database.py wizard script

Post 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?
Be sure to check out our Knowledgebase for helpful articles and solutions!
nagiosEngie
Posts: 104
Joined: Thu May 03, 2018 7:57 am

Re: Problems with check_mssql_database.py wizard script

Post 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
You do not have the required permissions to view the files attached to this post.
Locked