X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=modules%2Fprivate%2Fmonitoring%2Fplugins%2Fcheck_redis_replication;fp=modules%2Fprivate%2Fmonitoring%2Fplugins%2Fcheck_redis_replication;h=0000000000000000000000000000000000000000;hb=1a64deeb894dc95e2645a75771732c6cc53a79ad;hp=6dbe4c4e7b6795bbaae50bbc37bef6276d3e43e7;hpb=fa25ffd4583cc362075cd5e1b4130f33306103f0;p=perso%2FImmae%2FConfig%2FNix.git diff --git a/modules/private/monitoring/plugins/check_redis_replication b/modules/private/monitoring/plugins/check_redis_replication deleted file mode 100755 index 6dbe4c4..0000000 --- a/modules/private/monitoring/plugins/check_redis_replication +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -STATE_OK=0 -STATE_WARNING=1 -STATE_CRITICAL=2 -STATE_UNKNOWN=3 - -socket=$1 - -info=$(redis-cli -s $socket info replication) -lag=$(echo "$info" | grep master_last_io_seconds_ago | cut -d":" -f2 | sed -e "s/\s//g") -slave_offset=$(echo "$info" | grep slave_repl_offset | cut -d":" -f2 | sed -e "s/\s//g") -master_offset=$(echo "$info" | grep master_repl_offset | cut -d":" -f2 | sed -e "s/\s//g") -offset=$(($master_offset - $slave_offset)) - -exit_code=$? - -if [[ $exit_code -ne 0 ]]; then - echo "UNKNOWN - Impossible to run redis command" - exit $STATE_UNKNOWN -elif [[ -z "$lag" ]]; then - echo "UNKNOWN - No replication found" - exit $STATE_UNKNOWN -else - output="Replication lag for redis is ${lag}s and offset is ${offset}" - LC_ALL=C lag=$(printf "%.*f" 0 $lag) - - if [[ $lag -lt 5 && $offset -lt 5 ]]; then - echo "OK - $output | time=${lag}s;5;10;0; offset=${offset};5;10;0;" - exit $STATE_OK - elif [[ $lag -lt 10 && $offset -lt 10 ]]; then - echo "WARNING - $output | time=${lag}s;5;10;0; offset=${offset};5;10;0;" - exit $STATE_WARNING - else - echo "CRITICAL - $output | time=${lag}s;5;10;0; offset=${offset};5;10;0;" - exit $STATE_CRITICAL - fi -fi