I want to monitor the below health check URL. I need generate a alert if mongodb goes to disconnected state. I wrote a bash script. Seems its still not working. Any can help on this ? Thanks
When do health check to https://www.example.com/healthz result as below response: {"mongodb":"connected","redis":"connected"}
And my Bash script is:
#!/bin/bash
data=$(wget --timeout 5 -O - -q -t 1 https://www.example.com/healthz)
message=$(jq '.Disconnected' <<< "$data")
if [[ "$message" == '"Success"' ]] ; then
echo something
else
send email
$(). I.E"$(...)"