Display more informations after queue state

This commit is contained in:
Jeremy Gardais 2020-06-10 16:15:29 +02:00
parent 4baaabd346
commit 1b2148eceb
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 9 additions and 13 deletions

View File

@ -176,42 +176,38 @@ get_status()
# Order determines more significant alert status # Order determines more significant alert status
if [ "$(echo "${qstate}" | grep -c d)" != "0" ]; then if [ "$(echo "${qstate}" | grep -c d)" != "0" ]; then
echo "4&clear $queue@$HOST is DISABLED" >> "${PLUGIN_STATE}" echo "4&clear $queue@$HOST is DISABLED" >> "${PLUGIN_STATE}"
queueMsg=$(echo "$queueMsg<BR>$CLEAR_PIC $queue@$HOST is DISABLED") queueMsg=$(echo "$queueMsg<BR>$CLEAR_PIC $queue@$HOST is DISABLED<BR>${_LINE}")
queueTriggered=true; queueTriggered=true;
elif [ "$(echo "${qstate}" | grep -c E)" != "0" ]; then elif [ "$(echo "${qstate}" | grep -c E)" != "0" ]; then
echo "1&red $queue@$HOST is in ERROR!" >> "${PLUGIN_STATE}" echo "1&red $queue@$HOST is in ERROR!" >> "${PLUGIN_STATE}"
queueMsg=$(echo "$queueMsg<BR>$RED_PIC $queue@$HOST is in ERROR") queueMsg=$(echo "$queueMsg<BR>$RED_PIC $queue@$HOST is in ERROR!<BR>${_LINE}")
queueTriggered=true; queueTriggered=true;
elif [ "$(echo "${qstate}" | grep -c c)" != "0" ]; then elif [ "$(echo "${qstate}" | grep -c c)" != "0" ]; then
echo "2&yellow $queue@$HOST has an ambigious configuration!" >> "${PLUGIN_STATE}" echo "2&yellow $queue@$HOST has an ambigious configuration!" >> "${PLUGIN_STATE}"
queueMsg=$(echo "$queueMsg<BR>$YELLOW_PIC $queue@$HOST has an ambigious configuration!") queueMsg=$(echo "$queueMsg<BR>$YELLOW_PIC $queue@$HOST has an ambigious configuration!<BR>${_LINE}")
queueTriggered=true; queueTriggered=true;
elif [ "$(echo "${qstate}" | grep -c a)" != "0" ] || \ elif [ "$(echo "${qstate}" | grep -c a)" != "0" ] || \
[ "$(echo "${qstate}" | grep -c A)" != "0" ]; then [ "$(echo "${qstate}" | grep -c A)" != "0" ]; then
echo "2&yellow $queue@$HOST is in ALARM" >> "${PLUGIN_STATE}" echo "2&yellow $queue@$HOST is in ALARM" >> "${PLUGIN_STATE}"
queueMsg=$(echo "$queueMsg<BR>$YELLOW_PIC $queue@$HOST is in ALARM") queueMsg=$(echo "$queueMsg<BR>$YELLOW_PIC $queue@$HOST is in ALARM<BR>${_LINE}")
elif [ "$(echo "${qstate}" | grep -c s)" != "0" ] || \ elif [ "$(echo "${qstate}" | grep -c s)" != "0" ] || \
[ "$(echo "${qstate}" | grep -c S)" != "0" ]; then [ "$(echo "${qstate}" | grep -c S)" != "0" ]; then
echo "2&yellow $queue@$HOST is SUSPENDED" >> "${PLUGIN_STATE}" echo "2&yellow $queue@$HOST is SUSPENDED" >> "${PLUGIN_STATE}"
queueMsg=$(echo "$queueMsg<BR>$YELLOW_PIC $queue@$HOST is SUSPENDED") queueMsg=$(echo "$queueMsg<BR>$YELLOW_PIC $queue@$HOST is SUSPENDED<BR>${_LINE}")
elif [ "$(echo "${qstate}" | grep -c u)" != "0" ]; then elif [ "$(echo "${qstate}" | grep -c u)" != "0" ]; then
echo "2&yellow $queue@$HOST is UNAVAILABLE" >> "${PLUGIN_STATE}" echo "2&yellow $queue@$HOST is UNAVAILABLE" >> "${PLUGIN_STATE}"
queueMsg=$(echo "$queueMsg<BR>$YELLOW_PIC $queue@$HOST is UNAVAILABLE!") queueMsg=$(echo "$queueMsg<BR>$YELLOW_PIC $queue@$HOST is UNAVAILABLE!<BR>${_LINE}")
queueTriggered=true; queueTriggered=true;
elif [ "$qstate" = "" ]; then elif [ "$qstate" = "" ]; then
echo "3&green $queue@$HOST is OK" >> "${PLUGIN_STATE}" echo "3&green $queue@$HOST is OK" >> "${PLUGIN_STATE}"
queueMsg=$(echo "$queueMsg<BR>$GREEN_PIC $queue@$HOST is OK") queueMsg=$(echo "$queueMsg<BR>$GREEN_PIC $queue@$HOST is OK<BR>${_LINE}")
else else
echo "5&purple $queue@$HOST is UNKNOWN" >> "${PLUGIN_STATE}" echo "5&purple $queue@$HOST is UNKNOWN" >> "${PLUGIN_STATE}"
queueMsg=$(echo "$queueMsg<BR>$UNKNOWN_PIC $queue@$HOST is UNKNOWN") queueMsg=$(echo "$queueMsg<BR>$UNKNOWN_PIC $queue@$HOST is UNKNOWN<BR>${_LINE}")
queueTriggered=true; queueTriggered=true;
fi fi
done < "${PLUGIN_RESULT}.QSTATE" done < "${PLUGIN_RESULT}.QSTATE"
if [ -f "${PLUGIN_RESULT}.QSTATE" ]; then
rm -f -- "${PLUGIN_RESULT}.QSTATE"
fi
get_header "Queue Instance Status Report" get_header "Queue Instance Status Report"
echo "$queueMsg" echo "$queueMsg"
get_footer get_footer
@ -239,7 +235,7 @@ COLOR=$(< "${PLUGIN_STATE}" awk '{print $1}' | sort | uniq | head -1 | cut -c3-)
# and may not actually run on every client # and may not actually run on every client
# #
if [ -f "${PLUGIN_RESULT}" ]; then if [ -f "${PLUGIN_RESULT}" ]; then
rm -f -- "${PLUGIN_RESULT}" "${PLUGIN_STATE}" rm -f -- "${PLUGIN_RESULT}" "${PLUGIN_STATE}" "${PLUGIN_RESULT}.QSTATE"
fi fi
############################################## ##############################################
# end of script # end of script