Monitoring WebSphere DataPower, Part 3: Using cURL and Java

By now, you have gone through a few aspects of monitoring WebSphere® DataPower as well as configuring IBM® Tivoli® suite of products to monitor DataPower. Part 3 of this 3-part article series describes how to monitor DataPower appliances through the SOAP Configuration Management (SOMA) interface using cURL and Java as sample platforms.

Amit Tuli (amittuli@ae.ibm.com), Senior IT Architect, IBM

Photo of Amit TuliAmit Tuli is an IBM Certified Senior IT Architect with IBM Global Business Services. He is an active author of articles and IBM Redbooks publications as well as many reusable assets. Amit is an active speaker at technical conferences. He has been with IBM for 13 years, having worked with product development teams, IBM research, and product services to client engagement teams. He has provided integration oriented architectural solutions to some of the largest customers in India and other countries for some of the most complex transformation programs.



Gaurav Balyan (gaurav.balyan@in.ibm.com), Middleware Specialist, IBM

Photo of Gaurav BalyanGaurav Balyan is a Middleware Specialist with diverse experience working on many middleware technologies, such as WebSphere BPM, WebSphere Message Broker, WebSphere MQ, DataPower, and WebSphere Process Server. He has led teams on many projects, applying his technical depth and breadth of knowledge. He has a Bachelor's degree in Information Technology from the Uttar Pradesh Technical University, India. He likes to spend his spare time by reading, blogging, or trekking.



Subhadeep Sarkar (subhadeepsarkar@gmail.com), Middleware Specialist, IBM

Photo of Subhadeep SarkarSubhadeep Sarkar was part of the GTS division of IBM India for nearly 2 years. During his IBM tenure, he led the Operations Team for a telecom project as an Application Integration and Middleware Solution Specialist for the WebSphere ESB suite (MQ, Message Broker, Process Server, DataPower). He has 9 years of experience in EAI and Business Process Management with a focus on middleware technologies. He has also worked with Infosys as a Java Developer and Technical Analyst. He is a graduate of the Indian Institute of Technology, Kharagpur, India.



28 August 2013

Also available in Russian

Introduction

As discussed in Part 1, SOAP Configuration Management (SOMA) is a SOAP-based interface provided by the appliance. These interfaces are language independent, and therefore, can be exposed from any client that supports SOAP/HTTP. There are two such methods for demonstration, cURL-based monitoring and Java-based monitoring. Based on your choice, environment, and other factors, you can use this article to implement various client types. We will explore the installation, configuration, and invocation perspectives on both aspects of monitoring. For details about the concept of SOMA, refer to Part 1 of the series.

cURL based monitoring

cURL is a client side library that you can install on UNIX or Windows®, which is explained in Part 1. You can access the DataPower box via cURL to perform monitoring as well as administrative tasks (see Listing 1 and Listing 2).

Listing 1. Example of a cURL request command with options
curl –k –u user:password –d @myRequestFile.xml
https://ipaddress:Port/EndpointURI

or

Listing 2. Another example of a cURL request command with options
curl –insecure –u user:password –d @myRequestFile.xml
https://ipaddress:Port/EndpointURI

Options for the cURL command are:

  • insecure or k: This ignores the secure connection (SSL connections without certificate).
  • u: This specifies the user and password
  • d: This indicates HTTP post data.
  • @: This specifies the file that is sent to the XML Management Interface followed by the address of the DataPower device and the port the XML Management is running on.
  • Endpoint URI of the current version: service/mgmt/current

You can view or update the port for SOMA (if required) as shown in Figure 1, which you can access by logging in to the default domain on the DataPower appliance (one of the generic approaches).

Figure 1. XML Management Interface configuration
XML Management Interface configuration

Notes:

  • The XML Management Interface (XMI) must be called using HTTPS, not HTTP.
  • To make SOMA more secure, you can configure an Access Control List (ACL) with proper authorization of the XMI.

cURL configuration

To configure cURL on any machine, you need to install the cURL library. To install cURL, you need a binary package of it that you can download.

Installing binary packages on UNIX

A normal UNIX installation is done in three or four steps (after unpacking the source archive). The sample installation procedure is shown in Listing 3. For more details about the cURL installation options, refer to the product documentation.

Listing 3. Sample install procedure
cd /usr/local/src
wget http://curl.haxx.se/download/curl-7.19.0.tar.gz
tar zxf curl-7.19.0.tar.gz
cd curl-7.19.0
./configure --prefix=/usr/local --with-ssl=/usr/include/openssl
make
make install

Notes:

  • The installation requires root privileges.
  • The install cURL needs to be SSL-enabled and not restricted to the cURL version.

Java-based monitoring

In Java-based monitoring, create an HTTPS Java client to call SOMA through the XML interface. The configuration of the interface is explained in the next section. Standard request XMLs are used by the Java client to fetch the status of the requested service. The request and response formats are the same for both approaches.

Java client configuration

To configure a Java client, set up a Java HTTPS client to make a call to the SOMA service of the device using its IP address and the port of the XML Management Interface.


Invocation of SOMA using cURL and Java

Different objects of DataPower appliance are monitored by changing the class attribute of the <dp:get-status> element.

For example, to get the system usage status of the box, refer to the <dp:get-status> element with the class SystemUsage in the request message (Listing 4).

Listing 4. GetSystemUsage_Req.xml
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
    <env:Body>
        <dp:request xmlns:dp="http://www.datapower.com/schemas/management">
            <dp:get-status class="SystemUsage"/>
        </dp:request>
    </env:Body>
</env:Envelope>

Refer to <dp:get-status> in the response message (Listing 5). It indicates that the operation has performed successfully and the corresponding class elements can be obtained. The example underneath demonstrates the elements, such as Interval, Load, and Worklist of SystemUsage.

Listing 5. Response GetSystemUsage_Resp.xml
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
    <env:Body>
        <dp:response xmlns:dp="http://www.datapower.com/schemas/management">
        <dp:timestamp>2012-03-02T13:52:02+05:30</dp:timestamp>
        <dp:status>
            <SystemUsage xmlns:env="http://www.w3.org/2003/05/soap-envelope">
                <Interval>1000</Interval>
                <Load>47</Load>
                <WorkList>2</WorkList>
            </SystemUsage>
        </dp:status>
        </dp:response>
    </env:Body>
</env:Envelope>

Invocation using cURL

To get the system usage status of the box, the cURL command invokes the SOMA service using the input request "XML GetSystemUsage_Req.xml" and gets the response from the DataPower device in "GetSystemUsage_Resp.xml" as shown in Listing 6.

Listing 6. Response GetSystemUsage_Resp.xml
curl --insecure --data-binary @GetSystemUsage_Req.xml -u user:password
https://10.1.1.1:9550/service/mgmt/current > GetSystemUsage_Resp.xml

Invocation using Java

A Java HTTPS client invokes the SOMA service by sending the input SOAP as a request and gets a response back from the DataPower device. Make sure the client is HTTPS and not HTTP. There is a requisite while developing a HTTPS client and that is to manage the certificate. Listing 7 shows an example of HTTPS. This class is used to invoke the XML Management Interface over HTTPS.

Listing 7. Example of HTTPS
String ip = "127.0.0.1"; // ipaddress of DataPower device
int port = 9550; // SOMA port number
String user = "admin";
String pass = "password";
HTTPSClient httpsCleintObj = new HTTPSClient(ip, port, user, pass);
httpsCleintObj.connect(true);

String environmentalSensorsReq = "<env:Envelope"+
"xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"><env:Body><dp:request"+
"xmlns:dp=\"http://www.datapower.com/schemas/management\"><dp:get-status"+
"class=\"EnvironmentalSensors\"/></dp:request></env:Body></env:Envelope>";

String environmentalSensorsResp =httpsCleintObj.sendMessage(environmentalSensorsReq);
System.out.println("Response from Datapower device:"+environmentalSensorsResp);
httpsCleintObj.releaseConnection();

For a detailed description, see the files that are available in the Download section of the article.


Understanding the request and response structures

The request and response structures are always the same for cURL and Java-based monitoring for any client build up.

Request structure

One of the basic request types is shown in Listing 8 for the default domain.

Listing 8. Basic request type
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
    <env:Body>
        <dp:request xmlns:dp="http://www.datapower.com/schemas/management">
            <dp:get-status class="EnvironmentalSensors"/>
        </dp:request>
    </env:Body>
</env:Envelope>

To get the status of different objects, change the attribute class value in the <dp:get-status> element according to the object class value.

For example, to get the memory status, the input request element has this class value: ‘MemoryStatus’ <dp:get-status class="MemoryStatus".

To get the domain status, the input request element has this class value: ‘DomainStatus’ <dp:get-status class="DomainStatus".

Response structure

Depending upon the class value used in the request, the response xmls contains the corresponding elements inside the <dp:status> element. These are either a singular or multiple repetitive elements according to your class value. For example, the output for memory usage is singular, whereas the domain status has multiple elements corresponding to the domains that exist in the DataPower appliance.

The output needs to be parsed to fetch the appropriate metrics for further usage according to the monitoring requirements. Listing 9 shows an example of the response for the environment sensors.

Listing 9. Response for the environment sensors
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
  <env:Body>
   <dp:response xmlns:dp="http://www.datapower.com/schemas/management">
    <dp:timestamp>2012-03-02T15:01:20+05:30</dp:timestamp>
    <dp:status>
      <EnvironmentalSensors xmlns:env="http://www.w3.org/2003/05/soap-envelope">
        <systemTemp>0</systemTemp>
        <cpu1Temp>31</cpu1Temp>
        <cpu2Temp>30</cpu2Temp>
        <cpu1rpm>0</cpu1rpm>
        <cpu2rpm>0</cpu2rpm>
        <chassis1rpm>0</chassis1rpm>
        <chassis2rpm>0</chassis2rpm>
        <chassis3rpm>0</chassis3rpm>
        <caseopen>no</caseopen>
        <volt33>3.36</volt33>
        <volt5>5.08</volt5>
        <volt12>11.5</volt12>
        <powersupply>ok</powersupply>
        <batteryinstalldate>Thu Jan  1 05:29:59 1970
        </batteryinstalldate>
        <checkintrusion>yes</checkintrusion>
      </EnvironmentalSensors>
    </dp:status>
 </dp:response>
 </env:Body>
</env:Envelope>

Conclusion

This article series highlighted the different monitoring approaches for WebSphere DataPower appliances. Part 3, the last in this series, demonstrated the practical usage of the concepts and solution introduced in Part 1 by using the SOMA interface. You learned the high level requirements and complexity involved in using the SOMA interface.

Acknowledgments

The authors would like to thank Rakesh R. Nair for his review of the article series. Rakesh is a WebSphere DataPower specialist and has led many DataPower-based engagements for worldwide customers.


Downloads

DescriptionNameSize
Sample Java classesJavaClient.zip5KB
Sample request XMLGetDomainStatus_Req.zip1KB
Sample response XMLGetDomainStatus_Response.zip1KB

Resources

Learn

Discuss

Comments

developerWorks: Sign in

Required fields are indicated with an asterisk (*).


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Information in your profile (your name, country/region, and company name) is displayed to the public and will accompany any content you post, unless you opt to hide your company name. You may update your IBM account at any time.

All information submitted is secure.

Choose your display name



The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


All information submitted is secure.

Dig deeper into WebSphere on developerWorks


static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=WebSphere, Tivoli
ArticleID=942660
ArticleTitle=Monitoring WebSphere DataPower, Part 3: Using cURL and Java
publish-date=08282013