Page 1 of 2
check_mssql_database.py - Type Error/DivisonZero Error
Posted: Fri Aug 04, 2017 1:04 am
by Marcusg562
Hey all,
when I'm trying to run on bash
Code: Select all
./check_mssql_database.py -H MYHOST:MYPORT -U USER -P SECRET -T CHECKTABLE --loggrowths
I got the following error:
<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.
When I'm running instead the following SQL Command (I'm only connected to the SQL Server not to an insatance):
Code: Select all
SELECT cntr_value,counter_name,instance_name FROM Vudyog.sys.sysperfinfo WHERE instance_name='CHECKTABLE ';
I got a list with many information inside. Therefore I tried
Code: Select all
SELECT cntr_value FROM sysperfinfo WHERE counter_name='Log Cache Hit Ratio' AND instance_name='CHECKTABLE ';
Last one works great and I also got a Value as you can see in the attachment:
![2017-08-04 07_59_06-DBeaver - General - [ _MS SQL Server - 10.18.45.98_ Script-13 ].png](./download/file.php?id=19038)
- 2017-08-04 07_59_06-DBeaver - General - [ _MS SQL Server - 10.18.45.98_ Script-13 ].png (3.71 KiB) Viewed 5277 times
So I didn't understand where there is my problem and how I can solve it. I got a connection with the check_mssql_database.py script but it seems that the script doesn't connect to the right DB/TABLE.
Has anyone a glue here?
Regards
Marcus
Re: check_mssql_database.py - Type Error/DivisonZero Error
Posted: Fri Aug 04, 2017 1:34 pm
by tgriep
What version of MSSQL are you running on that server?
Can you post the check_mssql_database.py script here or the link to the where you downloaded it from?
A possible cause could be that the user permissions may not be sufficient so make sure they are set correctly.
Re: check_mssql_database.py - Type Error/DivisonZero Error
Posted: Mon Aug 07, 2017 12:59 am
by Marcusg562
tgriep wrote:What version of MSSQL are you running on that server?
I'm not pretty sure at this moment but it should be MSSQL 2012 or 2014. I will verify this.
tgriep wrote:Can you post the check_mssql_database.py script here or the link to the where you downloaded it from?
Yes, see atachment for my used script:
Files downloaded from
https://github.com/NagiosEnterprises/ch ... collection
tgriep wrote:A possible cause could be that the user permissions may not be sufficient so make sure they are set correctly.
I'm pretty sure, that this isn't the problem because I'm MSSQL SA on this SQL Cluster. I'm also able to run the SQL select statement in an SQL Client (I'm using DBeaver) and got a response (with values which seems good with me) when I replace the variables in the statement with values.
Re: check_mssql_database.py - Type Error/DivisonZero Error
Posted: Mon Aug 07, 2017 2:24 pm
by tgriep
In your example command
Code: Select all
./check_mssql_database.py -H MYHOST:MYPORT -U USER -P SECRET -T CHECKTABLE --loggrowths
You are specifying loggrowths as the option.
When that is used, this is the query that is generated, so see if you can run this in your MSSQL server without any errors.
Code: Select all
BASE_QUERY = "SELECT cntr_value FROM sysperfinfo WHERE counter_name='Log Growths' AND instance_name='CHECKTABLE';"
Also, from what I heard, in MSSQL 2012 and newer, some tables were removed so you cannot check for them as they do not exist and will cause errors running the plugin.
Re: check_mssql_database.py - Type Error/DivisonZero Error
Posted: Tue Aug 08, 2017 1:26 am
by Marcusg562
tgriep wrote:In your example command
Code: Select all
./check_mssql_database.py -H MYHOST:MYPORT -U USER -P SECRET -T CHECKTABLE --loggrowths
You are specifying loggrowths as the option.
When that is used, this is the query that is generated, so see if you can run this in your MSSQL server without any errors.
Code: Select all
BASE_QUERY = "SELECT cntr_value FROM sysperfinfo WHERE counter_name='Log Growths' AND instance_name='CHECKTABLE';"
Also, from what I heard, in MSSQL 2012 and newer, some tables were removed so you cannot check for them as they do not exist and will cause errors running the plugin.
^
Hi, I've already verified that the Tables are there:
And also by loggrowths works fine within the SQL client as you can see in the pic below:
Just for Information we use MSSQL Server 2012 SP1
Re: check_mssql_database.py - Type Error/DivisonZero Error
Posted: Tue Aug 08, 2017 3:03 pm
by tgriep
I am thing that the version of that plugin you are using is not working right and I suggest downgrading to an older version to see if that fixes the issue.
I have posted an older version to this post, try it and see if that fixes the issue.
Re: check_mssql_database.py - Type Error/DivisonZero Error
Posted: Tue Aug 08, 2017 3:42 pm
by tgriep
I did some comparing of the old plugin to the new one and the error is caused by not specifying a warning and critical threshold on the command line.
Add those and it should work for you.
Re: check_mssql_database.py - Type Error/DivisonZero Error
Posted: Fri Aug 11, 2017 12:41 am
by Marcusg562
Thanks, that's works great for me!
Re: check_mssql_database.py - Type Error/DivisonZero Error
Posted: Fri Aug 11, 2017 9:38 am
by bolson
May we close this topic?
Re: check_mssql_database.py - Type Error/DivisonZero Error
Posted: Fri Aug 11, 2017 12:52 pm
by Marcusg562
Absolutely agree with this!