Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
check_mssql_nt
Meet The New Nagios Core Services Platform
Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.
Monitoring Made Magically Better
- Nagios Core on Overdrive
- Powerful Monitoring Dashboards
- Time-Saving Configuration Wizards
- Open Source Powered Monitoring On Steroids
- And So Much More!
MS SQL Server Nagios Check Plugin v0.1
This program is free software; you can redistribute it and/or modify it under the GNU General Public License.
Written by Francois Zbinden (zbinden at dataflow dot ch), 2008
This program is a Win32 native Microsoft SQL Server Nagios check plugin for use with NRPE_NT. It requires SQL Server Native Client installed. You can use it to just detect SQL Server connectivity or run querys. Performance data output is supported.
Usage: check_mssql_nt.exe [/h] /H:hostname [/D:dbname] [/U:username] [/P:password] [/t:timeout] [/CHK_CONNECT] [/CHK_CONNECTIONCOUNT] [/CHK_QUERY:ownquery] /w:warn_secs /c:crit_secs /Wv:[max_value|min_value:max_value] /Cv:[max_value|min_value:max_value] [/PF:outformatter]
/h, /?
Display the help
/H:
Hostname of the sql server
/D:
Database name
/U:
Username. If empty it will try to login using the current windows account.
/P:
Password
/CHK_CONNECT
Try to connect the database. This is the default
/CHK_CONNECTIONCOUNT
Actual count of connections. If a database name is specified, count of connections to the database.
/CHK_QUERY:
SQL Query to execute. The query must return one record, if no record or mutliple record are returned, it will produce a CRITICAL. If one record is returned, the value will be the first row of the record.
/w:
Warn if query duration is longer than value
/c:
Critical if query duration is longer than value
/Wv:
Warn if query result value is bigger than value
/Cv:
Critical if query result value is bigger than value
/FO:
Pretty format the output. Use %d as value placeholder. Example: /FO:"%d pending orders"
/t:
Timeout in seconds
Examples:
Check connectivity:
check_mssql_nt /H:sqlv1
Check connectivity with time check (warn>= 0.1s, critical>= 2s):
check_mssql_nt /H:sqlv1 -w:0.1 -c:2
Check total connections count of all databases (warn if count>= 50, critical>= 100):
check_mssql_nt /H:sqlv1 /CHK_CONNECTIONCOUNT -Wv:50 -Cv100
Check total connections count of 'warehouse' databas (warn if count is over 50, critical over 100):
check_mssql_nt /H:sqlv1 /D:warehouse /CHK_CONNECTIONCOUNT -Wv:50 -Cv100
Check a custom query (warn if result is over 50 or query duration is over one second, critical over 100 or duration is over 5 seconds):
check_mssql_nt /H:sqlv1 /D:warehouse /CHK_QUERY:"select count(*) from orders where status='pending'" -W1 -C5 -Wv:100 -Cv100 /FO:"%d pending orders"
You can also use it as a event handler:
check_mssql_nt /H:sqlv1 /CHK_QUERY:"delete from orders where status='error'"
This program is free software; you can redistribute it and/or modify it under the GNU General Public License.
Written by Francois Zbinden (zbinden at dataflow dot ch), 2008
This program is a Win32 native Microsoft SQL Server Nagios check plugin for use with NRPE_NT. It requires SQL Server Native Client installed. You can use it to just detect SQL Server connectivity or run querys. Performance data output is supported.
Usage: check_mssql_nt.exe [/h] /H:hostname [/D:dbname] [/U:username] [/P:password] [/t:timeout] [/CHK_CONNECT] [/CHK_CONNECTIONCOUNT] [/CHK_QUERY:ownquery] /w:warn_secs /c:crit_secs /Wv:[max_value|min_value:max_value] /Cv:[max_value|min_value:max_value] [/PF:outformatter]
/h, /?
Display the help
/H:
Hostname of the sql server
/D:
Database name
/U:
Username. If empty it will try to login using the current windows account.
/P:
Password
/CHK_CONNECT
Try to connect the database. This is the default
/CHK_CONNECTIONCOUNT
Actual count of connections. If a database name is specified, count of connections to the database.
/CHK_QUERY:
SQL Query to execute. The query must return one record, if no record or mutliple record are returned, it will produce a CRITICAL. If one record is returned, the value will be the first row of the record.
/w:
Warn if query duration is longer than value
/c:
Critical if query duration is longer than value
/Wv:
Warn if query result value is bigger than value
/Cv:
Critical if query result value is bigger than value
/FO:
Pretty format the output. Use %d as value placeholder. Example: /FO:"%d pending orders"
/t:
Timeout in seconds
Examples:
Check connectivity:
check_mssql_nt /H:sqlv1
Check connectivity with time check (warn>= 0.1s, critical>= 2s):
check_mssql_nt /H:sqlv1 -w:0.1 -c:2
Check total connections count of all databases (warn if count>= 50, critical>= 100):
check_mssql_nt /H:sqlv1 /CHK_CONNECTIONCOUNT -Wv:50 -Cv100
Check total connections count of 'warehouse' databas (warn if count is over 50, critical over 100):
check_mssql_nt /H:sqlv1 /D:warehouse /CHK_CONNECTIONCOUNT -Wv:50 -Cv100
Check a custom query (warn if result is over 50 or query duration is over one second, critical over 100 or duration is over 5 seconds):
check_mssql_nt /H:sqlv1 /D:warehouse /CHK_QUERY:"select count(*) from orders where status='pending'" -W1 -C5 -Wv:100 -Cv100 /FO:"%d pending orders"
You can also use it as a event handler:
check_mssql_nt /H:sqlv1 /CHK_QUERY:"delete from orders where status='error'"
Reviews (2)
It works as expected but does not work out of the box on Windows 2008 R2. In order to get past the "MSSQL Critical - Error: Provider cannot be found..." you need to install the SQL Server 2005 SQL Native Client. This can be found here: http://www.microsoft.com/en-us/download/details.aspx?id=17943
The problem basicly is that check_mssql_nt looks for SQLNCLI.1 but on Windows 2008 R2 this has been replaced by SQLNCLI10.1. By installing the SQL Server 2005 SQL Native Client the SQLNCLI.1 version is added so that the plugin can use it.
The problem basicly is that check_mssql_nt looks for SQLNCLI.1 but on Windows 2008 R2 this has been replaced by SQLNCLI10.1. By installing the SQL Server 2005 SQL Native Client the SQLNCLI.1 version is added so that the plugin can use it.