GlassFish REST Interface

Monitoring GlassFish using REST Interface GlassFish v3, now exposes its monitoring and configuration in technology-agnostic manner, enabling you to write scripts/clients using your own language of expertise to manage GlassFish. REST interface is implemented using Jersey and is available in web as well as in glassFish distributions. REST interface supports JSON, XML and HTML resource representations.
In this blog, I would like to talk about Monitoring REST Interface which exposes GlassFish runtime model as REST urls. Monitoring resources are read-only and supports only GET method as of now. The url for monitoring root resource is http://{host}:{port}/monitoring/domain , where {host} is the server host and {port} is the administration port. Using root url, client can discover and traverse the entire runtime model.
Domain Resource Lets see how we can monitor GlassFish using REST interface. We can use one of the most widely used  and available software - browser, to monitor GlassFish. Here we are addressing the monitoring root resource, Domain, on my local GlassFish v3 install using its REST url. Domain resource has no attributes and has one child resource, server.

Click on the child resource link to discover its attributes and/or children.  server resource has four child resources.

By clicking through child urls we can discover the entire  runtime data available.
Server Resource


ClassloadingSystem Resource Lets get any other resource that has attributes, say, ClassLoadingSystem resource.  This resource has three attributes and no children.

So far we have seen accessing GlassFish monitoring resources through browser, accepting html resource representations.

I would like to demonstrate another client , a java client which uses Jersey client API's. This is a simple  java program that does a GET on the given resource requesting the given representation. You can download the client with its source and the required libraries (to compile & run the client) by clicking  here. The client zip file also has convenience script, rget. The inputs to the script are, url and the acceptable representation of the resource. rget script simply accepts the input parameters and in turn, calls the java program with the supplied input parameters.

Lets GET the ClassLoadingSystem resource again. This time we will use java client to request JSON and  XML representations.

rget http://localhost:4848/monitoring/domain/server/jvm/class-loading-system "application/json"
{ClassLoadingSystem:{"loadedclass-count" : 8604,"unloadedclass-count" : 56,"totalloadedclass-count" : 8660},"child-resources":[]}


rget http://localhost:4848/monitoring/domain/server/jvm/class-loading-system "application/xml"
<ClassLoadingSystem loadedclass-count="8604" unloadedclass-count="56" totalloadedclass-count="8660"></ClassLoadingSystem>

Comments:

[Trackback] GlassFish Monitoring allows you to monitor the state of various runtime components of the application server. This information is used to identify performance bottlenecks and tuning the system for optimal performance, to aid capacity planning, to pred...

Posted by Arun Gupta's Blog on August 19, 2009 at 10:41 PM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

rajeshwar

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today