Feb 9, 2009

SNMP Monitoring for GlassFish

Sun is delivering important addons to the GlassFish J2EE server. One of these add-ons is the SNMP Monitoring feature, which I'd like to discuss briefly here. Being part of the technical team that delivered the feature, I have to say that I was impressed by the overall way it was handled. It was released, not when the date set by marketing 8 months ago was rearched, but when all important sub-features were implemented, and when there were no major bugs left (and not because important bugs were closed as "not reproducible", but because code was actually fixed). It happened to correspond to the marketing date, but that's only because of the hard overtime work done of some team members. Great work !!

Here are some examples of what can be found out about a running GlassFish server, using some simple snmp requests. snmpwalk is a standard Unix command widely available.

In SNMP, indexes are used to walk through a hierarchy of information. In the J2EE MIB, they are used this way: ""



Here are some sample commands:

#
#
Let's set snmpwalk options once for all
$
$ OPT="-m +J2EE-MIB:ALL -M +/tmp/:/etc/sma/snmp/mibs -c public -v 1 $HOST:10161"
$
# What domain do we have in the deployement ?
$ snmpwalk $OPT J2EE-MIB::j2eeDomMoName
J2EE-MIB::j2eeDomMoName.1 = STRING: "domain1"
#
#
We have one domain (index 1). What are the servers in this domain ?
$
$ snmpwalk $OPT J2EE-MIB::j2eeSrvMoName.1
J2EE-MIB::j2eeSrvMoName.1.1 = STRING: "cluster=cl1,name=cl1_ins1"
J2EE-MIB::j2eeSrvMoName.1.2 = STRING: "name=server"
J2EE-MIB::j2eeSrvMoName.1.3 = STRING: "name=sa_ins3"
J2EE-MIB::j2eeSrvMoName.1.4 = STRING: "cluster=cl1,name=cl1_ins2"
#
#
We have 4 servers. What are their states ?
$
$ snmpwalk $OPT J2EE-MIB::j2eeSrvSMState
J2EE-MIB::j2eeSrvSMState.1.1 = INTEGER: stopped(3)
J2EE-MIB::j2eeSrvSMState.1.2 = INTEGER: running(4)
J2EE-MIB::j2eeSrvSMState.1.3 = INTEGER: stopped(3)
J2EE-MIB::j2eeSrvSMState.1.4 = INTEGER: stopped(3)
#
#
Only one is running (index 2). What are the applications deployed in it ?
$
$ snmpwalk $OPT J2EE-MIB::j2eeAppMoName.2
J2EE-MIB::j2eeAppMoName.2.3 = STRING: "name=conapp1,server=server"
J2EE-MIB::j2eeAppMoName.2.4 = STRING: "name=__ejb_container_timer_app,server=server"
J2EE-MIB::j2eeAppMoName.2.5 = STRING: "name=MEjbApp,server=server"
J2EE-MIB::j2eeAppMoName.2.6 = STRING: "name=__JWSappclients,server=server"
J2EE-MIB::j2eeAppMoName.2.11 = STRING: "name=webapp1,server=server"
#
#
There are 5 applications. Let's take the last one (index 11). When was it started ?
$
$ snmpwalk $OPT j2eeAppSMStartTime.2.11
J2EE-MIB::j2eeAppSMStartTime.2.11 = STRING: "Fri Feb 06 10:32:33 MET 2009"
#
#
What modules are deployed in it ?
$
$ snmpwalk $OPT J2EE-MIB::j2eeModMoName.2.11
J2EE-MIB::j2eeModMoName.2.11.14 = STRING: "application=webapp1,name=//server/webapp1webmod2,server=server"
J2EE-MIB::j2eeModMoName.2.11.15 = STRING: "application=webapp1,name=//server/webapp1webmod1,server=server"
#
#
There are 2 modules in this application. What are they ?
#
snmpwalk $OPT J2EE-MIB::j2eeModType.2.11
J2EE-MIB::j2eeModType.2.11.14 = INTEGER: web(3)
J2EE-MIB::j2eeModType.2.11.15 = INTEGER: web(3)
#
#
They are web modules
#
Let's take the first module (index 14). When was it started ?
$
snmpwalk $OPT J2EE-MIB::j2eeModSMStartTime.2.11.14
J2EE-MIB::j2eeModSMStartTime.2.11.14 = STRING: "Fri Feb 06 10:32:33 MET 2009"
#
#
How many servlets are in it ?
$
$ snmpwalk $OPT J2EE-MIB::j2eeSletMoName.2.11.14
J2EE-MIB::j2eeSletMoName.2.11.14.36 = STRING: "application=webapp1,name=webapp1webmod2_Servlet2,webmodule=//server/webapp1webmod2,server=server"
J2EE-MIB::j2eeSletMoName.2.11.14.37 = STRING: "application=webapp1,name=jsp,webmodule=//server/webapp1webmod2,server=server"
J2EE-MIB::j2eeSletMoName.2.11.14.38 = STRING: "application=webapp1,name=default,webmodule=//server/webapp1webmod2,server=server"
J2EE-MIB::j2eeSletMoName.2.11.14.39 = STRING: "application=webapp1,name=webapp1webmod2_Servlet1,webmodule=//server/webapp1webmod2,server=server"
#
#
There are 4 servlets.
#
On this server, how many resources are deployed ?
$
$ snmpwalk $OPT J2EE-MIB::j2eeRsrcMoName.2
J2EE-MIB::j2eeRsrcMoName.2.1 = STRING: "application=MEjbApp,name=bean-pool,ejb-module=mejb.jar,server=server,stateless-session-bean=MEJBBean"
J2EE-MIB::j2eeRsrcMoName.2.2 = STRING: "name=keep-alive,server=server"
J2EE-MIB::j2eeRsrcMoName.2.3 = STRING: "name=MConnectorPool,server=server"
J2EE-MIB::j2eeRsrcMoName.2.4 = STRING: "name=orb.threadpool.thread-pool-1,server=server"
J2EE-MIB::j2eeRsrcMoName.2.5 = STRING: "name=transaction-service,server=server"
J2EE-MIB::j2eeRsrcMoName.2.6 = STRING: "name=eis/ConnectorMonitoring"
J2EE-MIB::j2eeRsrcMoName.2.7 = STRING: "name=connection-queue,server=server"
J2EE-MIB::j2eeRsrcMoName.2.8 = STRING: "name=__TimerPool,server=server"
J2EE-MIB::j2eeRsrcMoName.2.9 = STRING: "name=jdbc/__TimerPool,server=server"
#
#
There are 9 resources. Of what type are they ?
#
snmpwalk $OPT J2EE-MIB::j2eeRsrcType.2
J2EE-MIB::j2eeRsrcType.2.1 = INTEGER: other(1)
J2EE-MIB::j2eeRsrcType.2.2 = INTEGER: other(1)
J2EE-MIB::j2eeRsrcType.2.3 = INTEGER: other(1)
J2EE-MIB::j2eeRsrcType.2.4 = INTEGER: other(1)
J2EE-MIB::j2eeRsrcType.2.5 = INTEGER: jta(6)
J2EE-MIB::j2eeRsrcType.2.6 = INTEGER: jca(9)
J2EE-MIB::j2eeRsrcType.2.7 = INTEGER: other(1)
J2EE-MIB::j2eeRsrcType.2.8 = INTEGER: other(1)
J2EE-MIB::j2eeRsrcType.2.9 = INTEGER: jdbc(3)
#


This SNMP MIB will be of great help to administrators who need an easy and efficient way to access J2EE-related information, when monitoring and managing GlassFish deployments.

Sun GlassFish Portfolio Landing Page: http://www.sun.com/glassfishportfolio
GlassFish (Community) Homepage: http://glassfish.org
Sun GlassFish Enterprise Server Homepage: http://www.sun.com/software/products/appsrvr/index.xml