Check if urgent update is pending

This commit is contained in:
Jeremy Gardais 2021-01-13 12:57:40 +01:00
parent d8ecdc01e1
commit 176835f599
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 24 additions and 0 deletions

View File

@ -20,6 +20,7 @@ readonly DEFAULT_MTIME_MINUTES="600"
# Maco # Maco
readonly MACO_LOCAL_DIR="/opt/maco" readonly MACO_LOCAL_DIR="/opt/maco"
readonly MACO_PENDING_UPDATE_FILE="${MACO_LOCAL_DIR}/.maco.upgrade" readonly MACO_PENDING_UPDATE_FILE="${MACO_LOCAL_DIR}/.maco.upgrade"
readonly MACO_PENDING_URGENT_UPDATE_FILE="${MACO_LOCAL_DIR}/.maco.urgent.upgrade"
# Temp files # Temp files
readonly TEMP_MACO_UPDATE="${XYMONTMP}/${MACHINEDOTS}.${TEST}.maco_update" 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 ## No need to add information to PLUGIN_STATE
fi 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 {{{ # Send plugin results to Xymon server {{{
@ -213,6 +234,9 @@ main() { # {{{
## Check for pending update for Maco ## Check for pending update for Maco
check_pending_update check_pending_update
## Check for urgent pending update for Maco
check_pending_urgent_update
fi fi
# Send data to Xymon server # Send data to Xymon server