From 176835f5992a5268bc0e6aed18498c2e48c4dc37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Wed, 13 Jan 2021 12:57:40 +0100 Subject: [PATCH] Check if urgent update is pending --- xymon/plugins/client/ext/maco.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/xymon/plugins/client/ext/maco.sh b/xymon/plugins/client/ext/maco.sh index 3ebde14..486d239 100755 --- a/xymon/plugins/client/ext/maco.sh +++ b/xymon/plugins/client/ext/maco.sh @@ -20,6 +20,7 @@ readonly DEFAULT_MTIME_MINUTES="600" # Maco readonly MACO_LOCAL_DIR="/opt/maco" readonly MACO_PENDING_UPDATE_FILE="${MACO_LOCAL_DIR}/.maco.upgrade" +readonly MACO_PENDING_URGENT_UPDATE_FILE="${MACO_LOCAL_DIR}/.maco.urgent.upgrade" # Temp files readonly TEMP_MACO_UPDATE="${XYMONTMP}/${MACHINEDOTS}.${TEST}.maco_update" @@ -172,6 +173,26 @@ No Maco normal update is planned." ## No need to add information to PLUGIN_STATE fi +} +# }}} +# Verify if a urgent Maco update is planned {{{ +check_pending_urgent_update() { + + if [ -f "${MACO_PENDING_URGENT_UPDATE_FILE}" ]; then + debug_message "check_pending_urgent_update − \ +An urgent Maco update is planned." + ## Add color and message to PLUGIN_RESULT for detailed informations + echo "${RED_PIC} An urgent update is planned (${MACO_PENDING_URGENT_UPDATE_FILE} file exists)." >> "${PLUGIN_RESULT}" + ## Add information to PLUGIN_STATE + echo "14${RED_PIC} An urgent update is planned" >> "${PLUGIN_STATE}" + else + debug_message "check_pending_urgent_update − \ +No Maco urgent update is planned." + ## Add color and message to PLUGIN_RESULT for detailed informations + echo "${GREEN_PIC} No Maco urgent update is planned (${MACO_PENDING_URGENT_UPDATE_FILE} file doesn't exists)." >> "${PLUGIN_RESULT}" + ## No need to add information to PLUGIN_STATE + fi + } # }}} # Send plugin results to Xymon server {{{ @@ -213,6 +234,9 @@ main() { # {{{ ## Check for pending update for Maco check_pending_update + + ## Check for urgent pending update for Maco + check_pending_urgent_update fi # Send data to Xymon server