Search This Blog

Oracle Fusion Middleware Administration Course

Oracle Fusion Middleware Administration Course
OFMW Admin Course

Sunday, May 24, 2009

Cosmotising your WLST output

Here I am with new idea that colored output according to the state of the Server.
Hope most of you(WLA) knows WLST script for displaying Server status, my idea is when the server state is in SHUTDOWN state let it display in red color, STARTING state in YELLOW, and geen for RUNNING state and so on... colors you can specify as per your choice. 

I ran thru google for searching colors in python... it is simple logic print instruction in python putting UNIX shell code way. The color code need to be prefix in the line where color need to appear in the output.

My choice of WLST is that it should have a provision to rerun the script if user wish to run the script after a while. this makes less time to get output because re-initializing of WLST is not required 

CODE Snippet:
#Fetch the state of the every WebLogic instance
        for name in serverNames:
                cd("/ServerLifeCycleRuntimes/" + name.getName())
                serverState = cmo.getState()
                if serverState == "RUNNING":
                        print 'Server ' + name.getName() + ' is :\033[1;32m' + serverState + '\033[0m'
                elif serverState == "STARTING":
                        print 'Server ' + name.getName() + ' is :\033[1;33m' + serverState + '\033[0m'
                elif serverState == "UNKNOWN":
                        print 'Server ' + name.getName() + ' is :\033[1;34m' + serverState + '\033[0m'
                        print 'Server ' + name.getName() + ' is :\033[1;31m' + serverState + '\033[0m'


  1. Hi Dude, Kaati laga chesav script keep it up. saregani intaki ekkada unnav and ela unnav. Venu etla unnadu......

  2. Hi,

    could you please let me know the script execution process, though it's a basic thing i jus want that process



Please write your comment here

Popular Posts

Oracle WebLogic Administration Course

Oracle WebLogic Administration Course
WebLogic Training