Forum Discussion

silver78's avatar
silver78
Icon for Nimbostratus rankNimbostratus
Nov 01, 2024

IMAP-S External Health monitor

Here an external health monitor to check IMAPS service. My F5 version is 17.1.1. Working successfully.

 

 

#!/bin/bash
# IMAP Health Check for F5 with IPv4-only adjustment

HOST=$(echo $1 | sed 's/::ffff://')  # Force IPv4 format
PORT=993

# Capture response with error handling
response=$(echo -e "A1 CAPABILITY\nA1 LOGOUT" | /usr/bin/openssl s_client -connect "$HOST:$PORT" -crlf -ign_eof 2>&1)

# Log for debugging and check for a successful IMAP response
echo "Debug: OpenSSL response for $HOST: $response" | logger -p local0.notice -t IMAPMonitor

if echo "$response" | grep -q "OK"; then
  echo "UP"
  exit 0
else
  echo "DOWN"
  exit 1
fi

  • Hello ,

     

    Do you have any queries in this or only statement?

     

    Br

    Aswin