Monitoring Archive

Application State Monitoring using WLST

There are scenarios when you would want to monitor the Application state of the currently deployed applications in the Domain using the WebLogic Server Runtime Mbeans. Properties like Application State.
This can be achieved through many ways like the Admin Console, JMX code, WLST scripts etc. WLST allows us to automate the monitoring.

WebLogic Server runtime MBeans are arranged in a hierarchical data structure. When connected to an Administration Server, you access the runtime MBean hierarchy by entering the serverRuntime or the domainRuntime command. The serverRuntime command places WLST at the root of the server runtime management objects, ServerRuntimeMBean; the domainRuntime command, at the root of the domain-wide runtime management objects, DomainRuntimeMBean. When connected to a Managed Server, the root of the runtime MBeans is ServerRuntimeMBean. The domain runtime MBean hierarchy exists on the Administration Server only; you cannot use the domainRuntimecommand when connected to a Managed Server.

The below post depicts the usage of WLST to monitor the Application State deployed in the domain.
Steps:
1. Script to monitor Application Runtime States
a. Save the below script ApplicationStatus.py on to your local machine.
**************************************************************************

 

connect('weblogic','weblogic','t3://localhost:8001')
domainRuntime()
cd('AppRuntimeStateRuntime/AppRuntimeStateRuntime')
AppList = cmo.getApplicationIds()
print '####### Application ####### Application State\n'
print '***********************************************\n'
for App in AppList:
print '#######',App ,' #######', cmo.getIntendedState(App)
print '***********************************************\n'

 

 

**************************************************************************
2. Execute the WLST Script
a. Set the CLASSPATH by running the setDomainEnv script from the
Alternatively you can set the CLASSPATH by specifying the –cp argument while executing the WLST Script
For Ex: java –cp $BEA_HOME/wlserver_10.3/server/lib/weblogic.jar weblogic.WLST ApplicationStatus.py

Downloads

You can download the WLST script from the below link.

ApplicationStatus.py

Note: Rename the file as ApplicationStatus.py

References:

http://download.oracle.com/docs/cd/E11035_01/wls100/config_scripting/monitoring.html

Regards,
Wonders Team. 🙂

Apache Administration FAQ’s

How to disable Case Sensitivity in Apache?

Apache is case sensitive. When you application is hosted in case-insensitive webserver(like IIS) and moved to case-sensitive webserver (like Apache) you may get some problems related to non availability of URLS(HTTP 404 error). Apach provides a module which helps to make URLs case-insensitive.

Open httpd.conf(your apache configuration file) and find out the below line

LoadModule speling_module modules/mod_speling.so

If the above module is avilable with your apache, turn on the CheckSpelling directive

CheckSpelling On

How to monitor Apache server status?

There is a built in module mod_status available in apache which helps to get server status from a web browser

To monitor Apache webserver,

Open httpd.conf(Placed at <Apache Install Dir>/conf/httpd.conf)

vi httpd.conf

Set the Location directive as below. It will alow only from 192.13.24.57

<Location /server-status>

SetHandler server-status

Order Deny,Allow

Deny from all

Allow from 192.13.24.57

</Location>

Set ExtendendStatus to on

ExtendedStatus on

Save the httpd.conf and restart the webserver

Now you can monitor your apache webserver with http://servername/server-status from 192.13.24.57 browser

How to know whether a library is built on 32-bit or 64-bit?

Type below command at shell

file /usr/local/apache2.2.11/lib/libapr-1.so.0.3.3

The output of above command is,

/usr/local/apache2.2.11/lib/libapr-1.so.0.3.3: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), not stripped

The output tells that the libapr-1.so.0.3.3 file is built on 32-bit machines

Monitoring WebLogic Server Runtime using WLST

There are scenarios when you would want to monitor the properties of your alive servers in the Domain using the WebLogic Server Runtime Mbeans. Properties like Server State, Server Health, Listen Port, Listen Addresses etc.

This can be achieved through many ways like the Admin Console, JMX code, WLST scripts etc. WLST allows us to automate the monitoring.

WebLogic Server runtime MBeans are arranged in a hierarchical data structure. When connected to an Administration Server, you access the runtime MBean hierarchy by entering the serverRuntime or the domainRuntime command. The serverRuntime command places WLST at the root of the server runtime management objects, ServerRuntimeMBean; the domainRuntime command, at the root of the domain-wide runtime management objects, DomainRuntimeMBean. When connected to a Managed Server, the root of the runtime MBeans is ServerRuntimeMBean. The domain runtime MBean hierarchy exists on the Administration Server only; you cannot use the domainRuntimecommand when connected to a Managed Server.

The below post depicts the usage of WLST to monitor the Server State of all the running servers in the domain.

Steps:

1. Script to monitor Server Runtime States

a. Save the below script ServerStatus.py on to your local machine.

**************************************************************************

 

username = 'weblogic'

password = 'weblogic'

URL='t3://localhost:8001'

connect(username,password,URL)

domainRuntime()

cd('ServerRuntimes')

servers=domainRuntimeService.getServerRuntimes()

for server in servers:

serverName=server.getName();

print '**************************************************\n'

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

print '**************************************************\n'

print '##### Server State           #####', server.getState()

print '##### Server ListenAddress   #####', server.getListenAddress()

print '##### Server ListenPort      #####', server.getListenPort()

print '##### Server Health State    #####', server.getHealthState()

 

**************************************************************************

2. Execute the WLST Script

a.  Set the CLASSPATH by running the setDomainEnv script from the

Alternatively you can set the CLASSPATH by specifying the –cp argument while executing the WLST Script

For Ex:  java –cp $BEA_HOME/wlserver_10.3/server/lib/weblogic.jar  weblogic.WLST ServerStatus.py

Downloads

You can download the WLST script from the below link.

ServerStatus.py

Note: Save the script as ServerStatus.py

References:

http://download.oracle.com/docs/cd/E11035_01/wls100/config_scripting/monitoring.html

Regards,

Wonders Team. 🙂

WebLogic SNMP to monitor JMS Server

Configuring WebLogic SNMP to monitor JMS Server attributes using Counter Monitor.

SNMP: It is basically Internet Protocol used to manage the devices over the IP based Network. The devices could be servers ,routers, printers, switches etc.

WebLogic Server software includes the ability to communicate with enterprise-wide management systems using Simple Network Management Protocol (SNMP). The WebLogic Server SNMP capability enables you to integrate management of WebLogic Servers into an SNMP-compliant management system. Such a system provides a single view of the various software and hardware resources of a complex, distributed system.

The below article demonstrates of how WebLogic SNMP can be used to monitor the JMSServerRuntime Mbean attributes using Counter Monitor.

In the below example , we would check whether the  ‘MessagesCurrentCount‘ of the JMS Server exceeds the specified threshold and generate trap notifications accordingly.

Before we configure the SNMP Counter Monitor, make sure the JMS Server and Queue is properly configured.

Refer the below article to configure the JMS Queue.

http://weblogic-wonders.com/weblogic/2010/11/30/weblogic-jms-feature-using-a-queue/

The steps to configure Counter Monitor are as below.

1. Creating SNMP agent.

2. Creating SNMP Counter Monitor

3. Creating SNMP Trap Destination.

4. Verifying the SNMP Alerts.

1. Creating SNMP Agent:

a. Login into the Administration Console, navigate to Diagnostics → SNMP.

Click on New tab to create a Server SNMP Agent

b. Click on the newly created SNMP Agent → Enable the SNMP agent and you can modify the default SNMP agent attributes like SNMP ports etc.

c.Target the SNMP Agent to the AdminServer .

2. Create SNMP Counter Monitor:

Counter Monitor:

A counter monitor observes attribute values that are returned as an Integer object type.

You can specify that a trap is generated if an attribute is beyond the bounds of a threshold value. You can also specify that if a value exceeds a threshold, the monitor increases the threshold by an offset value. Each time the observed attribute exceeds the new threshold, the threshold is increased by the offset value, up to a maximum allowable threshold that you specify.

There are other different monitors that can be set along side Counter Monitor.

String Monitor: A string monitor observes changes in attributes that are expressed as String Objects.

For further reference on the same refer the below post.

http://weblogic-wonders.com/weblogic/2010/12/17/weblogic-snmp-for-string-monitor/

Gauge Monitor: A Gauge Monitor indicates whether  an attribute is operating within a specific range.

For further reference on the same refer the below post.

http://weblogic-wonders.com/weblogic/2010/12/19/weblogic-snmp-to-monitor-jdbc-connection-pool/

a.Click on Counter Monitor tab from the console.

b. From the drop down list of Mbeans, select  ‘JMSServerRuntime‘ Mbean

c. Select the MessagesCurrentCount‘ attribute from the drop down list.

d. Enter the threshold value for MessagesCurrentCount attribute exceeding which will generate SNMP Traps.

e. Click on the newly created Counter Monitor and specify which JMSServer Mbean you want to monitor (JMSServer-0), polling interval of the MBeans.

f. Target the created Counter Monitor to the AdminServer.

3. Creating SNMP Trap Destination:

a. Click SNMP Agent –>  Trap Destinations –>  New.

b. Specify the Trap Destination attributes like Host and Ports.

4. Verify the SNMP Traps:

To verify that a WebLogic Server SNMP Agent is generating and sending notifications, we can use the WebLogic command line utility SnmpTrapMonitor.

a. Open a command prompt and set the classpath to the weblogic.jar file under the %WLS_HOME%/lib folder.

set classpath=%classpath%;%WLS_HOME%\server\lib\weblogic.jar

b. Run the weblogic command line utility weblogic.diagnostics.snmp.cmdline.Manager SnmpTrapMonitor to receive notifications.

Make sure that you specify the same listen port for this Trap Monitor as the trap destination that you created for the SNMP Agent.

For example, if your trap destination specifies a listen port of 171, enter the following command: java

java weblogic.diagnostics.snmp.cmdline.Manager SnmpTrapMonitor -p 171

The SNMP setup is complete. The config.xml file would like below.

**********************************************************************

 

<snmp-counter-monitor>

<name>SNMPCounterMonitor-0</name>

<enabled-server>AdminServer</enabled-server>

<monitored-m-bean-type>JMSServerRuntime</monitored-m-bean-type>

<monitored-m-bean-name>JMSServer-0</monitored-m-bean-name>

<monitored-attribute-name>MessagesCurrentCount</monitored-attribute-name>

<polling-interval>10</polling-interval>

<threshold>10</threshold>

<offset>0</offset>

<modulus>0</modulus>

</snmp-counter-monitor>

 

**********************************************************************

If the MessagesCurrentCount value exceeds the threshold value of the JMSServer would generate Traps on to the listener as below.

From the command line utility:

**********************************************************************

java weblogic.diagnostics.snmp.cmdline.Manager SnmpTrapMonitor -p 171

— Snmp Trap Received —
Version        : v1
Source         : UdpEntity:127.0.0.1:161
Community      : public
Enterprise     : enterprises.140.625
TrapOID        : enterprises.140.625.0.75
RawTrapOID     : 1.3.6.1.4.1.140.625.0.75
Trap Objects   : {
{ enterprises.140.625.100.5=Mon Dec 20 15:42:45 IST 2010 }
{ enterprises.140.625.100.10=AdminServer }
{ enterprises.140.625.100.55=jmx.monitor.counter.threshold }
{ enterprises.140.625.100.60=10 }
{ enterprises.140.625.100.65=11 }
{ enterprises.140.625.100.70=com.bea:Location=AdminServer,Name=JMSServer-0,ServerRuntime=AdminServer,Type=JMSServerRuntime }
{ enterprises.140.625.100.75=JMSServerRuntime }
{ enterprises.140.625.100.80=MessagesCurrentCount }
}
**********************************************************************

From the Admin  Server console or server logs.

<Notice> <SNMP> <BEA-320931> <The SNMP trap version is 1>

For further references:

http://download.oracle.com/docs/cd/E13222_01/wls/docs103/snmpman/index.html

Best Regards,

Wonders Team. 🙂