Page 1 of 2
Nagios Plugin check_mssql_database.py
Posted: Thu May 22, 2014 1:07 pm
by jgawrych
Hi All,
I am trying to set up nagios to monitor our databases. Every time I run the following command i get an error:
./check_mssql_database.py -H ipaddress -U user -P password -T database --transpec -w 30 -c 20
<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.
[root@hypnos libexec]# ./check_mssql_database.py -H ipaddress -U user -P password -T database --transpec -w 30 -c 20
SQL Server message 208, severity 16, state 1, line 1:
Invalid object name 'sysperfinfo'.
DB-Lib error message 208, severity 16:
General SQL Server error: Check messages from the SQL Server
I read up on an earlier post where the command would work on the master database but not on any other instance. Unfortunately, for me, it does not work on either the master database or any other database instance. Any information would be helpful.
Thank you.
Re: Nagios Plugin check_mssql_database.py
Posted: Thu May 22, 2014 5:02 pm
by sreinhardt
It sounds to me like your database does not have a table entitled 'sysperfinfo'. Does the user you are trying to use have access to the master database, and is that the DB you are querying?
Re: Nagios Plugin check_mssql_database.py
Posted: Mon May 26, 2014 8:27 am
by jgawrych
Thank you for the response. The user account does have access to the master database. I am not trying to query the master database, I am trying to query another instance. I did try to query the master database and I received the same error mentioned.
Re: Nagios Plugin check_mssql_database.py
Posted: Tue May 27, 2014 10:43 am
by scottwilkerson
When we run this from our Wizards the command looks like the following for a MSSQL server using instances:
Code: Select all
/usr/local/nagios/libexec/check_mssql_database.py -H 1.1.1.1 -U 'admin' -P 'password' -T 'master' -I INSTANCE_NAME--transpsec --warning 10 --critical 20
or, using port
Code: Select all
/usr/local/nagios/libexec/check_mssql_database.py -H 1.1.1.1 -U 'admin' -P 'password' -T 'master' -p 1433 --transpsec --warning 10 --critical 20
Either way, the user you setup will need access to the sysperfinfo to run the
--transpsec Transactions Per Second
Re: Nagios Plugin check_mssql_database.py
Posted: Wed May 28, 2014 8:52 am
by jgawrych
Hi Scott,
Thank you for the information. I got it to work, but not how I thought I would. It works if I do not declare "transpec". It works if I enter this:
./check_mssql_database.py -H 1.1.1.1 -U admin -P password -T database_name -p 1433 -w 10 -c 20
I get a response:
OK: Time to connect was 0.00671410560608s|time=0.00671410560608s;10;20;;;
However if i enter the following:
./check_mssql_database.py -H 192.168.3.105 -U admin -P password -T database_name -p 1433 --transpec -w 10 -c 20
The command will give me the error regarding sysperfinfo. I am trying to figure out why.
Regards
Re: Nagios Plugin check_mssql_database.py
Posted: Wed May 28, 2014 9:13 am
by jgawrych
Hi Scott,
It looks like, for some reason, it looks like I cannot use any other states other than "time2connect" which is the only one that is working. If I try to add "--datasize" or "--transpec", that is when it will give me an error.
Regards
Re: Nagios Plugin check_mssql_database.py
Posted: Wed May 28, 2014 4:56 pm
by sreinhardt
You cannot check anything but master without using subqueries for datasize and transpec. This information is only held on master, and calling a separate db even on the same system would not provide those results. You might want to check with your DBA and see if they can setup a proper subquery within your DB or if they would prefer you just to use the master directly.
Re: Nagios Plugin check_mssql_database.py
Posted: Mon Apr 27, 2015 10:55 am
by warnox
sreinhardt wrote:You cannot check anything but master without using subqueries for datasize and transpec. This information is only held on master, and calling a separate db even on the same system would not provide those results. You might want to check with your DBA and see if they can setup a proper subquery within your DB or if they would prefer you just to use the master directly.
Hi sreinhardt, can you please expand on this as I'm having the same issue? Basically I just need to be able to find the size of one database, not master.
Thanks for any help.
Re: Nagios Plugin check_mssql_database.py
Posted: Mon Apr 27, 2015 5:06 pm
by ssax
He was saying that your check_mssql_database.py script would need to be modified to include a subquery because the info for database size is only contained in the master DB.
Re: Nagios Plugin check_mssql_database.py
Posted: Tue Apr 28, 2015 3:11 am
by warnox
ssax wrote:He was saying that your check_mssql_database.py script would need to be modified to include a subquery because the info for database size is only contained in the master DB.
Any idea on how I can do this?