diff options
Diffstat (limited to 'modules/private/monitoring')
-rw-r--r-- | modules/private/monitoring/objects_common.nix | 2 | ||||
-rwxr-xr-x | modules/private/monitoring/plugins/check_mysql_replication | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/modules/private/monitoring/objects_common.nix b/modules/private/monitoring/objects_common.nix index 4b44e56..ee158dc 100644 --- a/modules/private/monitoring/objects_common.nix +++ b/modules/private/monitoring/objects_common.nix | |||
@@ -145,7 +145,7 @@ in | |||
145 | check_smtp = "$USER1$/check_smtp -H $HOSTADDRESS$ -p 25 -S -D 21,15"; | 145 | check_smtp = "$USER1$/check_smtp -H $HOSTADDRESS$ -p 25 -S -D 21,15"; |
146 | check_tcp = "$USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$ -e \"$ARG2$\" -Mcrit"; | 146 | check_tcp = "$USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$ -e \"$ARG2$\" -Mcrit"; |
147 | check_tcp_ssl = "$USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$ -S -D 21,15"; | 147 | check_tcp_ssl = "$USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$ -S -D 21,15"; |
148 | check_zfs = "$USER2$/check_zpool.sh -p ALL"; | 148 | check_zfs = "$USER2$/check_zpool.sh -p ALL -w 80 -c 90"; |
149 | 149 | ||
150 | check_host_alive = "$USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5"; | 150 | check_host_alive = "$USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5"; |
151 | check_last_file_date = "${sudo} -u \"$ARG3$\" $USER2$/check_last_file_date \"$ARG1$\" \"$ARG2$\""; | 151 | check_last_file_date = "${sudo} -u \"$ARG3$\" $USER2$/check_last_file_date \"$ARG1$\" \"$ARG2$\""; |
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) |