Archive for the ‘Uncategorized’ Category

Using WLST to find JMX MBeans on Weblogic Application Server 10.3

Monday, December 13th, 2010

I was recently asked to retrieve a selection of JMX MBean attribute values from Weblogic Application Server, and format the data as XML to be read by Nagios. JBoss Application Server provides a nice frontend within their administration console in which to naviate the MBean hierarchy, and find the MBean names you need.

Oracle doesn’t do this when it comes to Weblogic 10.3. Instead, you can either use educated guesswork in combination with some useful documentation. Or you can use WLST – the Weblogic Scripting Tool.

Using the Weblogic Scripting Tool
The first thing to do is find the binary. This is located here:

%BEA_HOME%/common/bin/wlst.bat <-- Windows
%BEA_HOME%/common/bin/wlst.sh <-- Unix

Start the executable, and wait until you receive a prompt. There is a list of common commands you will need:


connect('username','password','host:port')
serverRuntime()
cd('beanName')
ls()

As you can see, you will be familiar with the commands if you have ever used a unix command prompt before. Be aware that we execure the commands like functions, within brackets, with a number of arguments.

Example

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

wls:/offline> connect('weblogic','weblogic','localhost:7001')
Connecting to t3://localhost:7001 with userid weblogic ...
Successfully connected to Admin Server 'devserver' that belongs to domain 'vfdomain'.

Warning: An insecure protocol was used to connect to the
server. To ensure on-the-wire security, the SSL port or
Admin port should be used instead.

wls:/vfdomain/serverConfig> serverRuntime()
Location changed to serverRuntime tree. This is a read-only tree with ServerRuntimeMBean as the root.
For more help, use help(serverRuntime)

wls:/vfdomain/serverRuntime> ls()
dr-- ApplicationRuntimes
dr-- AsyncReplicationRuntime
dr-- ClusterRuntime
dr-- ConnectorServiceRuntime
dr-- DefaultExecuteQueueRuntime
dr-- EntityCacheCumulativeRuntime
dr-- EntityCacheCurrentStateRuntime
dr-- EntityCacheHistoricalRuntime
dr-- ExecuteQueueRuntimes
dr-- JDBCServiceRuntime
dr-- JMSRuntime
dr-- JTARuntime

snip....
-r-- ActivationTime 1267615098514
-r-- AdminServer true
-r-- AdminServerHost 127.0.0.1
-r-- AdminServerListenPort 7001
-r-- AdminServerListenPortSecure false
-r-- AdministrationPort 9002
snip....

The first list of items are child MBeans. The second list are attributes.

We can navigate to our JDBC connections like so:


wls:/vfdomain/serverRuntime> cd('JDBCServiceRuntime/myserver/JDBCDataSourceRuntimeMBeans/mydatasource')
wls:/vfdomain/serverRuntime/DBCServiceRuntime/myserver/JDBCDataSourceRuntimeMBeans/mydatasource> ls()
snip...
-r-- ConnectionDelayTime 97
-r-- ConnectionsTotalCount 144
-r-- CurrCapacity 10
-r-- CurrCapacityHighCount 11
-r-- DeploymentState 2
-r-- Enabled true
-r-- FailedReserveRequestCount 0
-r-- FailuresToReconnectCount 0
-r-- HighestNumAvailable 12
-r-- HighestNumUnavailable 0
-r-- LastTask null
-r-- LeakedConnectionCount 0
-r-- ModuleId mydatasource
-r-- Name mydatasource
-r-- NumAvailable 10
-r-- NumUnavailable 0
-r-- PrepStmtCacheAccessCount 7836
-r-- PrepStmtCacheAddCount 3808
-r-- PrepStmtCacheCurrentSize 99
snip...

You’re still Beautiful!

Sunday, September 5th, 2010

Dug out my old first-gen iPod today. It really is a wonderful piece of kit, and at nearly 9 years old you’ve got to praise the Apple designers for putting so much work into it.

Next job – Firewire cable!

DIY Flash Bounce for Panasonic GF1

Monday, April 5th, 2010

As of this weekend, I am now a proud owner of a Panasonic GF1 + 20mm pancake lens. So far I’m extremely impressed – the 1.7 aperture allows me to take some great indoor shots without the need to use any flash.

Like most DSLRs the in-built flash leaves a lot to be desired, so I try to use it as little as possible. There are times however, when I just can’t get away without shooting with it. I don’t want to purchase an external flash unit because for me that would detract from the very reason for purchasing a Micro Four Thirds camera in the first place – portability.

Then I stumbled upon the following solution from DIYPhotography.com. The plan is simple – wedge a small piece of white card into the opening of the flash, so it is angled 45 degrees to the flash pointing upwards. The card should extend the width of the flash unit, and preferably just beyond the top, like so:

Simple – a 2 minute job!

I took a couple of test shots – all with the same shutter speed / ISO / aperture. I took them indoors in low light, where the default exposure would have failed to produce acceptable photographs. I haven’t adjusted the images in any way. Here are the results:

The results are pretty conclusive. I would never have been able to shoot at ISO 100 indoors in low light, particularly at 1/80 without a flash. Now I can get realistic skin tones, background detail, and no more “rabbit in the headlights” look. You might get some funny looks, but you’ll appreciate those superior photos.