Following script helps in enabling the monitoring on all osb proxy deployed in the domain.
##############################################################################################################################
# Scope : To Enable the monitoring options on the proxy services deployed on the OSB.
# Process :
# 1. Set the classpath
# CLASSPATH=/u01/app/oracle/product/fmw/Oracle_OSB1/lib/sb-kernel-api.jar:/u01/app/oracle/product/fmw/Oracle_OSB1/lib/sb-kernel-impl.jar:/u01/app/oracle/product/fmw/Oracle_OSB1/lib/modules/com.bea.alsb.configfwk-wls.jar:$CLASSPATH
# 2. export CLASSPATH
# 3. set the domain eg : . ./bin/setDomain.sh
# 4. Update the sction below on the Enviroment specificaitons ( host,port,credentials)
# 5. execute the following command java weblogic.WLST ProxyServiceMonotringOptions.py
##################################################################################################################################
import javax.management
import java.util
import javax.management.remote
import javax.naming
import weblogic.management.mbeanservers.domainruntime
import com.bea.wli.sb.management.configuration
from java.util import Hashtable
from java.util import HashSet
from java.util import ArrayList
from javax.management.remote import JMXServiceURL
from weblogic.management.mbeanservers.domainruntime import DomainRuntimeServiceMBean
from javax.naming import Context
from javax.management.remote import JMXConnectorFactory
from javax.management import ObjectName
from com.bea.wli.sb.management.configuration import SessionManagementMBean
from com.bea.wli.sb.management.configuration import ALSBConfigurationMBean
from com.bea.wli.sb.management.configuration import CommonServiceConfigurationMBean
import weblogic.management.jmx.MBeanServerInvocationHandler
from com.bea.wli.config import Ref
from com.bea.wli.config.env import EnvValueQuery
from com.bea.wli.config.env import QualifiedEnvValue
from com.bea.wli.config.resource import DependencyQuery
from com.bea.wli.sb.management.query import ProxyServiceQuery
from com.bea.wli.sb.management.query import BusinessServiceQuery
from com.bea.wli.sb.util import EnvValueTypes
from java.util import Collection
from java.util import Collections
def setMonitoringAllProjectsAndServices(isEnabled):
refs = configMBean.getRefs(Ref.DOMAIN)
refsList = ArrayList()
refsList.addAll(refs)
for ref in refsList :
if ref.getTypeId() == "ProxyService" :
if ref.getTypeId() == "ProxyService" :
isPS = "1"
else:
isPS = "0"
if isEnabled:
print "enabling monitoring for ", ref.getFullName()
proxyServiceConfigurationMBean.enableMonitoring(ref)
else:
print "disabling monitoring for ", ref.getFullName()
proxyServiceConfigurationMBean.disableMonitoring(ref)
else:
print " This is Not a Proxy", ref.getFullName()
sessionName = "MonitorUpdate"
hostname=sys.argv[1]
port=7001
username=sys.argv[2]
password=sys.argv[3]
serviceURL=JMXServiceURL("t3", hostname, port, "/jndi/" + DomainRuntimeServiceMBean.MBEANSERVER_JNDI_NAME)
h=Hashtable()
h.put(Context.SECURITY_PRINCIPAL, username)
h.put(Context.SECURITY_CREDENTIALS, password)
h.put(JMXConnectorFactory.PROTOCOL_PROVIDER_PACKAGES, "weblogic.management.remote")
conn = JMXConnectorFactory.connect(serviceURL, h)
mbconn = conn.getMBeanServerConnection()
sm = JMX.newMBeanProxy(mbconn, ObjectName.getInstance(SessionManagementMBean.OBJECT_NAME), SessionManagementMBean)
sm.createSession(sessionName)
configMBean = JMX.newMBeanProxy(mbconn, ObjectName.getInstance("com.bea:Name=" + ALSBConfigurationMBean.NAME + "." + sessionName + ",Type=" + ALSBConfigurationMBean.TYPE), ALSBConfigurationMBean)
domainService = weblogic.management.jmx.MBeanServerInvocationHandler.newProxyInstance(mbconn, ObjectName(DomainRuntimeServiceMBean.OBJECT_NAME), DomainRuntimeServiceMBean, false)
proxyServiceConfigurationMBean = domainService.findService(String("ProxyServiceConfiguration.").concat(sessionName),'com.bea.wli.sb.management.configuration.ProxyServiceConfigurationMBean', None)
setMonitoringAllProjectsAndServices(true)
sm.activateSession(sessionName, "Complete enable/disable service monitoring")
conn.close()
------------------------------------
##############################################################################################################################
# Scope : To Enable the monitoring options on the proxy services deployed on the OSB.
# Process :
# 1. Set the classpath
# CLASSPATH=/u01/app/oracle/product/fmw/Oracle_OSB1/lib/sb-kernel-api.jar:/u01/app/oracle/product/fmw/Oracle_OSB1/lib/sb-kernel-impl.jar:/u01/app/oracle/product/fmw/Oracle_OSB1/lib/modules/com.bea.alsb.configfwk-wls.jar:$CLASSPATH
# 2. export CLASSPATH
# 3. set the domain eg : . ./bin/setDomain.sh
# 4. Update the sction below on the Enviroment specificaitons ( host,port,credentials)
# 5. execute the following command java weblogic.WLST ProxyServiceMonotringOptions.py
##################################################################################################################################
import javax.management
import java.util
import javax.management.remote
import javax.naming
import weblogic.management.mbeanservers.domainruntime
import com.bea.wli.sb.management.configuration
from java.util import Hashtable
from java.util import HashSet
from java.util import ArrayList
from javax.management.remote import JMXServiceURL
from weblogic.management.mbeanservers.domainruntime import DomainRuntimeServiceMBean
from javax.naming import Context
from javax.management.remote import JMXConnectorFactory
from javax.management import ObjectName
from com.bea.wli.sb.management.configuration import SessionManagementMBean
from com.bea.wli.sb.management.configuration import ALSBConfigurationMBean
from com.bea.wli.sb.management.configuration import CommonServiceConfigurationMBean
import weblogic.management.jmx.MBeanServerInvocationHandler
from com.bea.wli.config import Ref
from com.bea.wli.config.env import EnvValueQuery
from com.bea.wli.config.env import QualifiedEnvValue
from com.bea.wli.config.resource import DependencyQuery
from com.bea.wli.sb.management.query import ProxyServiceQuery
from com.bea.wli.sb.management.query import BusinessServiceQuery
from com.bea.wli.sb.util import EnvValueTypes
from java.util import Collection
from java.util import Collections
def setMonitoringAllProjectsAndServices(isEnabled):
refs = configMBean.getRefs(Ref.DOMAIN)
refsList = ArrayList()
refsList.addAll(refs)
for ref in refsList :
if ref.getTypeId() == "ProxyService" :
if ref.getTypeId() == "ProxyService" :
isPS = "1"
else:
isPS = "0"
if isEnabled:
print "enabling monitoring for ", ref.getFullName()
proxyServiceConfigurationMBean.enableMonitoring(ref)
else:
print "disabling monitoring for ", ref.getFullName()
proxyServiceConfigurationMBean.disableMonitoring(ref)
else:
print " This is Not a Proxy", ref.getFullName()
sessionName = "MonitorUpdate"
hostname=sys.argv[1]
port=7001
username=sys.argv[2]
password=sys.argv[3]
serviceURL=JMXServiceURL("t3", hostname, port, "/jndi/" + DomainRuntimeServiceMBean.MBEANSERVER_JNDI_NAME)
h=Hashtable()
h.put(Context.SECURITY_PRINCIPAL, username)
h.put(Context.SECURITY_CREDENTIALS, password)
h.put(JMXConnectorFactory.PROTOCOL_PROVIDER_PACKAGES, "weblogic.management.remote")
conn = JMXConnectorFactory.connect(serviceURL, h)
mbconn = conn.getMBeanServerConnection()
sm = JMX.newMBeanProxy(mbconn, ObjectName.getInstance(SessionManagementMBean.OBJECT_NAME), SessionManagementMBean)
sm.createSession(sessionName)
configMBean = JMX.newMBeanProxy(mbconn, ObjectName.getInstance("com.bea:Name=" + ALSBConfigurationMBean.NAME + "." + sessionName + ",Type=" + ALSBConfigurationMBean.TYPE), ALSBConfigurationMBean)
domainService = weblogic.management.jmx.MBeanServerInvocationHandler.newProxyInstance(mbconn, ObjectName(DomainRuntimeServiceMBean.OBJECT_NAME), DomainRuntimeServiceMBean, false)
proxyServiceConfigurationMBean = domainService.findService(String("ProxyServiceConfiguration.").concat(sessionName),'com.bea.wli.sb.management.configuration.ProxyServiceConfigurationMBean', None)
setMonitoringAllProjectsAndServices(true)
sm.activateSession(sessionName, "Complete enable/disable service monitoring")
conn.close()
------------------------------------
Hi, I'm trying to run this ProxyServiceConfigurationMBean.isMonitoringEnabled(ref, serviceRef)
ReplyDeletecan you please help me, how to pass the values for this
thanks
Jayme Silvestri
ReplyDeleteIt’s very nice of you to write such a detail and concise guide for people like me to know more about blogging. I am a newbie in this field and I am planning to creat a blog in the next few weeks. Thanks a lot for your hints and advices about mistakes that newbie usually make. Reading this definitely saves me a lot of time later.