This Bash script checks the status of specified WebLogic Server instances and categorizes them into failed and running servers. It uses curl to retrieve server status and jq to parse the JSON response. Finally, it sends an email report listing the status of the servers to a specified email address.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
6 views1 page
Web Logic Status Email
This Bash script checks the status of specified WebLogic Server instances and categorizes them into failed and running servers. It uses curl to retrieve server status and jq to parse the JSON response. Finally, it sends an email report listing the status of the servers to a specified email address.
for server in "${servers[@]}" do echo "Checking status of $server..." server_status=$(curl -su $WEBLOGIC_USER:$WEBLOGIC_PASSWORD http://$IP_ADDRESS: $WEBLOGIC_PORT/management/weblogic/latest/domainRuntime/serverRuntimes/$server)
# Parse JSON response to extract "title" and "state"
echo "$server is not reachable or an error occurred." failed_servers+=("$server") elif [ "$state" == "RUNNING" ]; then echo "$server is running." running_servers+=("$server") else echo "$server is in an unknown state." fi done
# Send email echo "$EMAIL_BODY" | mail -s "$EMAIL_SUBJECT" "$EMAIL_TO" if [ $? -eq 0 ]; then echo "Email sent successfully." else echo "Failed to send email." fi