Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Abstract

This document describes how you can monitor an MSSQL MySQL 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 MySQL user account
  • Test the connection to the database 
  • Setup your server host definition  
Panel
titleOn this page

Table of Contents
maxLevel3

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_mssqlmysql_health plugin : /var/lib/shinken/libexec/check_mssqlmysql_health
  2. Several host templates are ready to be used

 

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

Setup the

MSSQL user

MySQL 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.

 

Connect with a root account on your MySQL database. change ‘password’ with your mysql root password:

Code Block
languagebash
 lin-srv-1:# mysql -u root -ppassword

And create a shinken user:

Code Block
languagesql
GRANT usage ON *.* TO 'shinken'@'%' IDENTIFIED BY 'shinkenpassword';

It’s a good thing to change the shinkenpassword to another password. Then you need to update the /etc/shinken/resource.d/mysql.cfg

Code Block
$MYSQLUSER$=shinken
$MYSQLPASSWORD$=shinkenpassword

Test the connection

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

Code Block
languagebash
/var/lib/shinken/libexec/check_mssqlmysql_health --serverhostname "srv-winlin-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.

Info
titleExample

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

mysql

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

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

CheckDetailScopeCheck rangeDefault WarningDefault Critical
connectionTime to connect to the serverdatabase-freeFree space in databasedatabase0 to 100%n2%15%5
restartTime the server is runningfree-list-stallsRequests per second that had to wait for a free pageserver0 to n410page-life-expectancySeconds a page is kept in memory before being flushed:5:
slow_queriesslow_queriesserver0 to n300:180:0.11
tmp_disk_tablesPercent of temp tables created on disktotal-server-memoryThe amount of memory that SQL Server has allocated to itserver0 to n100000025500000050
mssql

mysql-full

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

Warning
titleWarning

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

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

mssql

mysql-connection-method

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

 

mssql

mysql-

availability

cluster

This template gives informations about the database availabilityMySQL cluster.

 

CheckDetailScopeCheck rangeDefault WarningDefault Critical
connectionTime to connect to the serverserver0 to n sec12
mssql-backup-age

 

mysql-innoDB

This template gives informations about the backup age of your databasesinnoDB buffers and logwaits.

 

CheckDetailScopeCheck rangeDefault WarningDefault Critical
bufferpool_hitrateInnoDB buffer pool hitratedatabase-backup-ageElapsed time (in hours) since a database was last backed updatabase0 to n hours4899:72

mssql-batch-requests

This template gives informations about the batch requests.

 

95:
bufferpool_wait_freeInnoDB buffer pool waits for clean page available
CheckDetailScopeCheck rangeDefault WarningDefault Critical
batch-requestsBatch requests per secondserver0 to n1001200

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
10
log_waitsInnoDB log waits because of a too small log buffer0 to n110

mysql-MyISAM

mssql-full-scans

This template gives informations about the full scansMyISAM key cache hitrate.

 

CheckDetailScopeCheck rangeDefault WarningDefault Critical
fullkeycache-scansFull table scans per secondhitrateMyISAM key cache hitrateserver0 to n10099:50095:
mssql

mysql-

latch

performance

This template gives informations about the latchesglobal server performance.

 

CheckDetailScopeCheck rangeDefault WarningDefault Critical
index_usageUsage of indexeslatches-wait-timeAverage time for a latch to wait before the request is metserver0 to n190:580:
long_running_procslong running processeslatches-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
20
table_lock_contentionTable lock contention

mssql-locks

This template gives informations about locks.

 

CheckDetailScopeCheck rangeDefault WarningDefault Critical
locks-deadlockThe number of deadlocks per secondserver0 to n15locks-timeoutsThe number of locks per second that timed outserver2
tablecache_hitrateTable cache hitrate0 to n199:95:
threadcache_hitrateHit rate of the thread-cache5locks-waitsThe number of locks per second that had to waitserver0 to n1001050020
mssql

mysql-

server

query-

performance

cache

This template gives informations about MSSQL server performancequery cache.

 

CheckDetailScopeCheck rangeDefault WarningDefault Critical
qcache_hitrateQuery cache hitratecpu-busyCpu busy in percentserver0 to n8090io-busyIO busy in percentserver0 to n90:80:90mem-pool-data-buffer-hit-ratioData Buffer Cache Hit Ratio
qcache_lowmem_prunesQuery cache entries pruned because of low memoryserver0 to n90:180:10
mssql

mysql-

transactions

usage

This template gives informations about databases transactionsMySQL server usage.

 

CheckDetailScopeCheck rangeDefault WarningDefault Critical
open_filesPercent of opened filestransactionsTransactions per second (per database)database0 to n100008050000

mssql-usage

This template gives informations about the database usage.

 

95
threads_connected
CheckDetailScopeCheck rangeDefault WarningDefault Critical
connected-usersNumber of currently connected usersserveropen connections0 to n50108020

How to 

Configuration of

Mssql

Mysql-connection-method host template

Click on Hosts then on Hosts Templates in the Elements menu

In the Name field, type mssqlmysql-connection.

Then clic on mssqlmysql-connection-method

Image RemovedImage Added
Clic on Data tab 

You can setup the following DATA : 

  • DATABASESMYSSQLPASSWORD : the name(s) of the database(s) to be monitored.MSSQLPASSWORD : the MSSQL MySQL password of the user used to connect to database
  • MSSQLUSERMYSQLUSER : the MSSQL MySQL user name used to connect to database

 

Image Removed 

 

 

 

Image Added

 

Tip

You can also set the user and password directly in /etc/shinken/resource.d/myslq.cfg

Code Block
$MYSQLUSER$=shinken
$MYSQLPASSWORD$=shinkenpassword



Attach a MySQL

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

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 oracle-connection-method.

Attach a MSSQL

template to you host

Clic on Hosts in the Elements menu

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

For example the Oracle MySQL host template.

Image RemovedImage Added

Click on the Data tab

Image Removed

Look for the field DATABASES in the From templates data

 

Type the name of the database to be monitoring

Image Removed
Image Added
Check if the Following data are ok.

 

 

Tip
titleTip

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