Tuesday, 29 March 2022

Fusion Middleware Health `not ok` Alert

Fusion Middleware - WebLogic Admin or Managed servers health warning Alert

So, We had requirement where our SOA team requested to have alert in place if SOA Admin or any of managed servers health goes into warning. As usual, we tried to set the alert from Web-Logic itself using standard method given in oracle DOC ID: 2478424.1 . However we were having this error "SMTPSenderFailedException: 501 5.1.7 Invalid address" which we were not able to resolve even with help of oracle.

Well, we couldn't go to sleep yet and decided to have our own python customized script for the alert and Bingo !! it worked like charm. 

Coming straight to point, Please find below script that can be used for any version of FMW (11g, 12c ). Just copy paste the script and run it using wlst as below:

Step 1: 

$source setDomainEnv.sh 

Step2: 

$java weblogic.WLST  get_wls_serverstatus.py

you can just extract the result of above wlst in log file and grep "'Server OverAll Health" into your mail:


$cat get_wls_serverstatus.py

############################################################################

# This script is for checking the Health Status of the servers

#  Author: @achaltecharch.blogspot.com

############################################################################

#       Connect to the Admin Server

from java.io import FileInputStream

import java.lang

import os

import string

connect("weblogic","******","t3://<Admin Node host>:<port>")

domainRuntime()

 cd('ServerRuntimes')

 servers=domainRuntimeService.getServerRuntimes()

for server in servers:

     serverName=server.getName();

     print '##############' , serverName,'###############'

     print 'Server OverAll Health :', server.getOverallHealthState()

     print '----------------------------------------------'


No comments:

Post a Comment