diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2021-03-09 01:13:47 +0100 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2021-03-09 01:13:47 +0100 |
commit | ef909e2435194af725f4338a13e4732328ef7361 (patch) | |
tree | edea0c466a7ad3ef083cfa1e57cd4fdf79081ab8 /modules/private/monitoring/plugins/check_mysql_replication | |
parent | 85ad771e2635a544461f0a340f8b8c7126688678 (diff) | |
download | Nix-ef909e2435194af725f4338a13e4732328ef7361.tar.gz Nix-ef909e2435194af725f4338a13e4732328ef7361.tar.zst Nix-ef909e2435194af725f4338a13e4732328ef7361.zip |
Adjust sql parameters
This commit makes several changes:
- One of the mysql databases is not dumped anymore
- Monitoring now checks that mysql is actually replicating
- Databases are migrated to ssd
Diffstat (limited to 'modules/private/monitoring/plugins/check_mysql_replication')
-rwxr-xr-x | modules/private/monitoring/plugins/check_mysql_replication | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/modules/private/monitoring/plugins/check_mysql_replication b/modules/private/monitoring/plugins/check_mysql_replication index 4027f63..1ee5de1 100755 --- a/modules/private/monitoring/plugins/check_mysql_replication +++ b/modules/private/monitoring/plugins/check_mysql_replication | |||
@@ -10,7 +10,10 @@ config_file=$2 | |||
10 | info=$(mysql --defaults-file=${config_file} -S $socket -e "show slave status" --vertical) | 10 | info=$(mysql --defaults-file=${config_file} -S $socket -e "show slave status" --vertical) |
11 | exit_code=$? | 11 | exit_code=$? |
12 | 12 | ||
13 | lag=$(echo "$info" | grep Seconds_Behind_Master | cut -d':' -f2 | sed -e "s/\s//g") | 13 | lag=$(echo "$info" | grep "\bSeconds_Behind_Master\b" | cut -d':' -f2 | sed -e "s/\s//g") |
14 | |||
15 | IO_running=$(echo "$info" | grep "\bSlave_IO_Running\b" | cut -d':' -f2 | sed -e "s/\s//g") | ||
16 | SQL_running=$(echo "$info" | grep "\bSlave_SQL_Running\b" | cut -d':' -f2 | sed -e "s/\s//g") | ||
14 | 17 | ||
15 | if [[ $exit_code -ne 0 ]]; then | 18 | if [[ $exit_code -ne 0 ]]; then |
16 | echo "UNKNOWN - Impossible to run mysql command" | 19 | echo "UNKNOWN - Impossible to run mysql command" |
@@ -18,6 +21,9 @@ if [[ $exit_code -ne 0 ]]; then | |||
18 | elif [[ -z "$lag" ]]; then | 21 | elif [[ -z "$lag" ]]; then |
19 | echo "UNKNOWN - No replication found for mysql" | 22 | echo "UNKNOWN - No replication found for mysql" |
20 | exit $STATE_UNKNOWN | 23 | exit $STATE_UNKNOWN |
24 | elif [[ "$IO_running" != "Yes" || "$SQL_running" != "Yes" ]]; then | ||
25 | echo "UNKNOWN - Replication is not running" | ||
26 | exit $STATE_UNKNOWN | ||
21 | else | 27 | else |
22 | output="Replication lag for mysql is ${lag}s" | 28 | output="Replication lag for mysql is ${lag}s" |
23 | LC_ALL=C lag=$(printf "%.*f" 0 $lag) | 29 | LC_ALL=C lag=$(printf "%.*f" 0 $lag) |