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
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