Is there an updated check_mssql_server.py script?

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
bbradley
Posts: 7
Joined: Tue Jul 31, 2012 9:21 am

Is there an updated check_mssql_server.py script?

Post by bbradley »

Is there an updated check_mssql_server.py script?

I can’t get this to work with the –I ‘INSTANCENAME’ or -T to work on anything.

When I do for example without –I (it works)
[root@Nagios libexec]# ./check_mssql_server.py -H '192.168.1.x' -U 'sa' -P 'xxxx' -p 1350 --averagewait --warning 20 --critical 30
CRITICAL:Average Wait Time is 17824.0ms|Average_Wait_Time=17824.0ms;;;;

But when I try with –I (fails)
[root@Nagios libexec]# ./check_mssql_server.py -H '192.168.1.x' -U 'sa' -P 'xxxx' -p 1350 -I 'LYTECMD' --averagewait --warning 20 --critical 30
CRITICAL:Unable to access SQL Server.

-T just returns
check_mssql_server.py: error: no such option: -T

Also, on MSSQL Page Splits Per Sec it returns
CRITICAL:Can access server but cannot query.
I'm assuming it's not working because I currently am not specifying an instance to query because that is the only way I can get the script to run currently--by removing the -I


I have been working with nagios for almost a month and I have been able to figure most issues out but having problems with this one and would really like to figure this out and any help would be appreciated.

Thanks!
User avatar
nscott
Posts: 1040
Joined: Wed May 11, 2011 8:54 am

Re: Is there an updated check_mssql_server.py script?

Post by nscott »

Lets start with getting the updated check_mssql_server plugins, can you get the latest ones from

https://github.com/scot0357/check_mssql_collection/

And then, there is some documentation on the prerequisites for the plugin here:

http://assets.nagios.com/downloads/nagi ... rereqs.pdf

Go through those, and if its still not working, I'll be here to help you.
Nicholas Scott
Former Nagios employee
bbradley
Posts: 7
Joined: Tue Jul 31, 2012 9:21 am

Re: Is there an updated check_mssql_server.py script?

Post by bbradley »

nscott wrote:Lets start with getting the updated check_mssql_server plugins, can you get the latest ones from
https://github.com/scot0357/check_mssql_collection/
I downloaded and installed the files from here although they appear to be identical to the version I am already running.
nscott wrote:And then, there is some documentation on the prerequisites for the plugin here:
http://assets.nagios.com/downloads/nagi ... rereqs.pdf
Go through those, and if its still not working, I'll be here to help you.
Installing the freetds
FreeTDS Version : 0.91 - check
Common Package Conflicts
perl-DBD-Sybase not installed - check
nagiosxi-deps was installed but I removed - check
Installing pymssql
pymssqlVersion : 1.0.2 - check

A Gotcha-
"For the .py plugins, if you enter both a port and an instance it will attempt to use both. So lets say you enter the following command:
./check_mssql_server.py -H 192.168.5.5 -U user -P password -I dbase -p 1900
It will attempt to connect using the following string:
192.168.5.5\\dbase:1900"
Ok. I am trying to connect on a non-standard port of 1350 and I see the default is 1433
So I want to change the default port to 1350 in the script for this to work properly? If so, would a search and replace work to modify the script? Then I could just define a new command in the core config manager to specify a renamed modified script?

Also, I'm still getting this error
MSSQL Page Splits Per Sec Critical 15h 56m 54s 5/5 2012-07-31 16:34:42 CRITICAL:Can access server but cannot query.

Thanks!
User avatar
nscott
Posts: 1040
Joined: Wed May 11, 2011 8:54 am

Re: Is there an updated check_mssql_server.py script?

Post by nscott »

As far as I know, the 'Instance' in MSSQL is just a string, and you connect to port 1434 and give the MSSQL server the string, and it hands you back the port you need to connect with the database indicated by instance. So I don't think it makes much sense to use both -p and -I. Does it work when you do not specify the -p?

Also, as an aside, -T is not in the check_mssql_server.py, but it is in check_mssql_database.py.
Nicholas Scott
Former Nagios employee
bbradley
Posts: 7
Joined: Tue Jul 31, 2012 9:21 am

Re: Is there an updated check_mssql_server.py script?

Post by bbradley »

nscott wrote: Does it work when you do not specify the -p?
It does not work when I take the -p 1350 out. That's why I would like to know if there is a way to set a new default port without specifying it in the command line?

Code: Select all

[root@Nagios libexec]# ./check_mssql_server.py -H '192.168.1.24' -U 'sa' -P 'password' -p 1350
OK:Time to connect is 0.004s|Time_to_connect=0.004s;;;;
[root@Nagios libexec]# ./check_mssql_server.py -H '192.168.1.24' -U 'sa' -P 'password'
CRITICAL:Unable to access SQL Server.
nscott wrote:Also, as an aside, -T is not in the check_mssql_server.py, but it is in check_mssql_database.py.
Thank you for clarifying this. I was confused because when I run ./check_mssql_server.py -h it is listed under usage.

Code: Select all

[root@Nagios libexec]# ./check_mssql_server.py -h
Usage: check_mssql_server.py -H hostname -U user -P password -T table --mode
Thanks!
User avatar
nscott
Posts: 1040
Joined: Wed May 11, 2011 8:54 am

Re: Is there an updated check_mssql_server.py script?

Post by nscott »

bradley,

Keep the -p out, but keep the -I in there.

And as far as the default port, are you sure the port for the query port has been changed? If so, I'll dig into the FreeTDS code, because I don't know how to change that. However, if you know that the instance 'LYTECMD' is on port 1350, you will be monitoring it if you specify port 1350 but no instance.
Nicholas Scott
Former Nagios employee
bbradley
Posts: 7
Joined: Tue Jul 31, 2012 9:21 am

Re: Is there an updated check_mssql_server.py script?

Post by bbradley »

nscott wrote: Keep the -p out, but keep the -I in there.
Thanks-That worked! :D That is the one variation I didn't try because I was thinking that I had to specify the port too.

Last problem-Any troubleshooting suggestions?

Code: Select all

[root@Nagios libexec]# ./check_mssql_server2.py -H '192.168.1.24' -U 'sa' -P 'password' -I LYTECMD --pagesplits --warning 20 --critical 30
CRITICAL:Can access server but cannot query.
Thanks!
User avatar
nscott
Posts: 1040
Joined: Wed May 11, 2011 8:54 am

Re: Is there an updated check_mssql_server.py script?

Post by nscott »

Is it just that check that doesn't seem to work? Did you perchance edit the plugin at all? Python is pretty persnickety about whitespace.
Nicholas Scott
Former Nagios employee
bbradley
Posts: 7
Joined: Tue Jul 31, 2012 9:21 am

Re: Is there an updated check_mssql_server.py script?

Post by bbradley »

nscott wrote:Is it just that check that doesn't seem to work?
Yes, All the other plugins are working and judging from all the criticals the server needs some work LOL.
screen1.png
nscott wrote:Did you perchance edit the plugin at all? Python is pretty persnickety about whitespace.
I have not edited it. Problem still existed-even after I uploaded fresh files from github. Is there a way to debug the output further?

Thanks!
You do not have the required permissions to view the files attached to this post.
User avatar
nscott
Posts: 1040
Joined: Wed May 11, 2011 8:54 am

Re: Is there an updated check_mssql_server.py script?

Post by nscott »

bbradley,

:) I wouldn't take those Criticals too seriously, I set up most of those default numbers in my test environment, so take that for what its worth.

Also, I'm gonna dive into this plugin tonight, there may be something wrong with the that page splits syntax, and I'd appreciate someone to test out some other updates to it.
Nicholas Scott
Former Nagios employee
Locked