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'
else:
print 'Server ' + name.getName() + ' is :\033[1;31m' + serverState + '\033[0m'
Hi Dude, Kaati laga chesav script keep it up. saregani intaki ekkada unnav and ela unnav. Venu etla unnadu......
ReplyDeleteHi,
ReplyDeletecould you please let me know the script execution process, though it's a basic thing i jus want that process
Thanks,
Sunil