Script for nagios to check SQL DataBases, Connection Time, Jobs, TempDB Size, Log Size. The script get all sql instances in the server, and return status for eache instance You can use check_mssql_config.ini to exclude DB or instance to check, read check_mssql_config.ini help.
Yossi Bitton yosbit@gmail.com Date: November 2018 Version 1.1.2
Get the database status, return critical if one DB not in normal state.
Get the time to connect to DB, include performance data.
Get the status off all jobs, the script check only Enabled and scheduled jobs.
Get the size of temp DB. see values of warning and critical in check_mssql_config.ini config. needs dbowner permissions for user Service Account.
Get the size of Log file for eache DB. see values of warning and critical in check_mssql_config.ini config. needs dbowner permissions for user Service Account.
./check_nrpe -H -c check_mssql -a 'DBStatus' ./check_nrpe -H -c check_mssql -a 'ConnectionTime' ./check_nrpe -H -c check_mssql -a 'Jobs' ./check_nrpe -H -c check_mssql -a 'TempDBSize' ./check_nrpe -H -c check_mssql -a 'LogSize'
Edit NRPE config:
Edit NSC.ini or nsclient.ini and add the following line under section:
[Wrapped Scripts]
check_mssql=check_mssql.ps1 $ARG1$
[Script Wrappings]
ps1 = cmd /c echo scripts\%SCRIPT%%ARGS%; exit($lastexitcode) | powershell.exe -ExecutionPolicy Bypass -command -
add the followings lines under:
[/settings/external scripts/scripts]
check_mssql = cmd /c echo scripts\check_mssql.ps1 $ARG1$ ; exit($lastexitcode) | powershell.exe -ExecutionPolicy Bypass -command -