check_curl: change print

check_mysql_slave: fix exit code
This commit is contained in:
Cyberes 2024-04-06 00:05:11 -06:00
parent b29dc0ee6e
commit e78212cf65
2 changed files with 9 additions and 9 deletions

View File

@ -386,11 +386,11 @@ if [ $CURL_EXIT -ne 0 ]; then
msg="CRITICAL - An internal call to poll() or select() returned error that is not recoverable" msg="CRITICAL - An internal call to poll() or select() returned error that is not recoverable"
;; ;;
*) *)
echo "UNKNOWN - $CURL_EXIT -> $URL" echo "UNKNOWN - $CURL_EXIT"
exit 3 exit 3
;; ;;
esac esac
echo "$msg -> $URL" echo "$msg"
exit 2 exit 2
fi fi
@ -400,20 +400,20 @@ perfdata="response_time=${RESPONSE_TIME_MS}ms;${WARN_TIME};${CRIT_TIME};0;"
# Check HTTP code # Check HTTP code
if [ -n "$EXPECTED_STATUS_CODE" ]; then if [ -n "$EXPECTED_STATUS_CODE" ]; then
if [ "$HTTP_CODE" -ne "$EXPECTED_STATUS_CODE" ]; then if [ "$HTTP_CODE" -ne "$EXPECTED_STATUS_CODE" ]; then
echo "CRITICAL - server returned HTTP code $HTTP_CODE, expected $EXPECTED_STATUS_CODE -> $URL" echo "CRITICAL - server returned HTTP code $HTTP_CODE, expected $EXPECTED_STATUS_CODE"
exit 2 exit 2
fi fi
elif [ "$IGNORE_STATUS" != "yes" ] && [ "$HTTP_CODE" -ne 200 ]; then elif [ "$IGNORE_STATUS" != "yes" ] && [ "$HTTP_CODE" -ne 200 ]; then
echo "CRITICAL - server returned HTTP code $HTTP_CODE -> $URL" echo "CRITICAL - server returned HTTP code $HTTP_CODE"
exit 2 exit 2
fi fi
# Check response time # Check response time
if [ $(echo "$RESPONSE_TIME_MS > $CRIT_TIME" | bc) -eq 1 ]; then if [ $(echo "$RESPONSE_TIME_MS > $CRIT_TIME" | bc) -eq 1 ]; then
echo "CRITICAL - Response time $RESPONSE_TIME seconds -> $URL | $perfdata" echo "CRITICAL - Response time $RESPONSE_TIME seconds | $perfdata"
exit 2 exit 2
elif [ $(echo "$RESPONSE_TIME_MS > $WARN_TIME" | bc) -eq 1 ]; then elif [ $(echo "$RESPONSE_TIME_MS > $WARN_TIME" | bc) -eq 1 ]; then
echo "WARNING - response time $RESPONSE_TIME seconds -> $URL | $perfdata" echo "WARNING - response time $RESPONSE_TIME seconds | $perfdata"
exit 1 exit 1
fi fi

View File

@ -85,13 +85,13 @@ def main(args):
if replication_delay <= crit_deviation_min: if replication_delay <= crit_deviation_min:
exit_code = nagios.STATE_CRIT exit_code = nagios.STATE_CRIT
exit_msg.append('Replication is delayed!') exit_msg.append('Replication is delayed!')
if replication_delay >= crit_deviation_max: elif replication_delay >= crit_deviation_max:
exit_code = nagios.STATE_CRIT exit_code = nagios.STATE_CRIT
exit_msg.append('Replication is ahead???') exit_msg.append('Replication is ahead???')
if replication_delay <= warn_deviation_min: elif replication_delay <= warn_deviation_min:
exit_code = nagios.STATE_WARN exit_code = nagios.STATE_WARN
exit_msg.append('Replication is delayed!') exit_msg.append('Replication is delayed!')
if replication_delay >= warn_deviation_max: elif replication_delay >= warn_deviation_max:
exit_code = nagios.STATE_WARN exit_code = nagios.STATE_WARN
exit_msg.append('Replication is ahead???') exit_msg.append('Replication is ahead???')