cd /usr/local/nagios/libexec/
./check_mssql_database.py -H 1.2.3.4 -U abc -P 1234 -T master --datasize --warning 10000 --critical 100000
(20009, 'DB-Lib error message 20009, severity 9:\nUnable to connect: Adaptive Server is unavailable or does not exist (1.2.3.4:1433)\nNet-Lib error during Connection timed out (110)\n')
[root@AXmonitor ~]# head -25 /usr/local/nagios/libexec/check_mssql_server.py
#!/usr/bin/env python
################### check_mssql_database.py ############################
# Version 2.0.2
# Date : Apr 4 2013
# Author : Nicholas Scott ( scot0357 at gmail.com )
# Help : scot0357 at gmail.com
# Licence : GPL -
http://www.fsf.org/licenses/gpl.txt
#
# Changelog :
# 1.0.2 - Fixed Uptime Counter to be based off of database
# Fixed divide by zero error in transpsec
# 1.1.0 - Fixed port bug allowing for non default ports | Thanks CBTSDon
# Added batchreq, sqlcompilations, fullscans, pagelife | Thanks mike from austria
# Added mode error checking which caused non-graceful exit | Thanks mike from austria
# 1.2.0 - Added ability to specify instances
# 2.0.0 - Complete rewrite of the structure, re-evaluated some queries
# to hopefully make them more portable | Thanks CFriese
# Updated the way averages are taken, no longer needs tempdb access
# 2.0.1 - Fixed try/finally statement to accomodate Python 2.4 for
# legacy systems
# 2.0.2 - Fixed issues where the SQL cache hit queries were yielding improper results
# when done on large systems | Thanks CTrahan
# 2.0.3 - Remove misleading description of lockwait, removing the word Average -SW
# Modified 01/22/2015 Removed extraneous ';' from output. -BD-G
########################################################################