aboutsummaryrefslogtreecommitdiff
path: root/modules/private/monitoring
diff options
context:
space:
mode:
Diffstat (limited to 'modules/private/monitoring')
-rw-r--r--modules/private/monitoring/objects_common.nix2
-rwxr-xr-xmodules/private/monitoring/plugins/check_mysql_replication8
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
10info=$(mysql --defaults-file=${config_file} -S $socket -e "show slave status" --vertical) 10info=$(mysql --defaults-file=${config_file} -S $socket -e "show slave status" --vertical)
11exit_code=$? 11exit_code=$?
12 12
13lag=$(echo "$info" | grep Seconds_Behind_Master | cut -d':' -f2 | sed -e "s/\s//g") 13lag=$(echo "$info" | grep "\bSeconds_Behind_Master\b" | cut -d':' -f2 | sed -e "s/\s//g")
14
15IO_running=$(echo "$info" | grep "\bSlave_IO_Running\b" | cut -d':' -f2 | sed -e "s/\s//g")
16SQL_running=$(echo "$info" | grep "\bSlave_SQL_Running\b" | cut -d':' -f2 | sed -e "s/\s//g")
14 17
15if [[ $exit_code -ne 0 ]]; then 18if [[ $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
18elif [[ -z "$lag" ]]; then 21elif [[ -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
24elif [[ "$IO_running" != "Yes" || "$SQL_running" != "Yes" ]]; then
25 echo "UNKNOWN - Replication is not running"
26 exit $STATE_UNKNOWN
21else 27else
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)