check_mssql -H <server> -U '<domain\username>' -P '<password>' -p 4000 -t 60 -q 'select * from sysprocesses p1, sysprocesses p2 where p1.blocked > 0 and p2.spid = p1.blocked'
Unknown option: q
UNKNOWN - online or query is required.
Is there a different plugin you are using?
check_mssql --help
Usage: check_mssql.pl -H <host> -U <user> -P <password> [-p <port>] [-t <timeout>] [-D <dbname>]
[-o] [-Q <sqlquery>] [-S <string> | [-w <warn_range> [-c <crit_range>]]
Options:
<host> = The address of the host running SQLServer
<user> = The user to log in as, if a domain is specified the name has to be embraced by ' signs
<password> = The user's password
<port> = The port on which the SQL Server is listening, default 1433
<timeout> = Timeout in seconds for plugin execution, default 10
<dbname> = The name of the database to use
-o or --online = Check if database is online (databasepropertyex('<dbname>', 'STATUS') equals ONLINE).
<sqlquery> = The SQL query to run on the server, the default is to check the number of logged in users
<string> = A string to look for in the result set
<warn_range> = The warning limit for the result of the query, default 50
<crit_range> = The critical limit for the result of the query, default 100
Warning and critical threshold support ranges on the form <start>:<end> which
defines the range that should _not_ trigger an alarm. A single numeric threshold
is equal to a range 0 to the thresh. IE -w 50 is equal to -w 0:50 which means
trigger alarm if returned value is outside range, IE larger then 50
Instead of the short argument names shown above the following can be used:
-H --hostname
-U --user
-P --password
-p --port
-t --timeout
-D --database
-o --online
-Q --sqlquery
-S --string
-w --warning
-c --critical
Usage examples:
To check that Northwind database is ONLINE:
check_mssql.sh -H localhost -U name -P pass -D Northwind -o
Select number of messages from Northwind.messages, warn if > 10, crit if > 15
check_mssql.sh -H localhost -U name -P pass -D Northwind -Q "select count(id) from messages" -w 10 -c 15