response=$(curl -s http://search-orders.srv.fish:8080/binlog-webapp/binlog?type=status)
tstamp=$(curl -s http://search-orders.srv.fish:8080/binlog-webapp/binlog?type=status| jq '.status' | awk -F'"' '$2=="currentTimestamp"{print $4}')
status=$(curl -s http://search-orders.srv.fish:8080/binlog-webapp/binlog?type=status| jq '.status' | awk -F'"' '$2=="running"{print $4}')
oldstamp=$(date +%s -d "-24 hours")
respinsec=$(date -d "${tstamp}" +"%s")
if [ -z "$response" ]; then
echo "CRITICAL status - No API response"
exit 2
elif [[ "${status}" != "true" ]]; then
echo "CRITICAL status - Search replication is not running."
exit 2
elif (( respinsec < oldstamp )); then
echo "CRITICAL status - Timestamp is over 24 hours."
exit 2
else
echo "OK - Search Replication is running correctly"
exit 0
fi
No comments:
Post a Comment