Abstract
This document describes how you can monitor a MySQL server such as:
These instructions assume that you've installed Shinken according to the Installation tutorial. The sample configuration entries below reference objects that are defined in the sample config files (“commands.cfg”, “templates.cfg”, etc.) that are installed if you follow the quickstart.
Monitoring a MySQL server need the plugin check_mysql_health available at http://labs.consol.de/lang/en/nagios/check_mysql_health/ and a mysql user account for the connection.
There are some steps you'll need to follow in order to monitor a new Linux machine. They are:
To make your life a bit easier, a few configuration tasks have already been done for you:
The above-mentioned config files can be found in the /etc/shinken/ directory (or c:\shinken\etc under windows). You can modify the definitions in these and other definitions to suit your needs better if you'd like. However, I'd recommend waiting until you're more familiar with configuring Shinken before doing so. For the time being, just follow the directions outlined below and you'll be monitoring your Mysql boxes in no time.
First connect as root under you Shinken server (or all poller servers for a multi-box setup) and launch :
shinken.sh -p check_mysql_health
Connect with a root account on your MySQL database. change 'password' with your mysql root password :
lin-srv-1:# mysql -u root -ppasswordAnd create a shinken user :
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.cfg file or c:\shinken\etc\resource.cfg file to setup the new password :
$MYSQLUSER$=shinken $MYSQLPASSWORD$=shinkenpassword
To see if the connection is ok, just launch :
/var/lib/nagios/plugins/check_mysql_health --hostname srv-lin-1 --username shinken --password shinkenpassword --mode connection-timeIt should not return errors.
All you need to get all the MySQL service checks is to add the mysql template to this host. We suppose you already monitor the OS (linux or windows for example) for this host, and so you already got the host configuration file for it.
Under Linux :
linux:~ # vi /etc/shinken/hosts/srv-lin-1.cfgOr Windows :
c:\ wordpad c:\shinken\etc\hosts\srv-lin-1.cfg
You need to add the mysql template in the use line. It's better to follow the more precise template to the less one, like here mysql first, and then linux.
define host{
use mysql,linux
host_name srv-lin-1
address srv-lin-1.mydomain.com
}
At this point, you configure your host to be checked with a mysql template. What does it means? It means that you got some services checks already configured for you. Warning and alert levels are between () :
You're done with modifying the Shiknen configuration, so you'll need to verify your configuration files and restart Shinken.
If the verification process produces any errors messages, fix your configuration file before continuing. Make sure that you don't (re)start Shinken until the verification process completes without any errors!