Saturday, July 23, 2011

Wanna get the status of the applications in domain

In most of environments we have multiple applications deployed on our servers, it is diffcult to check their status when server uses high cpu utilisation. We can get the details by giving one input i.e., targetname.
Please check the below code snippet and you can change as per your requirement.
#################################################################################
#This script will get you status of the all the applications which are deployed #
#in the Domain.         #
# script get you the colored output                         #
# NOTE : You need to give target name as an input to the script                #
# Author: Krishna Sumanth Naishadam                         #
#################################################################################
import sys

connect('username','password','t3://:')
targetName=sys.argv[1]
domainConfig()
apps=cmo.getAppDeployments()
for i in apps:
 navPath1=getMBean('domainConfig:/AppDeployments/'+i.getApplicationName())
 appID=navPath1.getApplicationIdentifier()
 navPath=getMBean('domainRuntime:/AppRuntimeStateRuntime/AppRuntimeStateRuntime')
 sts=navPath.getCurrentState(appID,targetName)
 if(sts == "STATE_ACTIVE"):
  print "\033[1;32m Status of " + i.getApplicationName() + ": " + sts + "\033[1;m"
 else:
  print "\033[1;31m Status of " + i.getApplicationName() + ": " + sts + "\033[1;m"
disconnect()
exit()

domain_app_status.sh
********************

WL_HOME="
# set up common environment
. "${WL_HOME}/server/bin/setWLSEnv.sh"

CLASSPATH="${CLASSPATH}:${WL_HOME}/common/eval/pointbase/lib/pbembedded51.jar:${WL_HOME}/common/eval/pointbase/lib/pbtools51.jar:${WL_HOME}/common/eval/pointbase/lib/pbclient51.jar"
read -p "Enter Target Name : " value1

"${JAVA_HOME}/bin/java" -Xmx124m -Dprod.props.file=${WL_HOME}/.product.properties weblogic.WLST domain_app_status.py $value1 $*

Output:
======
Status of : STATE_ACTIVE (Green Color)
Status of : STATE_FAILED (Red Color)
Status of : STATE_NEW (Red Color)

Please see below screenshot for exact output

Monday, July 18, 2011

Script to get the status of the server instances and their health

Hi,

This script will give you the server status as well as their health status for all servers in a domain.

please change the user credentials as per your requirement and correct me if i'm wrong.

Server_status.py
****************
#######################################################################################
# This script gets the health status and server status in a domain #
# Author: Krishna Sumanth Naishadam #
#######################################################################################
import os
import time
import sys

# To get the health status of the servers
def healstat(server_name):
try:
cd('/ServerRuntimes/'+server_name+'/ThreadPoolRuntime/ThreadPoolRuntime')
s=get('HealthState')
x=s.toString().split(',')[1].split(':')[1]
print server.getName() + ': ' + x
print '============================================='
except WLSTException,e:
print dumpStack()

# Main
if __name__== "main":
global s,x
connect("username","password","t3://WL-ADMIN-HOST:port")
domainConfig()
servers = cmo.getServers()
domainRuntime()

# To get the status of the servers
for server in servers:
try:
print '============================================='
cd('/ServerLifeCycleRuntimes/' + server.getName())
print server.getName() + ': ' + get('State')
healstat(server.getName())
except WLSTException,e:
print dumpStack()

disconnect()

server_status.sh
****************

We are using this shell script to call the above script
WL_HOME="Weblogic Home Path"

# set up common environment
. "${WL_HOME}/server/bin/setWLSEnv.sh"

CLASSPATH="${CLASSPATH}:${WL_HOME}/common/eval/pointbase/lib/pbembedded51.jar:${WL_HOME}/common/eval/pointbase/lib/pbtools51.jar:${WL_HOME}/common/eval/pointbase/lib/pbclient51.jar"

"${JAVA_HOME}/bin/java" -Xmx124m -Dprod.props.file=${WL_HOME}/.product.properties weblogic.WLST server_status.py $*



Output:
=======================
admin: RUNNING
admin: HEALTH_OK
=======================
=======================
man1: RUNNING
man1: HEALTH_WARN
=======================

Tuesday, May 18, 2010

Blogs Update_2

Here are some blogs,

Weblogic Wonders by JaySenSharma
http://weblogic-wonders.com/weblogic/

let's get small
http://tim.oreilly.com/pub/wlg/3946

Guardian for weblogic (From Basics)
http://blogs.oracle.com/supportportal/2009/04/a_guardian_angel_for_your_webl_6.html

Weblogic Docs at one glance (Download all versions at one place)
http://blogs.oracle.com/prash/2009/09/wls_docs.html

PUB-SUB Server in brief
http://blogs.oracle.com/prash/2009/08/getting_started_with_wls_pubsu.html

Wednesday, November 11, 2009

Some urls i follow

weblogic blog by Bala
http://weblogicserver.blogspot.com/

Bala's Oracle Fusion Middleware Blog
http://blogs.oracle.com/bala/

Saturday, August 29, 2009

BEA Zero Downtime Funny video

Zero Downtime
http://www.youtube.com/watch?v=-jop4Q65Zd0

WEBLOGIC 10gR3

Link For "NEW FEATURES IN WEBLOGIC 10gR3"
http://www.youtube.com/watch?v=moyKjWoWeC8

Link for "Faster console with WebLogic Server 10.3"
http://www.youtube.com/watch?v=R2wv9HKpGPw&feature=related

Link for "BEA WebLogic Server 9 - Generating Thread Dump from console"
http://www.youtube.com/watch?v=OwvFCBs0ZGc

Check out the videos

Regards,
Sumanth