check_keepalived: Add 2nd stat file location

This commit is contained in:
ssieber 2023-05-03 17:24:37 +02:00 committed by Jan Wagner
parent bc49084211
commit d27b9f4204

View file

@ -81,7 +81,7 @@ while [ "$1" != "" ]; do
done done
# Config and commands # Config and commands
STAT_FILE='/tmp/keepalived.status' STAT_FILE='/var/run/keepalived.status'
PID_FILE='/run/keepalived.pid' PID_FILE='/run/keepalived.pid'
PID=$("${CAT}" "${PID_FILE}" 2>/dev/null) PID=$("${CAT}" "${PID_FILE}" 2>/dev/null)
SERVICE=$("${PG}" keepalived) SERVICE=$("${PG}" keepalived)
@ -92,8 +92,13 @@ CHECK_HAIP2=$("${IP}" 2>/dev/null addr sh "${IFACE2}" | "${GREP}" "${HAIP2}" | "
# Check files are valid # Check files are valid
if [ ! -e "${STAT_FILE}" ] if [ ! -e "${STAT_FILE}" ]
then then
echo "CRITICAL: Generated status file is missing. State could not be determined." if [ -e /tmp/keepalived.status ]
exit "${CRITICAL}" then
STAT_FILE='/tmp/keepalived.status'
else
echo "CRITICAL: Generated status file is missing. State could not be determined."
exit "${CRITICAL}"
fi
fi fi
FILE_CONT=$("${CAT}" "${STAT_FILE}" 2>/dev/null) FILE_CONT=$("${CAT}" "${STAT_FILE}" 2>/dev/null)