From a2c2565ec20ee1336598b9e96cb5363471c91287 Mon Sep 17 00:00:00 2001 From: Markus Makela Date: Tue, 16 Jun 2015 22:36:53 +0300 Subject: [PATCH] Fixed typo and added an example script. --- monitors/Galera-Monitor.md | 2 +- monitors/MM-Monitor.md | 2 +- monitors/MySQL-Monitor.md | 30 +++++++++++++++++++++++++++++- monitors/NDB-Cluster-Monitor.md | 2 +- 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/monitors/Galera-Monitor.md b/monitors/Galera-Monitor.md index ffe54fb83..6a66fdcfc 100644 --- a/monitors/Galera-Monitor.md +++ b/monitors/Galera-Monitor.md @@ -108,7 +108,7 @@ master_down|A Master server has gone down master_up|A Master server has come up slave_down|A Slave server has gone down slave_up|A Slave server has come up -server_down|A server with no assigned role has done down +server_down|A server with no assigned role has gone down server_up|A server with no assigned role has come up synced_down|A synced Galera node has come up synced_up|A synced Galera node has gone down diff --git a/monitors/MM-Monitor.md b/monitors/MM-Monitor.md index 00375d4bf..ad9ee2c07 100644 --- a/monitors/MM-Monitor.md +++ b/monitors/MM-Monitor.md @@ -99,7 +99,7 @@ master_down|A Master server has gone down master_up|A Master server has come up slave_down|A Slave server has gone down slave_up|A Slave server has come up -server_down|A server with no assigned role has done down +server_down|A server with no assigned role has gone down server_up|A server with no assigned role has come up lost_master|A server lost Master status lost_slave|A server lost Slave status diff --git a/monitors/MySQL-Monitor.md b/monitors/MySQL-Monitor.md index ab643109e..1bfc06109 100644 --- a/monitors/MySQL-Monitor.md +++ b/monitors/MySQL-Monitor.md @@ -108,10 +108,38 @@ master_down|A Master server has gone down master_up|A Master server has come up slave_down|A Slave server has gone down slave_up|A Slave server has come up -server_down|A server with no assigned role has done down +server_down|A server with no assigned role has gone down server_up|A server with no assigned role has come up lost_master|A server lost Master status lost_slave|A server lost Slave status new_master|A new Master was detected new_slave|A new Slave was detected + +## Example 1 - Monitor script + +Here is an example shell script which sends an email to an admin when a server goes down. + +``` +#!/usr/bin/env bash + +#This script assumes that the local mail server is configured properly + +message="A server has gone down at `date`." +echo $message|mail -s "A server has gone down" admin@my.org + +``` + +Here is a monitor configuration that only triggers the script when a master or a slave server goes down. + +``` +[Database Monitor] +type=monitor +module=mysqlmon +servers=server1,server2 +script=mail_to_admin.sh +events=master_down,slave_down +``` + +When a master or a slave server goes down, the script is executed, a mail is sent and the administrator will be immediately notified of any possible problems. +This is just a simple example showing what you can do with MaxScale and monitor scripts. diff --git a/monitors/NDB-Cluster-Monitor.md b/monitors/NDB-Cluster-Monitor.md index a9f453678..9468ec323 100644 --- a/monitors/NDB-Cluster-Monitor.md +++ b/monitors/NDB-Cluster-Monitor.md @@ -89,7 +89,7 @@ master_down|A Master server has gone down master_up|A Master server has come up slave_down|A Slave server has gone down slave_up|A Slave server has come up -server_down|A server with no assigned role has done down +server_down|A server with no assigned role has gone down server_up|A server with no assigned role has come up ndb_down|A MySQL Cluster node has gone down ndb_up|A MySQL Cluster node has come up