Nagios Plugin check_mssql_database.py
Nagios Plugin check_mssql_database.py
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.
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.
Last edited by abrist on Thu May 22, 2014 2:42 pm, edited 1 time in total.
Reason: This plugin may ship with XI, but it is not a "nagios-plugins" plugin. I am moving this to the general XI forum.
Reason: This plugin may ship with XI, but it is not a "nagios-plugins" plugin. I am moving this to the general XI forum.
-
sreinhardt
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: Nagios Plugin check_mssql_database.py
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?
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Re: Nagios Plugin check_mssql_database.py
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.
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Nagios Plugin check_mssql_database.py
When we run this from our Wizards the command looks like the following for a MSSQL server using instances:
or, using port
Either way, the user you setup will need access to the sysperfinfo to run the
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 20Code: 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--transpsec Transactions Per Second
Re: Nagios Plugin check_mssql_database.py
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
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
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
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
-
sreinhardt
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: Nagios Plugin check_mssql_database.py
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.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Re: Nagios Plugin check_mssql_database.py
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.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.
Thanks for any help.
Re: Nagios Plugin check_mssql_database.py
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
Any idea on how I can do this?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.