Abstract

This document describes how you can monitor an MSSQL database server such as:

  • Connection time
  • The number of connections
  • Cache hit
  • etc

 

There are some steps you’ll need to follow in order to monitor a new database machine: 

  • Understand what is already available (in the Shinken Entreprise installation) 
  • Setup the MSSQL user account
  • Test the connection to the database 
  • Setup your server host definition  



What is already available in the Shinken Installation

To make your life a bit easier, a few configuration tasks have already been done for you:

  1. Installation of check_mssql_health plugin : /var/lib/shinken/libexec/check_mssql_health
  2. Several host templates are ready to be used

 

We suppose here that the MSSQL server you want to monitor is named srv-win-1 and is a Windows. Please change the configuration and commands according with the real name of your server.


Setup the MSSQL user account

Create the database user

Look at the labs.consol.de/lang/en/nagios/check_mssql_health/ page about how to configure your user connection.

 

Test the connection

To see if the connection to the MSSQL server is ok using a domain user, just launch :


/var/lib/shinken/libexec/check_mssql_health --server "srv-win-1" --username "shinkendom\\shinken" --password "shinkenpassword" --mode connection-time



Manage more than 1 database on the same host

Some checks presents in MSSQL templates provided by Shinken Entreprise use the "Duplicate For Each" functionality.

For each database name listed in the DATA "DATABASES", check will be duplicated. An host, having 2 databases, will then have in double each checks with the datatabase name in the check.

Let's look an example: an host has the following:

  • The data "DATABASES" set to "DB1,DB2,DB3"
  • The MSSQL template attached on it.
  • Let's consider the Mssql-$KEY$-database-free check. It will then have 2 checks:
    • Mssql-DB1-database-free
    • Mssql-DB2-database-free


Each check able to be used on a database base will be indicated with a scope "database".

What is checked with the templates


Public templates

mssql

This is the very basic MSSQL template allowing to know if your MSSQL database server is running and usable.

Every MSSQL templates (except Mssql-connection-method) use it as a parent template.

CheckDetailScopeCheck rangeDefault WarningDefault Critical
database-freeFree space in databasedatabase0 to 100%2%5%
free-list-stallsRequests per second that had to wait for a free pageserver0 to n410
page-life-expectancySeconds a page is kept in memory before being flushedserver0 to n300:180:
total-server-memoryThe amount of memory that SQL Server has allocated to itserver0 to n10000005000000


mssql-full

Contains all MSSQL host templates listed in the Shinken Adminstrators templates.

Using the mssql-full template will require a lot of resources on your poller daemon. We advise to use only needed templates.


Shinken Administrator templates (can't be seen by other users)

mssql-connection-method

This template describes the method to connect to MSSQL server. Every MSSQL templates use it as a parent template.

 

mssql-availability

This template gives informations about the database availability.

 

CheckDetailScopeCheck rangeDefault WarningDefault Critical
connectionTime to connect to the serverserver0 to n sec12


mssql-backup-age

This template gives informations about the backup age of your databases.

 

CheckDetailScopeCheck rangeDefault WarningDefault Critical
database-backup-ageElapsed time (in hours) since a database was last backed updatabase0 to n hours4872


mssql-batch-requests

This template gives informations about the batch requests.

 

CheckDetailScopeCheck rangeDefault WarningDefault Critical
batch-requestsBatch requests per secondserver0 to n100200


mssql-checkpoint-pages

This template gives informations about the checkpoint pages.

 

CheckDetailScopeCheck rangeDefault WarningDefault Critical
checkpoint-pagesDirty pages flushed to disk per second. (usually by a checkpoint)server0 to n100500


mssql-compilations

This template gives informations about compilations.

 

CheckDetailScopeCheck rangeDefault WarningDefault Critical
sql-initcompilationsInitial compilations per secondserver0 to n100200
sql-recompilationsRe-Compilations per secondserver0 to n110


mssql-full-scans

This template gives informations about the full scans.

 

CheckDetailScopeCheck rangeDefault WarningDefault Critical
full-scansFull table scans per secondserver0 to n100500


mssql-latch

This template gives informations about the latches.

 

CheckDetailScopeCheck rangeDefault WarningDefault Critical
latches-wait-timeAverage time for a latch to wait before the request is metserver0 to n15
latches-waitsNumber of latch requests that could not be granted immediatelyserver0 to n1050


mssql-lazy-writes

This template gives informations about the lazy writes.

 

CheckDetailScopeCheck rangeDefault WarningDefault Critical
lazy-writesLazy writes per secondserver0 to n2040


mssql-locks

This template gives informations about locks.

 

CheckDetailScopeCheck rangeDefault WarningDefault Critical
locks-deadlockThe number of deadlocks per secondserver0 to n15
locks-timeoutsThe number of locks per second that timed outserver0 to n15
locks-waitsThe number of locks per second that had to waitserver0 to n100500


mssql-server-performance

This template gives informations about MSSQL server performance.

 

CheckDetailScopeCheck rangeDefault WarningDefault Critical
cpu-busyCpu busy in percentserver0 to n8090
io-busyIO busy in percentserver0 to n8090
mem-pool-data-buffer-hit-ratioData Buffer Cache Hit Ratioserver0 to n90:80:


mssql-transactions

This template gives informations about databases transactions.

 

CheckDetailScopeCheck rangeDefault WarningDefault Critical
transactionsTransactions per second (per database)database0 to n1000050000


mssql-usage

This template gives informations about the database usage.

 

CheckDetailScopeCheck rangeDefault WarningDefault Critical
connected-usersNumber of currently connected usersserver0 to n5080


How to 

Configuration of Mssql-connection-method host template

Click on Hosts then on Hosts Templates in the Elements menu

In the Name field, type mssql-connection.

Then clic on mssql-connection-method

Clic on Data tab 

You can setup the following DATA : 

  • DATABASES : the name(s) of the database(s) to be monitored.
  • MSSQLPASSWORD : the MSSQL password of the user used to connect to database
  • MSSQLUSER : the MSSQL user name used to connect to database

 

 

 

 

 


The parameters specifics to each server, such as database name for example, has to be done in the host's data itself.

It's a best practice to use the same database monitoring user on every MSSQL server monitored. Doing so, you can configure the database user/password only once in the host template mssql-connection-method.


Attach a MSSQL template to you host

Clic on Hosts in the Elements menu

Add the chosen Oracle host template to the Host Templates to inherit field.

For example the Oracle host template.

Click on the Data tab

Look for the field DATABASES in the From templates data

 

Type the name of the database to be monitoring

Check if the Following data are ok.

 

 

You can monitor multiple database on the same host in typing the name of the database name separated by a comma.

Exemple : DB1,DB2,DB3