Data Center Real User Monitoring DMI Web Services Getting Started
Transcription
Data Center Real User Monitoring DMI Web Services Getting Started
Data Center Real User Monitoring DMI Web Services Getting Started Release 12.3 Please direct questions about Data Center Real User Monitoring or comments on this document to: Customer Support https://community.compuwareapm.com/community/display/SUPPORT Copyright © 2014 Compuware Corporation. All rights reserved. Unpublished rights reserved under the Copyright Laws of the United States. U.S. GOVERNMENT RIGHTS-Use, duplication, or disclosure by the U.S. Government is subject to restrictions as set forth in Compuware Corporation license agreement and as provided in DFARS 227.7202-1(a) and 227.7202-3(a) (1995), DFARS 252.227-7013(c)(1)(ii) (OCT 1988), FAR 12.212(a) (1995), FAR 52.227-19, or FAR 52.227-14 (ALT III), as applicable. Compuware Corporation. This product contains confidential information and trade secrets of Compuware Corporation. Disclosure is prohibited without the prior express written permission of Compuware Corporation. Use of this product is subject to the terms and conditions of the user's License Agreement with Compuware Corporation. Documentation may only be reproduced by Licensee for internal use. The content of this document may not be altered, modified or changed without the express written consent of Compuware Corporation. Compuware Corporation may change the content specified herein at any time, with or without notice. All current Compuware Corporation product documentation can be found at https://community.compuwareapm.com/community/display/APMDOC. Compuware, FrontLine, Network Monitoring, Enterprise Synthetic, Server Monitoring, Dynatrace Network Analyzer, Dynatrace, VantageView, Dynatrace, Real-User Monitoring – First Mile, and Dynatrace Performance Network are trademarks or registered trademarks of Compuware Corporation. Cisco is a trademark or registered trademark of Cisco Systems, Inc. Internet Explorer, Outlook, SQL Server, Windows, Windows Server, and Windows Vista are trademarks or registered trademarks of Microsoft Corporation. Firefox is a trademark or registered trademark of Mozilla Foundation. Red Hat and Red Hat Enterprise Linux are trademarks or registered trademarks of Red Hat, Inc. J2EE, Java, and JRE are trademarks or registered trademarks of Oracle Corporation. VMware is a trademark or registered trademark of VMware, Inc. SAP and SAP R/3 are trademarks or registered trademarks of SAP AG. Adobe® Reader® is a registered trademark of Adobe Systems Incorporated in the United States and/or other countries. All other company and product names are trademarks or registered trademarks of their respective owners. Local Build: December 8, 2014, 14:51 Contents Contents Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Who Should Read This Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Organization of the Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Related Publications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Customer Support Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Reporting a Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Documentation Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 5 5 5 6 6 6 Chapter 1 ∙ Web Services Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Chapter 2 ∙ Using REST-based Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . REST Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Example REST getApplications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Example REST getDataViews . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Example REST getResolutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Example REST getDimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Example REST getMetrics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Example REST getDMIData, getDMIData2, getDMIData3 . . . . . . . . . . . . . . . . . . . REST Developer Tools and Tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . HTTP Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . HTTP Response Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . HTTP Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . REST Principles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 12 12 13 14 15 16 16 22 23 23 24 24 Chapter 3 ∙ Using SOAP-based Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . DC RUM Web Services Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Software Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Available Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Obtaining WSDL for Deployed Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Generating Stubs and Data Types from WSDL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Creating Your Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Keeping Track of Web Service Use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Testing Your Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 27 28 28 29 30 31 34 35 Data Center Real User Monitoring DMI Web Services Getting Started 3 Contents 4 Data Integration with Your Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Example Using DMIServiceClient with a Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . Example Using Web Services with JSP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 36 36 Appendix A ∙ DMI Service Method Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . getApplications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . getCurrentTime . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . getDataSources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . getDataViews . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . getDimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . getDimensionValues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . getDMIData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . getDMIData2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . getDMIData3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . getLastSampleTime . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . getMetrics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . getResolutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . getServerUUID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 46 46 47 47 47 48 48 51 55 58 58 59 59 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 Data Center Real User Monitoring DMI Web Services Getting Started INTRODUCTION Who Should Read This Guide This manual is intended for software developers who want to integrate Data Center Real User Monitoring reports with third party software platforms, such as reporting applications or enterprise portals using DC RUM data available via web services. Organization of the Guide This guide is organized as follows: • Web Services Overview [p. 9] – Introduces to the concept of web services and the architecture of services in DC RUM. • Using SOAP-based Web Services [p. 27] – Describes how to use SOAP-based web services with DMI. • Using REST-based Web Services [p. 11] – Describes how to use REST-based web services with DMI. • DMI Service Method Reference [p. 45] – Provides referential information on web services provided by DMI. Related Publications Documentation for your product is distributed on the product media. For Data Center RUM, it is located in the \Documentation directory. It can also be accessed from the Media Browser. Go online (https://community.compuwareapm.com/) for fast access to information about your Dynatrace products. You can download documentation and FAQs as well as browse, ask questions and get answers on user forums (requires subscription). The first time you access FrontLine, you are required to register and obtain a password. Registration is free. PDF files can be viewed with Adobe Reader version 7 or later. If you do not have the Reader application installed, you can download the setup file from the Adobe Web site at http://www.adobe.com/downloads/. Data Center Real User Monitoring DMI Web Services Getting Started 5 Introduction Customer Support Information Dynatrace Community For product information, go to https://community.compuwareapm.com/ and click Support. You can review frequently asked questions, access the training resources in the APM University, and post a question or comment to the product forums. You must register and log in to access the Community. Corporate Website To access the corporate website, go to http://www.dynatrace.com. The Dynatrace site provides a variety of product and support information. Reporting a Problem Use these guidelines when contacting APM Customer Support. When submitting a problem, log on to the Dynatrace Support Portal at https://support.compuwareapm.com/, click the Open Ticket button and select Data Center Real User Monitoring from the Product list. Refer to the DC RUM FAQ article at https://community.compuwareapm.com/community/display/DL/DCRUM+Data+Collection+Guide to learn know how to provide accurate diagnostics data for your DC RUM components. Most of the required data can be retrieved using RUM Console. Documentation Conventions The following font conventions are used throughout documentation: This font Indicates Bold Terms, commands, and references to names of screen controls and user interface elements. Citation Emphasized text, inline citations, titles of external books or articles. Documentation Conventions [p. 6] Links to Internet resources and linked references to titles in documentation. Fixed width Cited contents of text files, inline examples of code, command line inputs or system outputs. Also file and path names. Fixed width bold User input in console commands. Fixed width italic Place holders for values of strings, for example as in the command: cd directory_name 6 Data Center Real User Monitoring DMI Web Services Getting Started Introduction This font Indicates Menu ➤ Item Menu items. Text screen shots. Screen Code block Blocks of code or fragments of text files. Data Center Real User Monitoring DMI Web Services Getting Started 7 Introduction 8 Data Center Real User Monitoring DMI Web Services Getting Started CHAPTER 1 Web Services Overview A web service is a software component or service that has been web-published using an HTTP-compliant message encoding protocol such as XML-RPC, Representational State Transfer (REST), or Simple Object Access Protocol (SOAP). Web services enable developers to target a range of clients and build the services from local and remote resources. XML-RPC, REST, and SOAP codify the existing practice of using XML and HTTP together as an application protocol. This guide describes two approaches to web services: • REST-based For more information, see Using REST-based Web Services [p. 11]. • SOAP-based For more information, see Using SOAP-based Web Services [p. 27]. IMPORTANT We strongly recommend that you choose the REST-based option. SOAP-based web services will no longer be supported after DC RUM 12.3. Data Center Real User Monitoring DMI Web Services Getting Started 9 Chapter 1 ∙ Web Services Overview 10 Data Center Real User Monitoring DMI Web Services Getting Started CHAPTER 2 Using REST-based Web Services REST (Representational State Transfer) offers the developer a relatively uncomplicated alternative to SOAP-based web services. The REST API provided for DMI enables you to write RESTful applications that read a report server database (or the cache) and returns the results in JSON format. NOTE The REST API is available only for users with DMI report creation rights (groups: Reporting Administrator, System Administrator). This small set of methods is sufficient to write a RESTful DMI application: getApplications Use getApplications to list all applications available on the device you are addressing. For more information, see getApplications [p. 46] and Example REST getApplications [p. 12]. getDataViews Use getDataViews to list all data views for one of the applications available on the device you are addressing. For more information, see getDataViews [p. 47] and Example REST getDataViews [p. 13]. getResolutions Use getResolutions to list the resolutions for one data view and one application on the device you are addressing. For more information, see getResolutions [p. 59] and Example REST getResolutions [p. 14]. getDimensions Use getDimensions to list the dimensions for one resolution, one data view, and one application on the device you are addressing. For more information, see getDimensions [p. 47] and Example REST getDimensions [p. 15]. Data Center Real User Monitoring DMI Web Services Getting Started 11 Chapter 2 ∙ Using REST-based Web Services getMetrics Use getMetrics to list the metrics for one resolution, one data view, and one application on the device you are addressing. For more information, see getMetrics [p. 58] and Example REST getMetrics [p. 16]. getDMIData, getDMIData2, getDMIData3 These are three successive versions of essentially the same method. If you have already developed applications that use calls to getDMIData or getDMIData2, you can continue to depend on support for them. If you are developing a new application, use getDMIData3. For more information, see getDMIData [p. 48], getDMIData2 [p. 51], and getDMIData3 [p. 55]. For examples, see Example REST getDMIData, getDMIData2, getDMIData3 [p. 16]. Each DMI REST request includes the server address, the name of the service (“dmiquery”), and specification of the method, such as: http://1.2.3.4:5/rest/dmiquery/getApplications which sends a getApplications request to the “dmiquery” service running on URL 1.2.3.4:5. REST Examples The REST examples included here are all HTTP calls to a CAS at sample address http://1.2.3.4:5 from a standard web browser. All calls are made using an authentication header to access the target device and a Content-Type header set to application/json. To try these examples, you will need a REST client add-in to your browser and access to a CAS. For more information, see REST Developer Tools and Tips [p. 22]. Example REST getApplications A call to getApplications requires no parameters. For example: http://1.2.3.4:5/rest/dmiquery/getApplications The call in this example returned the following list of application IDs: { "count": 6, "results": [ [ "CVENT", "Central Analysis Server" ], [ "GOMEZ", "Synthetic Backbone" ], [ "UEM", "RUM Browser" ], [ "ALARMS", "Tools" ], [ "HM", 12 Data Center Real User Monitoring DMI Web Services Getting Started Chapter 2 ∙ Using REST-based Web Services "DB status" ], [ "SYSTEMDIAG", "Diagnostic" ] ], "resultsCount": 6, "offset": 0 } The sample output lists six applications by application ID: CVENT, GOMEZ, UEM, ALARMS, HM, and SYSTEMDIAG. Example REST getDataViews A call to getDataViews requires one parameter, appId, the value of which you can select from the list of application IDs returned by getApplications. In this example, CVENT is the application passed to the device. http://1.2.3.4:5/rest/dmiquery/getDataViews?appId=CVENT The request in this example returned the following list of data views associated with the named application (CVENT) on that device: { "count": 25, "results": [ [ "ClientViewDb", "Software service, operation, and site data from DB" ], [ "TransAct", "Synthetic and sequence transaction data (Active)" ], [ "ClientCard", "Software service, operation, and site data with uniqueness" ], [ "TransUserActivity", "Synthetic and sequence transaction data (User Activity)" ], [ "TierCache", "Application, transaction, and tier data from cache" ], [ "Rolling", "Software service, operation, and site baselines" ], [ "ODClientDetails", "Client-level details (on demand)" ], [ "ODClientList", "List of users (on demand)" ], [ "PartClientCard", "Software service, operation, and site data with limited uniqueness" ], [ "CliCnt", "Client counters (hidden)" ], [ "TransA", Data Center Real User Monitoring DMI Web Services Getting Started 13 Chapter 2 ∙ Using REST-based Web Services "Synthetic and sequence transaction data (Agentless)" ], [ "DayTierBndClientCard", "Tier-bound client counters (hidden)" ], [ "CharcTrans", "Synthetic and sequence transaction baselines" ], [ "Trans", "Synthetic and sequence transaction data" ], [ "Tier", "Application, transaction, and tier data" ], [ "CvNetwork", "Internetwork traffic data" ], [ "Threshold", "Software service, operation, and site data Fixed Threshold" ], [ "ClientView", "Software service, operation, and site data" ], [ "TfcOnLink", "Network link data" ], [ "TierBaselineCache", "Application, transaction, and tier baselines" ], [ "Citrix", "Citrix/WTS hardware data" ], [ "TierUserActivity", "Application, transaction, and tier data with uniqueness" ], [ "WholeTraff", "Low-significance traffic" ], [ "TierDb", "Application, transaction, and tier data from DB" ], [ "CVCache", "Software service, operation, and site data from cache" ] ], "resultsCount": 25, "offset": 0 } The sample output lists 25 data views by data view ID and description, starting with ClientViewDb. Example REST getResolutions A call to getResolutions requires parameters appId (from getApplications) and viewId (from getDataViews). In this example, SYSTEMDIAG is the application and ProbeMemStatistics is the data view: 14 Data Center Real User Monitoring DMI Web Services Getting Started Chapter 2 ∙ Using REST-based Web Services http://1.2.3.4:5/rest/dmiquery/getResolutions?appId=SYSTEMDIAG&viewId=ProbeMemStatistics The call in this example returned the following list of possible resolutions for the named application and data view: { "count": 4, "results": [ "r", "1", "6", "d" ], "resultsCount": 4, "offset": 0 } Resolution IDs are identical to those used for definitions in dmi_dataview-*.properties files. Possible resolutions include: • r - one period • 1 - one hour • 6 - six hours • d - one day • w - one week • m - one month Example REST getDimensions A call to getDimensions requires parameters appId (from getApplications) and viewId (from getDataViews) and resolution (from getResolutions). In this example, SYSTEMDIAG is the application and ProbeMemStatistics is the data view and r is the resolution: http://1.2.3.4:5/rest/dmiquery/getDimensions?appId=SYSTEMDIAG&viewId=ProbeMemStatistics&resolution=r The call in this example returned the following list of dimensions for the named application and data view and resolution: { "count": 5, "results": [ [ "begT", "Time", "", "DATE" ], [ "probe", "AMD IP address", "", "IP" ], [ "probePort", "AMD TCP port", "", "INT" ], [ "time_stamp", "Measurement time stamp", Data Center Real User Monitoring DMI Web Services Getting Started 15 Chapter 2 ∙ Using REST-based Web Services "", "DATE" ], [ "objectName", "Object name", "", "STRING" ] ], "resultsCount": 5, "offset": 0 } The sample output lists 5 dimensions, starting with begT (tIme). Example REST getMetrics A call to getMetrics requires parameters appId (from getApplications) and viewId (from getDataViews) and resolution (from getResolutions). In this example, SYSTEMDIAG is the application and ProbeMemStatistics is the data view and 1 is the resolution: http://1.2.3.4:5/rest/dmiquery/getMetrics?appId=SYSTEMDIAG&viewId=ProbeMemStatistics&resolution=1 The call in this example returned the following nested array describing the metrics for the named application, data view, and resolution: { "count": 2, "results": [ [ "totalM", "Memory usage", "B", "BYTE" ], [ "cnt", "Data objects", "", "INT" ] ], "resultsCount": 2, "offset": 0 } The sample output lists two metrics: totalM and cnt. Example REST getDMIData, getDMIData2, getDMIData3 For other REST methods, you can use GET because all necessary parameters can be contained in the URL. To call getDMIData, getDMIData2, or getDMIData3, however, you need to use a POST request. This enables you to pass more parameters and parameter values than you can pass through a GET call in the URL. NOTE Use getDMIData3 when writing a new application. The earlier methods (getDMIData and getDMIData2) continue to be offered for the sake of backwards compatibility with existing client applications. 16 Data Center Real User Monitoring DMI Web Services Getting Started Chapter 2 ∙ Using REST-based Web Services Differences Between getDMIData, getDMIData2, and getDMIData3 • The difference between getDMIData and getDMIData2 is that the latter method returns an object that contains GUI labels and units of measure for returned data. • The difference between getDMIData2 and getDMIData3 is that the latter method returns an object that contains IDs of the column renderers. Also, there is a new format available for the response to the getDMIData3 method. To receive the data in the new format, you need to set the Accept parameter in the REST request to application/dmi. In RESTClient, you would go to Headers ➤ Custom Header and set Name to Accept and Value to application/dmi. The response is formatted similarly to the DMI text export. Differences include: • It returns all columns, not only visible ones • It returns only application and data view IDs, not the human-readable names • No information about histograms is included Examples for getDMIData, getDMIData2, and getDMIData3 In this example, note that there are no parameters set in the URL: http://1.2.3.4:5/rest/dmiquery/getDMIData The details are passed in the body: { "appId": "CVENT", "viewId": "ClientView", "dataSourceId": "ALL_AGGR", "dimensionIds": [ "appl", "sDNSName" ], "metricIds": [ "c_sByte", "trans" ], "dimFilters": [ [ "appl", "WWW_HTTP", false ], [ "sDNSName", "", false ] ], "metricFilters": [], "sort": [], "top": 1000, "resolution": "r", "timePeriod": "Today", "numberOfPeriods": 0, "timeBegin": 1136264400000, "timeEnd": 1136350800000 } In this example, the call returned: { "columnHeader": [ "appl", Data Center Real User Monitoring DMI Web Services Getting Started 17 Chapter 2 ∙ Using REST-based Web Services "sDNSName", "c_sByte", "trans" ], "rawData": [ [ null, null, 78734950, 1218 ], [ null, null, 12740000, 174 ], [ null, null, 12740000, 174 ], [ null, null, 12740000, 174 ], [ null, null, 12740000, 174 ], [ null, null, 39416000, 452 ] ], "formattedData": [ [ "WWW_HTTP", "10.10.12.1", "7.873495E7", "1218.0" ], [ "WWW_HTTP", "10.1.6.0", "1.274E7", "174.0" ], [ "WWW_HTTP", "10.1.9.1", "1.274E7", "174.0" ], [ "WWW_HTTP", "10.1.6.2", "1.274E7", "174.0" ], [ "WWW_HTTP", "10.1.6.1", "1.274E7", "174.0" ], [ "WWW_HTTP", 18 Data Center Real User Monitoring DMI Web Services Getting Started Chapter 2 ∙ Using REST-based Web Services "10.1.5.0", "3.9416E7", "452.0" ] ], "dmiServiceError": [ {} ], "timeBegin": 1136264400000, "timeoutValue": 600000, "timeEnd": 1136350800000 } You could send the same body to the same machine but with method getDMIData2: http://1.2.3.4:5/rest/dmiquery/getDMIData2 In this example, it returned the following output (again trimmed for brevity): { "columnUnit": [ "", "", "B", "" ], "columnHeaderName": [ "Software service", "Server name", "Total bytes", "Operations" ], "columnHeader": [ "appl", "sDNSName", "c_sByte", "trans" ], "rawData": [ [ null, null, 78734950, 1218 ], [ null, null, 12740000, 174 ], [ null, null, 12740000, 174 ], [ null, null, 12740000, 174 ], [ null, null, 12740000, 174 ], [ null, null, 39416000, 452 ] Data Center Real User Monitoring DMI Web Services Getting Started 19 Chapter 2 ∙ Using REST-based Web Services ], "formattedData": [ [ "WWW_HTTP", "10.10.12.1", "7.873495E7", "1218.0" ], [ "WWW_HTTP", "10.1.6.0", "1.274E7", "174.0" ], [ "WWW_HTTP", "10.1.9.1", "1.274E7", "174.0" ], [ "WWW_HTTP", "10.1.6.2", "1.274E7", "174.0" ], [ "WWW_HTTP", "10.1.6.1", "1.274E7", "174.0" ], [ "WWW_HTTP", "10.1.5.0", "3.9416E7", "452.0" ] ], "dmiServiceError": [ {} ], "timeBegin": 1136264400000, "timeoutValue": 600000, "timeEnd": 1136350800000 } Note that the result of getDMIData2 extends that of getDMIData by adding: "columnUnit": [ "", "" ], "columnHeaderName": [ "Application", "Transaction" ], Yet another call to the same machine using the same body but with method getDMIData3 http://1.2.3.4:5/rest/dmiquery/getDMIData3 returns the following (again trimmed for brevity): { "columnRendererIds": [ "STRING", "STRING", "BYTE", "NUMBER" ], "columnUnit": [ "", "", "B", "" ], "columnHeaderName": [ "Software service", "Server name", "Total bytes", 20 Data Center Real User Monitoring DMI Web Services Getting Started Chapter 2 ∙ Using REST-based Web Services "Operations" ], "columnHeader": [ "appl", "sDNSName", "c_sByte", "trans" ], "rawData": [ [ null, null, 78734950, 1218 ], [ null, null, 12740000, 174 ], [ null, null, 12740000, 174 ], [ null, null, 12740000, 174 ], [ null, null, 12740000, 174 ], [ null, null, 39416000, 452 ] ], "formattedData": [ [ "WWW_HTTP", "10.10.12.1", "7.873495E7", "1218.0" ], [ "WWW_HTTP", "10.1.6.0", "1.274E7", "174.0" ], [ "WWW_HTTP", "10.1.9.1", "1.274E7", "174.0" ], [ "WWW_HTTP", "10.1.6.2", "1.274E7", "174.0" ], [ "WWW_HTTP", "10.1.6.1", "1.274E7", Data Center Real User Monitoring DMI Web Services Getting Started 21 Chapter 2 ∙ Using REST-based Web Services "174.0" ], [ "WWW_HTTP", "10.1.5.0", "3.9416E7", "452.0" ] ], "dmiServiceError": [ {} ], "timeBegin": 1136264400000, "timeoutValue": 600000, "timeEnd": 1136350800000 } Note that the result of getDMIData2 extends that of getDMIData by adding: "columnRendererIds": [ "STRING", "STRING" ], REST Developer Tools and Tips During development, the best tool is a good REST browser plug-in. RESTClient Browser Plug-in RESTClient (http://restclient.net/) for Firefox, Chrome, and Safari is just one example of various browser plug-ins available for developing REST applications for DMI. RESTClient gives you a single window through which you can define and send REST commands to a device and view the response sent by the device. It includes the following: Method The HTTP method (GET or POST) with which to pass the request to the device. URL The URL, including the device address and port number and the DMI resource specification (such as /rest/dmiquery/getDMIData3). Headers You need to specify an Authentication header and a Content-Type header for a DMI application. 1. Select Headers ➤ Custom Header. 2. Set Name to Content-Type. 3. Set Value to application/json. 4. Click Okay. 5. Select Authentication ➤ Basic Authentication. 6. Set Username and Password to the user name and password expected by the device. 7. Click Okay. Body For getDMIData, getDMIData2, and getDMIData3, you need to use this field (with a POST call) to specify request details that cannot be included in the URL. 22 Data Center Real User Monitoring DMI Web Services Getting Started Chapter 2 ∙ Using REST-based Web Services Response These four tabs display the response header (including status code) and three views of the response body. HTTP Methods Only two HTTP methods are used with REST and DMI: GET and POST. GET GET is a simple read command: the client uses a GET to request that the server send the client a copy of the data identified by the URL. All parameters necessary to a GET command are contained in the URL. Use GET for all DMI REST requests with getApplications, getDataViews, getResolutions, getDimensions, and getMetrics. POST A POST request updates the resource identified by the URL in the request. A POST request must include a body in which all parameters are provided. Use POST for all DMI REST requests with methods getDMIData, getDMIData2, and getDMIData3. HTTP Response Codes Some standard HTML response codes may when developing with REST and HTTP. 200 OK This response code indicates that the request has succeeded. 201 Created This response code indicates that a PUT or POST request was successful and a resource was created. 400 Bad Request This response code indicates that the request was malformed. You will see this when the data you send with a POST or PUT request is invalid or is formatted incorrectly. 401 Unauthorized This response code indicates that you need to perform authentication before accessing the resource. Make sure the user and password you are sending in the request header has been created on the target machine and is authorized to carry out the request. 403 Forbidden The provided user/password combination is not authorized to access the resource requested. 404 Not Found This response code generally indicates that the request pointed to a URL with no corresponding resource. 405 Method Not Allowed This response code indicates that the HTTP method used is not supported for this resource. Data Center Real User Monitoring DMI Web Services Getting Started 23 Chapter 2 ∙ Using REST-based Web Services 500 Internal Server Error This response code indicates a problem (probably on the server side) other than those described by the other response codes. HTTP Authentication REST authentication is handled by HTTP basic authentication, with a user name and a password sent in the authorization header of each request. You construct an authorization header from a user name and password. credentials_string = username + “:” + password authorization_header = “Basic ” + Base64(credentials_string) Note that there is a space after the word “Basic”. Example username = “Felix” password = “theCat” credentials_string = Base64(“Felix:theCat”) = “RmVsaXg6dGhlQ2F0” authorization_header = “Basic RmVsaXg6dGhlQ2F0” REST Principles REST is an architectural style, not an actual software implementation. Important components of the REST style are: Uniform interface (between client and server) A REST interface follows four design principles: • The interface identifies resources as abstract representations of the actual resources Resources are emphasized in a REST system. In a web-based REST system, resources such as database records on the server are represented in requests typically in JSON or XML format, such that a strict separation is maintained between the representation in the request and the actual data on the server. • The interface manipulates resources through these representations The client manipulates the resource representation and sends it back to the server, which translates that manipulation into changes in the actual resource on the server. In typical use, this means HTTP commands (GET, PUT, POST, DELETE) and URIs, with the response returned in the HTTP response body. • Self-descriptive messages Each message describes itself so the system knows how to process it (for example, which application to use with a message and whether the message can be cached). • HATEOAS (Hypermedia as the Engine of Application State) The client always enters the application through a URL. After that, all state transitions are made through hyperlinks in hypertext. HTTP offers an interface that adheres to these principles. 24 Data Center Real User Monitoring DMI Web Services Getting Started Chapter 2 ∙ Using REST-based Web Services Client-Server The interface maintains a clean separation between the client and the server: the client does not need to know about server components (such as data storage) and the server does not need to know about the user interface (such as user dialogs). This constraint keeps the system portable and allows the client and server to evolve independently. Stateless Each request contains all of the information needed to complete the request. The session state, if any, is maintained only by the client, not by the server. Cacheability Each response indicates whether the data in the response can be cached (whether the data can be reused later in response to an equivalent request). This is of course important to developing efficient web applications. Layered A component cannot see beyond the layer with which it is interacting. This limits system complexity, makes layers more independent, and makes the system more scalable. Optional: Code on demand The client can get code from the server and run it on the client side. Only an implementation that adheres to these principles (other than the last one, which is optional) is said to be RESTful. Idempotent and Safe The terms idempotent and safe frequently occur in discussions of RESTful development. Idempotent An idempotent method can be called any number of times (once, twice, ten time, etc.) with the same result. An idempotent method is better than a non-idempotent method when you are trying to build a fault-tolerant system, because you can always resend an idempotent method without worrying whether the same action is carried out more than once. Safe A safe method doesn't delete or change resources on the server. A safe method can be cached (prefetched). GET is idempotent and safe. POST is neither. Data Center Real User Monitoring DMI Web Services Getting Started 25 Chapter 2 ∙ Using REST-based Web Services 26 Data Center Real User Monitoring DMI Web Services Getting Started CHAPTER 3 Using SOAP-based Web Services This section assumes that you are familiar with development of web services, SOAP, XML, and Java EE. Note that you do not have to use Apache Axis to call web service methods exposed by Data Center Real User Monitoring Web services. Use of Apache Axis simplifies your application development but is not obligatory. IMPORTANT We strongly recommend that you choose the REST-based option. For more information, see Using REST-based Web Services [p. 11]. SOAP-based web services will no longer be supported after DC RUM 12.3. Specifications and references XML-RPC http://www.xmlrpc.com/spec SOAP In the case of Web services published by Data Center Real User Monitoring (DC RUM), SOAP is used to package XML transferred over HTTP. Data Center Real User Monitoring uses Apache Axis 1.4 as a SOAP engine for communication between service providers and consumers. For more information, see http://www.w3.org/TR/SOAP/ and http://ws.apache.org/axis/ Web Services Description Language (WSDL) Web Services Description Language (WSDL) is used to define Web services published on a particular server and describe how to access them. WSDL is an XML-based language. For more information, see http://www.w3.org/TR/wsdl DC RUM Web Services Architecture DC RUM uses Apache Axis 1.4 as a SOAP engine for communication between service providers and consumers. Apache Axis supports SOAP 1.1. Data Center Real User Monitoring DMI Web Services Getting Started 27 Chapter 3 ∙ Using SOAP-based Web Services Business objects that can be embedded in your application or portal are based on the Data Mining Interface (DMI), a proprietary interface to DC RUM databases. DMI enables DC RUM users to build custom reports and integrate DC RUM data with their applications or portals. Figure 1. Data Center Real User Monitoring web service architecture diagram. Software Prerequisites It is assumed that you have properly configured a Java application development environment, including the software components listed here. • A running installation of CAS or ADS 12.3 or higher. • JDK for a supported Java version. For more information, see Supported Java Versions in the Data Center Real User Monitoring Agentless Monitoring Device Installation Guide. • Apache Tomcat 5.5 or higher. It is not required to create and build a Web services client, though it is necessary to run a sample JSP client. For more information, see Example Using Web Services with JSP [p. 36]. • Apache Axis 1.4. Note that this software package is required for examples presented in this guide. Otherwise, Apache Axis is optional. Available Web Services The ADS and CAS both use basic authentication to access the published Web services. DC RUM 12.3 offers the web services described here. DMIService This service exposes methods to retrieve data regarding monitored traffic. Communication uses the RPC-encoded style of WSDL. For example, for the getDataSources method, a part of its definition is as follows: <wsdl:message name="getDataSourcesRequest"> <wsdl:part name="appId" type="soapenc:string"/> 28 Data Center Real User Monitoring DMI Web Services Getting Started Chapter 3 ∙ Using SOAP-based Web Services <wsdl:part name="viewId" type="soapenc:string"/> </wsdl:message> <wsdl:portType name="DMIService"> <wsdl:operation name="getDataSources" parameterOrder="appId viewId"> <wsdl:input message="impl:getDataSourcesRequest" name="getDataSourcesRequest"/> <wsdl:output message="impl:getDataSourcesResponse" name="getDataSourcesResponse"/> </wsdl:operation> … </wsdl:portType> … <wsdl:binding… /> Note that WSDL style also implies how SOAP envelopes are formed. DMIServiceWL This service exposes the same methods as DMIService, but uses document literal style of WSDL. Similar fragment of the method definition is as follows: <wsdl:message name="getDataSourcesRequest"> <wsdl:part element="impl:getDataSources" name="parameters"/> </wsdl:message> <wsdl:portType name="DMIServiceWL"> <wsdl:operation name="getDataSources"> <wsdl:input message="impl:getDataSourcesRequest" name="getDataSourcesRequest"/> <wsdl:output message="impl:getDataSourcesResponse" name="getDataSourcesResponse"/> </wsdl:operation> … </wsdl:portType> … <wsdl:binding… /> Note that WSDL style also implies how SOAP envelopes are formed. DataServerList This service contains methods to get the list of DMI data servers (data sources). DataServerListWL This service contains methods to get the list of DMI data servers (data sources), but uses document literal style of WSDL. The difference betweenDataServerList and DataServerListWL is exactly the same as the difference betweenDMIService and DMIServiceWL. Version This is an Axis service to get the version number of Apache Axis used in CAS or ADS. DC RUM 12.3 uses Apache Axis 1.4. Obtaining WSDL for Deployed Web Services To obtain WSDL for deployed web services, follow this example. Before You Begin We assume, for this example, that you have a CAS installation running on a server with the IP address 10.1.1.10, on port 80, and you want to use the DMIService service in your application. To get the definition of web services: 1. In your web browser, open the URL http://10.1.1.10/services Data Center Real User Monitoring DMI Web Services Getting Started 29 Chapter 3 ∙ Using SOAP-based Web Services Select the wsdl link next to the DMIService or just open the link 2. http://10.1.1.10/services/DMIService?wsdl Your web browser will display a WSDL definition of DMIService as shown below. <?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions targetNamespace="http://ws.delta.adlex" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://ws.delta.adlex" xmlns:intf="http://ws.delta.adlex" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <!--WSDL created by Apache Axis version: 1.4 Built on Apr 22, 2006 (06:55:48 PDT)--> <wsdl:types> <schema targetNamespace="http://ws.delta.adlex" xmlns="http://www.w3.org/2001/XMLSchema"> <import namespace="http://xml.apache.org/xml-soap"/> <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/> <complexType name="ArrayOfArrayOf_soapenc_string"> <complexContent> <restriction base="soapenc:Array"> <attribute ref="soapenc:arrayType" wsdl:arrayType="soapenc:string[][]"/> </restriction> </complexContent> </complexType> ... </wsdl:portType> <wsdl:binding name="DMIServiceSoapBinding" type="impl:DMIService"> <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="getServerUUID"> <wsdlsoap:operation soapAction=""/> <wsdl:input name="getServerUUIDRequest"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://ws.delta.adlex" use="encoded"/> </wsdl:input> <wsdl:output name="getServerUUIDResponse"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://ws.delta.adlex" use="encoded"/> </wsdl:output> </wsdl:operation> ... </wsdl:binding> <wsdl:service name="DMIServiceService"> <wsdl:port binding="impl:DMIServiceSoapBinding" name="DMIService"> <wsdlsoap:address location="http://10.1.1.1/services/DMIService"/> </wsdl:port> </wsdl:service> </wsdl:definitions> Generating Stubs and Data Types from WSDL To generate stub classes and object mappings for your application, save a WSDL definition of a service on your local disk in the working directory, define the environment variables required by Apache Axis, and run a converter Java class with the name of the service as an input parameter. For example: 1. 2. 30 Save http://10.1.1.10/services/DMIService?wsdl as DMIService.wsdl From the command prompt, run the commands as in the following example: (Note the line continuation characters “÷”) Data Center Real User Monitoring DMI Web Services Getting Started Chapter 3 ∙ Using SOAP-based Web Services set AXIS_LIB=AXIS/lib/ set AXISCLASSPATH=%AXIS_LIB%wsdl4j-1.5.1.jar;%AXIS_LIB%axis.jar; ÷ %AXIS_LIB%axis-ant.jar;%AXIS_LIB%commons-discovery-0.2.jar; ÷ %AXIS_LIB%commons-logging-1.0.4.jar;%AXIS_LIB%jaxrpc.jar; ÷ %AXIS_LIB%log4j-1.2.8.jar;%AXIS_LIB%saaj.jar;%ATTPATH% java -cp %AXISCLASSPATH% org.apache.axis.wsdl.WSDL2Java -T 1.2 ÷ -o .\DMIService DMIService.wsdl The org.apache.axis.wsdl.WSDL2Java class will generate stubs and object mappings for use in your application. The folder defined during the conversion (in the example above, it will be DMIService) will list the following classes: 1. DMIService.java Object representing an interface describing all the methods found in the WSDL. 2. DMIData.java Return object of the DMIService.getDMIData method. 3. DMIServiceError.java One of the fields of the DMIData object 4. DMIServiceSoapBindingStub.java Implementation of DMIService object (extends org.apache.axis.client.stub class). 5. DMIServiceService.java Interface allowing to implement DMIService. 6. DMIServiceServiceLocator.java Interface making it possible to implement DMIService with additional parameters. Creating Your Application This example introduces the usage of DC RUM Web services. It defines the server URL, authenticates the user (if basic authentication exists), calls out example methods, and displays the result. Before You Begin This example uses Java technology for developing an application. A Java development environment should be configured for this application to execute properly. To create a sample application that uses DC RUM Web services: 1. Create a Java class package. package examples; import import import import java.net.MalformedURLException; java.net.URL; java.rmi.RemoteException; javax.xml.rpc.ServiceException; Data Center Real User Monitoring DMI Web Services Getting Started 31 Chapter 3 ∙ Using SOAP-based Web Services import import import import import org.apache.axis.client.Stub; adlex.delta.ws.DMIData; adlex.delta.ws.DMIService; adlex.delta.ws.DMIServiceError; adlex.delta.ws.DMIServiceServiceLocator; public class DMIServiceClient { static static static static static static static static static static static static static static static 2. String appId = "CVENT"; String viewId; String dataSourceId; String[] dimensionIds; String[] metricIds; String[][] dimFilters; String[][] metricFilters; String[][] sort; Integer top; String resolution; String timePeriod; Integer numberOfPeriods; Long timeBegin; Long timeEnd; Long timeout; Define and test the URL. Be sure to provide an active user account for the server you work with. /** * @param args */ public static void main(String[] args) { // create locator DMIServiceServiceLocator locator = new DMIServiceServiceLocator(); try { String defURL = "http://10.1.1.1:8081"; String serviceURL = defURL + "/services/DMIService"; String user = "testuser"; String password = "testpassword"; 3. Create a DMIService object. DMIService service = locator.getDMIService(new URL(serviceURL)); For more information, see Item 1 [p. 31]. 4. Authenticate the connection to the server. ((Stub)service).setUsername(user); ((Stub)service).setPassword(password); 5. Add the getServerUUID method. System.out.print("server UUID="); System.out.println(service.getServerUUID()); 6. Add the getResolutions method. viewId= "ClientView"; //ads String[] resolutions = service.getResolutions(appId, viewId); for (String string : resolutions) { System.out.println(string); } 7. Add the getDataViews method. String[][] dataViews = service.getDataViews(appId); for (int I = 0; I < dataViews.length; I++) { String[] app = dataViews[i]; System.out.println("-------"); System.out.println(app[0]); System.out.println(app[1]); 32 Data Center Real User Monitoring DMI Web Services Getting Started Chapter 3 ∙ Using SOAP-based Web Services System.out.println("-------"); } 8. Add the getDMIData method. a. Set the getDMIData criteria. setCriteria(); The criteria are defined in a separate definition list located at the end of this example. For more information, see Step 10 [p. 34]. b. Add the getDMIData method. viewId= "ClientView"; DMIData data = service.getDMIData(appId, viewId, dataSourceId, dimensionIds, metricIds, dimFilters, metricFilters, sort, top, resolution, timePeriod, numberOfPeriods, timeBegin, timeEnd, timeout); if (data.isTimeout()) { System.out.println("timeout"); return; } showErrors(data); //displays results showResults(data); //displays results viewId= "CVCache"; data = service.getDMIData(appId, viewId, dataSourceId, dimensionIds, metricIds, dimFilters, metricFilters, sort, top, resolution, timePeriod, numberOfPeriods, timeBegin, timeEnd, timeout); if (data.isTimeout()) { System.out.println("timeout"); return; } showErrors(data); showResults(data); } catch (ServiceException e) { e.printStackTrace(); } catch (RemoteException e) { e.printStackTrace(); } catch (MalformedURLException e) { e.printStackTrace(); } } 9. Define the format and display the result. a. Add the showResults method. /** * @param data */ private static void showResults(DMIData data) { System.out.println("columnHeader"); String[] columnHeader = data.getColumnHeader(); for (int I = 0; I < columnHeader.length; I++) { System.out.println(columnHeader[i]); } System.out.println("formattedData"); String[][] formattedData = data.getFormattedData(); for (int I = 0; I < formattedData.length; I++) { System.out.println("--row no:" + I); String[] fdata = formattedData[i]; for (int j = 0; j < fdata.length; j++) { System.out.println(fdata[j]); } } } b. Add the showErrors method. /** * @param dmiServiceError */ Data Center Real User Monitoring DMI Web Services Getting Started 33 Chapter 3 ∙ Using SOAP-based Web Services private static boolean showErrors(DMIData data) { DMIServiceError[] dmiServiceError = data.getDmiServiceError(); if (dmiServiceError== null) { return false; } for (int I = 0; I < dmiServiceError.length; I++) { DMIServiceError error = dmiServiceError[i]; String[] descriptions = error.getErrorDescriptions(); if (descriptions!= null) { System.out.println("-errors"); for (int j = 0; j < descriptions.length; j++) { System.out.println(descriptions[j]); } } descriptions = error.getWarningDescriptions(); if (descriptions!= null) { System.out.println("-warnings"); for (int j = 0; j < descriptions.length; j++) { System.out.println(descriptions[j]); } } descriptions = error.getInfoDescriptions(); if (descriptions!= null) { System.out.println("-info"); for (int j = 0; j < descriptions.length; j++) { System.out.println(descriptions[j]); } } } return true; } 10. Define the criteria used with getDMIData. private static void setCriteria() { appId = "CVENT"; //vas viewId= "ClientView"; //ads resolution = "r"; dataSourceId = "localhost"; dimensionIds = new String [] { "begT", "appl"}; metricIds = new String []{"svrDelay", "netDelay", "abortspc"}; dimFilters = null; metricFilters = null; sort = null; top =10; resolution = "r"; timePeriod = "1P"; numberOfPeriods = null; timeEnd = null; timeBegin = null; timeout = 60000L ; } } 11. Execute the above example and observe the result. Keeping Track of Web Service Use CAS and ADS keep track of DMI Web service use. All calls via Web services are recorded in the Web server log located in the log/ncsa directory under your report server's installation folder. Note that this is where all Web server logs are stored, so look for records related to Web service in the log files. Each record includes the method name and its parameters. Based on this information, a diagnostic report has been designed to give a summary of method calls for today and a detailed log of calls for the past hour. This report is available from the Tools ➤ Diagnostics ➤ DMI Web Service Activity menu. 34 Data Center Real User Monitoring DMI Web Services Getting Started Chapter 3 ∙ Using SOAP-based Web Services In addition, there are commands in the diagnostic console. The console is available from the Tools ➤ Diagnostics ➤ Console menu. The commands related to web services can be used for debugging purposes. WEB SERVICE DMISERVICE SAVE number This commands creates and saves the specified number of DMI reports that document subsequent calls of the DMIService method. The number is a cardinal from the range of 1 to 99. The DMI report definitions are saved in the database, but are not available in Report ➤ Data Mining Reports. WEB SERVICE DMISERVICE SAVE_STATUS This command displays the status of saved reports generated by the call of the command WEB SERVICE DMISERVICE SAVE. Testing Your Application To test and verify your Web service calls, use the DMI Web Service Activity report. In addition, you can use Axis TCP Monitor and SOAP Monitor for detailed analysis of your SOAP calls. For more information on these tools, see Axis User's Guide at http://ws.apache.org/axis/java/user-guide.html. Using the Axis TCP Monitor (tcpmon) The tcpmon utility can be found in the org.apache.axis.utils package. It is a tool to monitor SOAP communication between your local computer, a Web service client, and a Web service provider. A batch file located in the CAS distribution media (tcp_monitor.bat) located in the /tool/ directory will also execute the monitor program. Using the SOAP Monitor SOAP Monitor is another tool that enables Web service developers to monitor the content of SOAP messages. Note that, for security reasons, SOAP Monitor is not enabled by default. Data Integration with Your Application DC RUM Web services enable developers to access data from CAS or ADS by means of data views. A data view is a predefined perspective on data stored in the CAS or ADS database. Developers do not need to know all database internals and relationships between tables to use data views. From a developer's perspective, a data view is a single table containing data that can be retrieved for further analysis. Data views are primarily used in DMI for defining queries. DC RUM Web services publish data from available data views, so using CAS or ADS data for presentation in third-party portals or applications is very similar to defining a DMI query and displaying the query results. Data Center Real User Monitoring DMI Web Services Getting Started 35 Chapter 3 ∙ Using SOAP-based Web Services Example Using DMIServiceClient with a Loop To periodically check for and collect new data, you can implement a loop for the getDMIData method. The Java example described earlier illustrates how to use Web Services methods in an application, but it focuses only on a single access to the available data. Adding a loop as shown in the example enables repeated checking. Note that the timeout variable is defined in the criteria definition located at the end of the example. For more information, see Step 10 [p. 34]. Example 1. The DMIServiceClient method usage with a loop /* set parameters of getDMIData */ setCriteria(); viewId= "ClientView"; long formerLastSampleTime = 0; long lastSampleTime = service.getLastSampleTime(appId, viewId, resolution); int count = 0; boolean go = true; while(go) { System.out.println("-lastSampleTime=" + lastSampleTime); if (formerLastSampleTime != lastSampleTime) { formerLastSampleTime = lastSampleTime; count ++; DMIData data = service.getDMIData(appId, viewId, dataSourceId, dimensionIds, metricIds, dimFilters, metricFilters, sort, top, resolution, timePeriod, numberOfPeriods, timeBegin, timeEnd, timeout); if (data.isTimeout()) { System.out.println("timeout"); return; } showErrors(data); showResults(data); } else { System.out.println("--------"); } Thread.sleep(1000*60*5); //check every 5 minutes System.out.println("--wake up"); lastSampleTime = service.getLastSampleTime(appId, viewId, resolution); } } catch (ServiceException e) { e.printStackTrace(); } catch (RemoteException e) { e.printStackTrace(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } } Example Using Web Services with JSP JSP technology makes it possible to combine web forms and output formatting with the method calls to the web services. The following example consists of four files: form.jsp A basic web form that makes it possible to specify parameters and options to retrieve DMI data, dimensions, metrics, and retrieving values of a dimension for use in a report. 36 Data Center Real User Monitoring DMI Web Services Getting Started Chapter 3 ∙ Using SOAP-based Web Services clientDMIData.jsp A table displaying the Parameters, Timeout, Errors, and Results defined in a main form. clientDimensionsMetrics.jsp A table displaying the Parameters, Dimensions, and Metrics defined in a main form. clientReport.jsp A report displaying a predefined report from the server. Optionally, it generates links to that report on the server. Example 2. Example of Using DMIService with JSP This example demonstrates the usage of methods described in Creating Your Application [p. 31]. File: form.jsp <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>DMIService client examples - FORM</title> </head> <body> <strong>Example of retrieving data</strong> <form action="clientDMIData.jsp"> <table> <tr> <td>serviceURL</td> <td><select name="serviceURL"> <option>http://localhost:8081/services/DMIService</option> <option selected="selected">http://localhost/services/DMIService</option> </select></td> </tr> ... <tr> <td>dataSourceId</td> <td><input type="text" name="dataSourceId" value="localhost" /></td> </tr> <tr> <td><br /> </td> </tr> <tr> <td>dimensionIds</td> <td><input type="text" name="dimensionIds" value="begT" /></td> </tr> <tr> <td>dimensionIds</td> <td><input type="text" name="dimensionIds" value="appl" /></td> </tr> ... <tr> <td>top</td> <td><input type="text" name="top" value="10" /></td> </tr> <tr> <td>resolution</td> <td><input type="text" name="resolution" value="r" /></td> Data Center Real User Monitoring DMI Web Services Getting Started 37 Chapter 3 ∙ Using SOAP-based Web Services </tr> <tr> <td>resolution</td> <td><input type="text" name="timePeriod" value="1P" /></td> </tr> ... <br> <input type="submit" value="DMIData" /></form> <hr> <strong>Example of retrieving dimensions and metrics</strong> <%---------------------------------------------------------%> <form action="clientDimensionsMetrics.jsp"><br> <table> <tr> <td>serviceURL</td> <td><select name="serviceURL"> <option>http://localhost:8081/services/DMIService</option> <option selected="selected">http://localhost/services/DMIService</option> </select></td> </tr> ... <tr> <td>appId</td> <td><input type="text" name="appId" value="CVENT" /></td> </tr> ... <tr> <td>dataSourceId</td> <td><input type="text" name="dataSourceId" value="localhost" /></td> </tr> <tr> <td>resolution</td> <td><input type="text" name="resolution" value="r" /></td> </tr> </table> <br> <input type="submit" value="Dimensions and metrics" /></form> <%---------------------------------------------------------%> <hr> <strong>Example of retrieving values of dimension and using it in a report</strong> <form action="clientReport.jsp"><br> <table> <tr> <td>VAS URL</td> <td><select name="vasURL"> <option>http://localhost:8081</option> <option selected="selected">http://localhost</option> </select></td> </tr> ... <tr> <td>viewId</td> <td><select name="viewId"> <option selected="selected">ClientView</option> <option >CVCache</option> </select></td> </tr> <tr> <td>dataSourceId</td> <td><input type="text" name="dataSourceId" value="localhost" /></td> </tr> 38 Data Center Real User Monitoring DMI Web Services Getting Started Chapter 3 ∙ Using SOAP-based Web Services <tr> <td>dimId</td> <td><input type="text" name="dimId" value="appl" /></td> </tr> ... <tr> <td>filter</td> <td><input type="text" name="filter" value="" /></td> </tr> </table> <br> <input type="submit" value="Report with filter" /></form> </body> </html> File: clientDMIData.jsp <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%> <%@page import="java.net.MalformedURLException"%> <%@page import="java.net.URL"%> <%@page import="java.rmi.RemoteException"%> <%@page import="javax.xml.rpc.ServiceException"%> <%@page import="org.apache.axis.client.Stub"%> <%@page import="adlex.delta.ws.DMIData"%> <%@page import="adlex.delta.ws.DMIService"%> <%@page import="adlex.delta.ws.DMIServiceServiceLocator"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>DMIService client examples - DMI Data</title> </head> <body> <br> <form action="form.jsp"><input type="submit" action="form.jsp" value="Back to form"></form> <br> <strong>Parameters:</strong> <br /> <table border="1"> <c:forEach var="map_entry" items="${param}"> <tr> <td><strong><c:out value="${map_entry.key}" /></strong></td> <td><c:out value="${map_entry.value}" /><br> </td> </tr> </c:forEach> </table> <br> <% /* connection params */ serviceURL = request.getParameter("serviceURL"); user = request.getParameter("user"); password = request.getParameter("password"); /* set criteria */ appId = request.getParameter("appId"); viewId= request.getParameter("viewId"); resolution = request.getParameter("resolution"); dataSourceId = request.getParameter("dataSourceId"); dimensionIds = request.getParameterValues("dimensionIds"); metricIds = request.getParameterValues("metricIds"); dimFilters = null; metricFilters = null; Data Center Real User Monitoring DMI Web Services Getting Started 39 Chapter 3 ∙ Using SOAP-based Web Services sort = null; resolution = request.getParameter("resolution"); String s = request.getParameter("top"); if (s!= null && s.trim().length()>0) { top = new Integer(s); } //timePeriod = "3MO"; timePeriod = request.getParameter("timePeriod"); s = request.getParameter("numberOfPeriods"); if (s!= null && s.trim().length()>0) { numberOfPeriods = new Integer(s); } s = request.getParameter("timeBegin"); if (s!= null && s.trim().length()>0) { timeBegin = new Long(s); } s = request.getParameter("timeEnd"); if (s!= null && s.trim().length()>0) { timeEnd = new Long(s); } s = request.getParameter("timeout"); if (s!= null && s.trim().length()>0) { timeout = new Long(s); } %> <jsp:useBean id="dmiData" class="adlex.delta.ws.DMIData"> <% DMIData dmiD = getDMIData(); dmiData.setTimeout(dmiD.isTimeout()); dmiData.setFormattedData(dmiD.getFormattedData()); dmiData.setDmiServiceError(dmiD.getDmiServiceError()); dmiData.setColumnHeader(dmiD.getColumnHeader()); %> </jsp:useBean> <strong>Timeout: </strong> <c:out value="${dmiData.timeout}" /> <br /> <strong>Errors: </strong> <table border="1"> <br> <c:forEach var="row" items="${dmiData.dmiServiceError}"> <tr> <c:forEach var="value" items="${row.errorDescriptions}"> <td><strong><c:out value="${value}" /></strong>:</td> </c:forEach> <c:forEach var="value" items="${row.infoDescriptions}"> <td><strong><c:out value="${value}" /></strong>:</td> </c:forEach> <c:forEach var="value" items="${row.warningDescriptions}"> <td><strong><c:out value="${value}" /></strong>:</td> </c:forEach> </tr> </c:forEach> </table> <br> <strong>Results: </strong> <table border="1"> <tr> <c:forEach var="value" items="${dmiData.columnHeader}"> <th><strong><c:out value="${value}" /></strong></th> </c:forEach> </tr> 40 Data Center Real User Monitoring DMI Web Services Getting Started Chapter 3 ∙ Using SOAP-based Web Services <c:forEach var="row" items="${dmiData.formattedData}"> <tr> <c:forEach var="value" items="${row}"> <td><c:out value="${value}" /> </td> </c:forEach> </tr> </c:forEach> </table> <%! String serviceURL; String user; String password; String appId ; String viewId; String dataSourceId; String[] dimensionIds; String[] metricIds; String[][] dimFilters; String[][] metricFilters; String[][] sort; Integer top; String resolution; String timePeriod; Integer numberOfPeriods; Long timeBegin; Long timeEnd; Long timeout; public DMIData getDMIData() { // create locator DMIData ret = new DMIData(); DMIServiceServiceLocator locator = new DMIServiceServiceLocator(); try { DMIService service = locator.getDMIService(new URL(serviceURL)); // set authentication ((Stub)service).setUsername(user); ((Stub)service).setPassword(password); // call method ret = service.getDMIData(appId, viewId, dataSourceId, dimensionIds, metricIds, dimFilters, metricFilters, sort, top, resolution, timePeriod, numberOfPeriods, timeBegin, timeEnd, timeout); return ret; } catch (ServiceException e) { e.printStackTrace(); } catch (RemoteException e) { e.printStackTrace(); } catch (MalformedURLException e) { e.printStackTrace(); } return ret; } %> </body> </html> File: clientDimensionsMetrics.jsp <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%> <%@page import="java.net.MalformedURLException"%> <%@page import="java.net.URL"%> <%@page import="java.rmi.RemoteException"%> <%@page import="javax.xml.rpc.ServiceException"%> <%@page import="org.apache.axis.client.Stub"%> <%@page import="adlex.delta.ws.DMIService"%> <%@page import="adlex.delta.ws.DMIServiceServiceLocator"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> Data Center Real User Monitoring DMI Web Services Getting Started 41 Chapter 3 ∙ Using SOAP-based Web Services <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>DMIService client examples - dimensions and metrics</title> </head> <body> <br> <form action="form.jsp"><input type="submit" action="form.jsp" value="Back to form"></form> <br> <strong>Parameters:</strong> <br /> <table border="1"> <c:forEach var="map_entry" items="${param}"> <tr> <td><strong><c:out value="${map_entry.key}" /></strong></td> <td><c:out value="${map_entry.value}" /><br> </td> </tr> </c:forEach> </table> <br> <% /* connection params */ serviceURL = request.getParameter("serviceURL"); user = request.getParameter("user"); password = request.getParameter("password"); /* set criteria */ appId = request.getParameter("appId"); viewId= request.getParameter("viewId"); resolution = request.getParameter("resolution"); dataSourceId = request.getParameter("dataSourceId"); %> <jsp:useBean id="dmiBean" class="examples.DMIBean"> <% getDimensions(dmiBean); %> </jsp:useBean> <strong>Dimensions: </strong> <table border="1"> <c:forEach var="row" items="${dmiBean.dimensions}"> <tr> <c:forEach var="value" items="${row}"> <td><c:out value="${value}" /> </td> </c:forEach> </tr> </c:forEach> </table> <strong>Metrics: </strong> <table border="1"> <c:forEach var="row" items="${dmiBean.metrics}"> <tr> <c:forEach var="value" items="${row}"> <td><c:out value="${value}" /> </td> </c:forEach> </tr> </c:forEach> </table> <%!String serviceURL; String user; String password; String String String String appId ; viewId; dataSourceId; resolution; public void getDimensions(examples.DMIBean bean) { // create locator String [][] ret = null; DMIServiceServiceLocator locator = new DMIServiceServiceLocator(); try { 42 Data Center Real User Monitoring DMI Web Services Getting Started Chapter 3 ∙ Using SOAP-based Web Services DMIService service = locator.getDMIService(new URL(serviceURL)); set authentication ((Stub)service).setUsername(user); ((Stub)service).setPassword(password); // call method ret = service.getDimensions(appId, viewId, resolution); bean.setDimensions(ret); ret = service.getMetrics(appId, viewId, resolution); bean.setMetrics(ret); } catch (ServiceException e) { e.printStackTrace(); } catch (RemoteException e) { e.printStackTrace(); } catch (MalformedURLException e) { e.printStackTrace(); } }%> </body> </html> // File: clientReport.jsp <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> <%@page import="java.net.MalformedURLException"%> <%@page import="java.net.URL"%> <%@page import="java.rmi.RemoteException"%> <%@page import="javax.xml.rpc.ServiceException"%> <%@page import="org.apache.axis.client.Stub"%> <%@page import="adlex.delta.ws.DMIService"%> <%@page import="adlex.delta.ws.DMIServiceServiceLocator"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>DMIService client examples - report</title> </head> <body> <br> <form action="form.jsp" > <input type="submit" action="form.jsp" value="Back to form" > </form> <br> <strong>Parameters:</strong><br/> <table border="1"> <c:forEach var="map_entry" items="${param}"> <tr> <td> <strong><c:out value="${map_entry.key}" /></strong> </td> <td> <c:out value="${map_entry.value}" /><br> </td> </tr> </c:forEach> </table> <br> <% /* connection params */ vasURL = request.getParameter("vasURL"); user = request.getParameter("user"); password = request.getParameter("password"); /* set criteria */ appId = request.getParameter("appId"); viewId = request.getParameter("viewId"); dimId = request.getParameter("dimId"); dataSourceId = request.getParameter("dataSourceId"); quant = new Integer(request.getParameter("quant")); Data Center Real User Monitoring DMI Web Services Getting Started 43 Chapter 3 ∙ Using SOAP-based Web Services filter = request.getParameter("filter"); %> <jsp:useBean id="dmiBean" class="examples.DMIBean"> <% getDimensionValues(dmiBean); %> </jsp:useBean> <strong> <a href="<%=vasURL%>/LSServlet?lsAction=LoadByName&lsEntryName=ExampleReport" target="report">ExampleReport without filter</a> </strong> <br> <br> <strong>Report for application: </strong> <table border="1"> <c:forEach var="value" items="${dmiBean.dimensionValues}"> <tr> <td> <%-- in the FILTER_<dimId> parameter specifies the filter value --%> <a href="<%=vasURL%>/LSServlet?lsAction=LoadByName&lsEntryName=ExampleReport&FILTER_appl=<c:out value="${value}"/>" target="report"><c:out value="${value}" /></a> </td> </tr> </c:forEach> </table> <%!String vasURL; String user; String password; String appId; String viewId; String dimId = "appl"; String dataSourceId; Integer quant = 0; String filter; public void getDimensionValues(examples.DMIBean bean) { // create locator String[] ret = null; DMIServiceServiceLocator locator = new DMIServiceServiceLocator(); try { DMIService service = locator.getDMIService(new URL(vasURL + "/services/DMIService")); // set authentication ((Stub) service).setUsername(user); ((Stub) service).setPassword(password); // call method ret = service.getDimensionValues(appId, viewId, dimId, dataSourceId, quant, filter); bean.setDimensionValues(ret); } catch (ServiceException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } }%> </body> </html> 44 Data Center Real User Monitoring DMI Web Services Getting Started APPENDIX A DMI Service Method Reference Methods and data structures of DMIService enable you to integrate DC RUM with enterprise solutions such as dashboards, portals, and intranets. All data views available in ADS or CAS are described in the documentation and Online Help. For more information, see Advanced Diagnostics Server Data Views in the Data Center Real User Monitoring Advanced Diagnostics Server User Guide and Central Analysis Server Data Views in the Data Center Real User Monitoring Central Analysis Server User Guide. To understand how Data Mining Interface works, refer to Data Center Real User Monitoring Data Mining Interface (DMI) User Guide. Note that metrics available in data views may be different from those used in predefined CAS reports. A subset of these methods apply to REST-based web services: getApplications Use getApplications to list all applications available on the device you are addressing. For more information, see getApplications [p. 46] and Example REST getApplications [p. 12]. getDataViews Use getDataViews to list all data views for one of the applications available on the device you are addressing. For more information, see getDataViews [p. 47] and Example REST getDataViews [p. 13]. getResolutions Use getResolutions to list the resolutions for one data view and one application on the device you are addressing. For more information, see getResolutions [p. 59] and Example REST getResolutions [p. 14]. getDimensions Use getDimensions to list the dimensions for one resolution, one data view, and one application on the device you are addressing. For more information, see getDimensions [p. 47] and Example REST getDimensions [p. 15]. Data Center Real User Monitoring DMI Web Services Getting Started 45 Appendix A ∙ DMI Service Method Reference getMetrics Use getMetrics to list the metrics for one resolution, one data view, and one application on the device you are addressing. For more information, see getMetrics [p. 58] and Example REST getMetrics [p. 16]. getDMIData, getDMIData2, getDMIData3 These are three successive versions of essentially the same method. If you have already developed applications that use calls to getDMIData or getDMIData2, you can continue to depend on support for them. If you are developing a new application, use getDMIData3. For more information, see getDMIData [p. 48], getDMIData2 [p. 51], and getDMIData3 [p. 55]. For examples, see Example REST getDMIData, getDMIData2, getDMIData3 [p. 16]. getApplications Method getApplications returns a list of applications as an array of arrays of Strings. public String[][] getApplications() The nested array describes an application: [0]: Internal identifier of an application. [1]: User-readable name of the application. Used for presentation in DMI. Example The method call getApplications() returns a result such as: {{"CVENT","Vantage Analysis Server"}, {"HTTPLOG","HTTP Analysis"}} getCurrentTime Method getCurrentTime returns the time stamp in the form of the number of milliseconds since January 1, 1970. public long getCurrentTime(String appId, String viewId, String resolution) Parameter Type Description appId String Application ID as returned by getApplications(). viewId String Data view ID as returned by getDataViews(). resolution String Data resolution ID as returned by getResolutions(). Example The method call getCurrentTime("CVENT", "ClientView", "1D") returns a long integer representing the time stamp of the current batch of performance data returned by the referred data view. The format of the returned value is compliant with Java time stamp System.getCurrentMillis(). Note that the time returned depends on the data view and the granularity of how it calculates its time stamps. 46 Data Center Real User Monitoring DMI Web Services Getting Started Appendix A ∙ DMI Service Method Reference getDataSources Method getDataSources returns a list of data servers as an array of arrays of Strings. public String[][] getDataSources(String appId, String viewId) The nested array describes a data source: [0]: Internal identifier of a data source. [1]: User-readable name of the data source. Used for presentation in DMI. Parameter Type Description appId String Application ID, as returned by getApplications() viewId String Data view ID, as returned by getDataViews() Example The method call getDataSources("CVENT", "ClientView") returns a result such as: {{"Rolling", "Application"}, {}, …}. getDataViews Method getDataViews returns a list of data views as an array of arrays of Strings. public String[][] getDataViews(String appId) The nested array describes a data view: [0]: Internal identifier of a data view. [1]: User-readable name of the data view. Used for presentation in DMI. Parameter Type Description appId String Application ID as returned by getApplications() Example The method call getDataViews("CVENT") returns a result such as: {{"ClientView","Monitored traffic"}, {"Rolling","Baseline traffic"}, …} getDimensions Method getDimensions returns a list of dimensions as an array of arrays of Strings. public String[][] getDimensions(String appId, String viewId, String resolution) The nested array describes a dimension: [0]: Internal identifier of a dimension (filter criterion). [1]: User-readable name of a dimension. Used for presentation in DMI. [2]: Unit of a dimension. This field is empty because dimensions do not have units. [3]: Type of a dimension. For example, STRING. Data Center Real User Monitoring DMI Web Services Getting Started 47 Appendix A ∙ DMI Service Method Reference Parameter Type Description appId String Application ID, as returned by getApplications(). viewId String Data view ID, as returned by getDataViews(). resolution String Data resolution ID, as returned by getResolutions(). Example The method call getDimensions("CVENT", "ClientView", "1D") returns a result such as: {{"APPL","Application",,STRING}, {"SVR","Server IP Address",,INT}, …}. getDimensionValues Method getDimensionValues returns a list of dimension values as an array of Strings. public String[] getDimensionValues(String appId, String viewId, String dimId, String dataSourceId, Integer quantity, String filter) The values can be used as parts of filter expressions in data retrieval method getDMIData. Parameter Type Description appId String Application ID, as returned by getApplications(). viewId String Data view ID, as returned by getDataViews(). dimId String Dimension ID, as returned by getDimensions(). dataSourceId String Data source ID, as returned by getDataSources() or null. quantity Integer Maximum number of data rows in the returned table. If more values are available in DMI, only quantity will be returned. If quantity is null or <=0, then all values of the dimension will be returned. Note that this list may be very long. filter String Filter expression to narrow dimension value selection. You can use wildcard characters “?” and “*” and combine filter expressions with the pipe character “|” interpreted as logical OR. Example The method call getDimensionValues ("CVENT","ClientView","APPL",null,10,"A*") returns a result such as: {{"ABCapplication","Application","CVENT",{""}}, ...} getDMIData Method getDMIData returns an adlex.delta.ws.DMIData object. Note that it is an actual data retrieval method. 48 Data Center Real User Monitoring DMI Web Services Getting Started Appendix A ∙ DMI Service Method Reference Syntax NOTE • The difference between getDMIData and getDMIData2 is that the latter method returns an object that contains GUI labels and units of measure for returned data. • The difference between getDMIData2 and getDMIData3 is that the latter method returns an object that contains IDs of the column renderers. public adlex.delta.ws.DMIData getDMIData(String appId, String viewId, String dataSourceId, String[] dimensionIds, String[] metricIds, String[][] dimFilters, String[][] metricFilters, String[][] sort, Integer top, String resolution, String timePeriod, Integer numberOfPeriods, Long timeBegin, Long timeEnd, Long timeout) Parameter Type Description appId String Application ID, as returned by getApplications(). viewId String Data view ID, as returned by getDataViews(). dataSourceId String Dimension ID, as returned by getDataSources() or null. dimensionIds String Dimension IDs, as returned by getDimensions(). metricIds String Metric IDs, as returned by getMetrics(). dimFilters array of Strings Array of dimension filters. The array structure is as follows: [0]: dimension ID, as returned by getDimensions() [1]: as per description of filter in the table above [2]: filter negation trigger, if it is present and contains the value “NOT” or “1”. metricFilters array of Strings Array of metric filters. The array structure is as follows: [0]: metric ID, as returned by getMetrics() [1]: operator [2]: value [3]: the filter is applied to results, if it is present and contains the value “RESULT” or “1” sort array of Strings Result sort criteria. The nested array describes filter: [0]: metric or dimension identifier [1]: sort order. Available orders are: “ASC” or null for ascending order, “DESC” for descending order. In the current version, only the first subarray is taken into consideration. top Integer Number of returned table rows. Data Center Real User Monitoring DMI Web Services Getting Started 49 Appendix A ∙ DMI Service Method Reference Parameter Type Description If top is set to 0, all rows will be returned. If top is set to null or <=0, only first 1000 rows will be returned. resolution String Data resolution ID, as returned by getResolutions() timePeriod String Time period covered by the report, as one of the following values: p: 1 period (monitoring interval, dependent on the report server settings) d: 1 day w: 1 week m: 1 month T: today (since midnight) 1P: last period 1H: last hour 1D: last day 7D: last 7 days 30D: last 30 days 3MO: last 3 months 12MO: last 12 months FW: the full week FM: the full month WTD: week to date MTD: month to date QTD: quarter to date YTD: year to date numberOfPeriods Integer Number of periods; if it is set and timeBegin is null, then timePeriod has to be set. timeBegin Long Data coverage begin time, expressed in milliseconds elapsed since January 1, 1970; if it is set, then timePeriod and numberOfPeriods are ignored. timeEnd Long Data coverage begin time, expressed in milliseconds elapsed since January 1, 1970; if it is null, then time of the last processed performance data batch is taken. timeOut Long Timeout value in milliseconds to retrieve data; if timeout <=0, then default DMI timeout value for queries will be applied. adlex.delta.ws.DMIData public class DMIData implements java.io.Serializable { String[] columnHeaders; String[][] formattedData; Double[][] rawData; Boolean timeout; Long TimeoutValue; DMIServiceError [] dmiServiceError; Long timeBegin; Long timeEnd; } 50 Data Center Real User Monitoring DMI Web Services Getting Started Appendix A ∙ DMI Service Method Reference where: columnHeaders A table of dimension IDs and metrics IDs. Note that in some cases DMI can limit list of metrics and dimensions depending on a data view logic. formattedData A two-dimensional table of formatted data returned by DMI. rawData A two-dimensional table of data returned in the numerical form. Most metrics and some dimensions are numbers (such as time). If something does not have a numeric representation, it is represented as null. timeout A boolean value indicating whether time out occurred. timeoutValue A timeout threshold value. dmiServiceError A table of errors, messages, and warnings returned by DMI. Each position describes the nature of a problem. timeBegin The actual begin time taken by the server. timeEnd The actual end time taken by the server. dmiServiceError public class DMIServiceError { String [] errorDescriptions; protected String [] infoDescriptions; protected String [] warningDescriptions; boolean error; boolean info; boolean warning; } errorDescriptions: A table of error descriptions; it contains values only if error is set to true. warningDescriptions: A table of warning descriptions; it contains values only if warning is set to true. infoDescriptions: A table of info descriptions; it contains values only if info is set to true. error: Indicates the occurrence of a DMI error. warning: Indicates the occurrence of a DMI warning. info: Indicates the occurrence of a DMI info message. Example The method call getDMIData(appId, viewId, dataSourceId, dimensionIds, metricIds, dimFilters, metricFilters, sort, top, resolution, timePeriod, numberOfPeriods, timeBegin, timeEnd, timeout) returns (using the formattedData method) a result such as: {{"CVENT"}, {"CVCache"}, {"localhost"}, {"begT"}, {"svrDelay"}, {""}, {""}, {""}, {10}, {"r"}, {"1P"}, {""}, {""}, {""}, {30000}} getDMIData2 Method getDMIData2 returns an adlex.delta.ws.DMIData object. Note that it is an actual data retrieval method. Data Center Real User Monitoring DMI Web Services Getting Started 51 Appendix A ∙ DMI Service Method Reference Syntax NOTE • The difference between getDMIData and getDMIData2 is that the latter method returns an object that contains GUI labels and units of measure for returned data. • The difference between getDMIData2 and getDMIData3 is that the latter method returns an object that contains IDs of the column renderers. public adlex.delta.ws.DMIData2 getDMIData2(String appId, String viewId, String dataSourceId, String[] dimensionIds, String[] metricIds, String[][] dimFilters, String[][] metricFilters, String[][] sort, Integer top, String resolution, String timePeriod, Integer numberOfPeriods, Long timeBegin, Long timeEnd, Long timeout) Parameter Type Description appId String Application ID, as returned by getApplications(). viewId String Data view ID, as returned by getDataViews(). dataSourceId String Dimension ID, as returned by getDataSources() or null. dimensionIds String Dimension IDs, as returned by getDimensions(). metricIds String Metric IDs, as returned by getMetrics(). dimFilters array of Strings Array of dimension filters. The array structure is as follows: [0]: dimension ID, as returned by getDimensions() [1]: as per description of filter in the table above [2]: filter negation trigger, if it is present and contains the value “NOT” or “1”. metricFilters array of Strings Array of metric filters. The array structure is as follows: [0]: metric ID, as returned by getMetrics() [1]: operator [2]: value [3]: the filter is applied to results, if it is present and contains the value “RESULT” or “1” sort array of Strings Result sort criteria. The nested array describes filter: [0] - metric or dimension identifier [1] - sort order. Available orders are: “ASC” or null for ascending order, “DESC” for descending order. In the current version, only the first subarray is taken into consideration. top 52 Integer Number of returned table rows. Data Center Real User Monitoring DMI Web Services Getting Started Appendix A ∙ DMI Service Method Reference Parameter Type Description If top is set to 0, all rows will be returned. If top is set to null or <=0, only first 1000 rows will be returned. resolution String Data resolution ID, as returned by getResolutions() timePeriod String Time period covered by the report, as one of the following values: p: 1 period (monitoring interval, dependent on the report server settings) d: 1 day w: 1 week m: 1 month T: today (since midnight) 1P: last period 1H: last hour 1D: last day 7D: last 7 days 30D: last 30 days 3MO: last 3 months 12MO: last 12 months FW: the full week FM: the full month WTD: week to date MTD: month to date QTD: quarter to date YTD: year to date numberOfPeriods Integer Number of periods; if it is set and timeBegin is null, then timePeriod has to be set. timeBegin Long Data coverage begin time, expressed in milliseconds elapsed since January 1, 1970; if it is set, then timePeriod and numberOfPeriods are ignored. timeEnd Long Data coverage begin time, expressed in milliseconds elapsed since January 1, 1970; if it is null, then time of the last processed performance data batch is taken. timeOut Long Timeout value in milliseconds to retrieve data; if timeout <=0, then default DMI timeout value for queries is applied. adlex.delta.ws.DMIData2 public class DMIData2 implements java.io.Serializable { String[] columnHeaders; String[] columnUnit; String columnHeaderName; String[][] formattedData; Double[][] rawData; Boolean timeout; Long TimeoutValue; DMIServiceError [] dmiServiceError; Long timeBegin; Data Center Real User Monitoring DMI Web Services Getting Started 53 Appendix A ∙ DMI Service Method Reference Long timeEnd; } where: columnHeaders A table of dimension and metrics internal IDs. Note that in some cases DMI can limit the list of metrics and dimensions, depending on the data view logic. columnUnit A table of units of measure for returned dimensions and metrics. columnHeaderNamesA table of dimension names and metric names, as they appear in DMI reports on the screen. Note that in some cases DMI can limit the list of metrics and dimensions, depending on data view logic. formattedData A two-dimensional table of formatted data returned by DMI. rawData A two-dimensional table of data returned in the numerical form. Most metrics and some dimensions are numbers (such as time). If something does not have a numeric representation, it is represented as null. timeout A boolean value indicating whether a timeout occurred. timeoutValue A timeout threshold value. dmiServiceError A table of of errors, messages, and warnings returned by DMI. Each position describes the nature of a problem. timeBegin The actual begin time taken by the server. timeEnd The actual end time taken by the server. dmiServiceError public class DMIServiceError { String [] errorDescriptions; protected String [] infoDescriptions; protected String [] warningDescriptions; boolean error; boolean info; boolean warning; } errorDescriptions: A table of error descriptions; it contains values only if error is set to true. warningDescriptions: A table of warning descriptions; it contains values only if warning is set to true. infoDescriptions: A table of info descriptions; it contains values only if info is set to true. error: Indicates the occurrence of a DMI error. warning: Indicates the occurrence of a DMI warning. info: Indicates the occurrence of a DMI info message. Example The method call getDMIData2(appId, viewId, dataSourceId, dimensionIds, metricIds, dimFilters, metricFilters, sort, top, resolution, timePeriod, numberOfPeriods, timeBegin, timeEnd, timeout) returns (using the formattedData method) a result such as: {{"CVENT"}, {"CVCache"}, {"localhost"}, {"begT"}, {"svrDelay"}, {""}, {""}, {""}, {10}, {"r"}, {"1P"}, {""}, {""}, {""}, {30000}} 54 Data Center Real User Monitoring DMI Web Services Getting Started Appendix A ∙ DMI Service Method Reference getDMIData3 Method getDMIData3 is an extension of getDMIData3. Syntax NOTE • The difference between getDMIData and getDMIData2 is that the latter method returns an object that contains GUI labels and units of measure for returned data. • The difference between getDMIData2 and getDMIData3 is that the latter method returns an object that contains IDs of the column renderers. public adlex.delta.ws.DMIData3 getDMIData3(String appId, String viewId, String dataSourceId, String[] dimensionIds, String[] metricIds, String[][] dimFilters, String[][] metricFilters, String[][] sort, Integer top, String resolution, String timePeriod, Integer numberOfPeriods, Long timeBegin, Long timeEnd, Long timeout) Parameter Type Description appId String Application ID, as returned by getApplications(). viewId String Data view ID, as returned by getDataViews(). dataSourceId String Dimension ID, as returned by getDataSources() or null. dimensionIds String Dimension IDs, as returned by getDimensions(). metricIds String Metric IDs, as returned by getMetrics(). dimFilters array of Strings Array of dimension filters. The array structure is as follows: [0]: dimension ID, as returned by getDimensions() [1]: as per description of filter in the table above [2]: filter negation trigger, if it is present and contains the value “NOT” or “1”. metricFilters array of Strings Array of metric filters. The array structure is as follows: [0]: metric ID, as returned by getMetrics() [1]: operator [2]: value [3]: the filter is applied to results, if it is present and contains the value “RESULT” or “1” sort array of Strings Result sort criteria. The nested array describes filter: [0] - metric or dimension identifier [1] - sort order. Available orders are: “ASC” or null for ascending order, “DESC” for descending order. Data Center Real User Monitoring DMI Web Services Getting Started 55 Appendix A ∙ DMI Service Method Reference Parameter Type Description In the current version, only the first subarray is taken into consideration. top Integer Number of returned table rows. If top is set to 0, all rows will be returned. If top is set to null or <=0, only first 1000 rows will be returned. resolution String Data resolution ID, as returned by getResolutions() timePeriod String Time period covered by the report, as one of the following values: p: 1 period (monitoring interval, dependent on the report server settings) d: 1 day w: 1 week m: 1 month T: today (since midnight) 1P: last period 1H: last hour 1D: last day 7D: last 7 days 30D: last 30 days 3MO: last 3 months 12MO: last 12 months FW: the full week FM: the full month WTD: week to date MTD: month to date QTD: quarter to date YTD: year to date numberOfPeriods Integer Number of periods; if it is set and timeBegin is null, then timePeriod has to be set. timeBegin Long Data coverage begin time, expressed in milliseconds elapsed since January 1, 1970; if it is set, then timePeriod and numberOfPeriods are ignored. timeEnd Long Data coverage begin time, expressed in milliseconds elapsed since January 1, 1970; if it is null, then time of the last processed performance data batch is taken. timeOut Long Timeout value in milliseconds to retrieve data; if timeout <=0, then default DMI timeout value for queries is applied. adlex.delta.ws.DMIData3 public class String[] String[] String[] 56 DMIData3 implements java.io.Serializable { columnHeaders; columnUnit; columnHeaderName; Data Center Real User Monitoring DMI Web Services Getting Started Appendix A ∙ DMI Service Method Reference String[] columnRendererId; String[][] formattedData; Double[][] rawData; Boolean timeout; Long TimeoutValue; DMIServiceError [] dmiServiceError; Long timeBegin; Long timeEnd; } where: columnHeaders A table of dimension and metrics internal IDs. Note that in some cases DMI can limit the list of metrics and dimensions, depending on the data view logic. columnUnit A table of units of measure for returned dimensions and metrics. columnHeaderNames A table of dimension names and metric names, as they appear in DMI reports on the screen. Note that in some cases DMI can limit the list of metrics and dimensions, depending on data view logic. columnRendererId A table of renderer identifiers for returned dimensions and metrics. formattedData A two-dimensional table of formatted data returned by DMI. rawData A two-dimensional table of data returned in the numerical form. Most metrics and some dimensions are numbers (such as time). If something does not have a numeric representation, it is represented as null. timeout A boolean value indicating whether a timeout occurred. timeoutValue A timeout threshold value. dmiServiceError A table of of errors, messages, and warnings returned by DMI. Each position describes the nature of a problem. timeBegin The actual begin time taken by the server. timeEnd The actual end time taken by the server. Data Center Real User Monitoring DMI Web Services Getting Started 57 Appendix A ∙ DMI Service Method Reference dmiServiceError public class DMIServiceError { String [] errorDescriptions; protected String [] infoDescriptions; protected String [] warningDescriptions; boolean error; boolean info; boolean warning; } errorDescriptions: A table of error descriptions; it contains values only if error is set to true. warningDescriptions: A table of warning descriptions; it contains values only if warning is set to true. infoDescriptions: A table of info descriptions; it contains values only if info is set to true. error: Indicates the occurrence of a DMI error. warning: Indicates the occurrence of a DMI warning. info: Indicates the occurrence of a DMI info message. Example The method call getDMIData3(appId, viewId, dataSourceId, dimensionIds, metricIds, dimFilters, metricFilters, sort, top, resolution, timePeriod, numberOfPeriods, timeBegin, timeEnd, timeout) returns (using the formattedData method) a result such as: {{"CVENT"}, {"CVCache"}, {"localhost"}, {"begT"}, {"svrDelay"}, {""}, {""}, {""}, {10}, {"r"}, {"1P"}, {""}, {""}, {""}, {30000}} getLastSampleTime The method getLastSampleTime returns a time stamp of the last performance data batch processed by the report server, in milliseconds elapsed since January 1, 1970. public long getLastSampleTime(String appId, String viewId, String resolution) Parameter Type Description appId String Application ID, as returned by getApplications(). viewId String Data view ID, as returned by getDataViews(). resolution String Data resolution ID, as returned by getResolutions(). getMetrics The method getMetrics returns a list of metrics as an array of arrays of Strings. public String[][] getMetrics(String appId, String viewId, String resolution) The nested array describes a metric: [0]: Internal identifier of a metric. [1]: User-readable name of a metric. Used for presentation in DMI. 58 Data Center Real User Monitoring DMI Web Services Getting Started Appendix A ∙ DMI Service Method Reference [2]: Unit of a metric. For example, B or %. [3]: Type of a metric. For example, BYTE or PERCENT. Type Type Description appId String Application ID, as returned by getApplications(). viewId String Data view ID, as returned by getDataViews(). resolution String Data resolution ID, as returned by getResolutions(). Example The method call getMetrics("CVENT", "ClientView", "1D") returns a result such as: {{"C_BYTES","Client Bytes",B,BYTE}, {"S_BYTES","Server bytes",B,BYTE}, …}. getResolutions The method getResolutions returns a list of identifiers of available resolutions as an array of Strings. public String[] getResolutions(String appId, String viewId) Resolution IDs are identical to those used for definitions in dmi_dataview-*.properties files. Parameter Type Description appId String Application ID, as returned by getApplications(). viewId String Data view ID, as returned by getDataViews(). Example The method call getResolutions("CVENT", "ClientView") returns a result such as: {"r", "1", "6"}. getServerUUID The method getServerUUID returns the Universal Unique Identifier (UUID) of the report server. public String getServerUUID() Example The method call getServerUUID() returns a result string, for example, such as: "12ac5ec3-437d-4383-8055-bef7c5a104df" Data Center Real User Monitoring DMI Web Services Getting Started 59 Appendix A ∙ DMI Service Method Reference 60 Data Center Real User Monitoring DMI Web Services Getting Started Index Index A G Apache Axis 9, 28 prerequisite 28 reference 9 GET 23 getApplications 12, 46 getCurrentTime 46 getDataSources 47 getDataViews 13, 47 getDimensions 15, 47 getDimensionValues 48 getDMIData 16, 48 getDMIData2 16, 51 getDMIData3 16, 55 getLastSampleTime 58 getMetrics 16, 58 getResolutions 14, 59 getServerUUID 59 C contact information 6 Customer Support 6 D DataServerList 28 DataServerListWL 28 dmiquery 11 DMIService 28–29 DMIServiceWL 28 E example 12–16, 31, 36 getApplications 12 getDataViews 13, 31 getDimensions 15 getDMIData 16, 31 getDMIData2 16 getDMIData3 16 getMetrics 16 getResolutions 14, 31 getServerUUID 31 Java 31 JSP 36 showErrors 31 showResults 31 H HTTP methods 23 GET 23 POST 23 J Java environment 28 M method 12–16, 46–48, 51, 55, 58–59 getApplications 12, 46 getCurrentTime 46 getDataSources 47 getDataViews 13, 47 getDimensions 15, 47 getDimensionValues 48 getDMIData 16, 48 getDMIData2 16, 51 getDMIData3 16, 55 Data Center Real User Monitoring DMI Web Services Getting Started 61 Index method (continued) getLastSampleTime 58 getMetrics 16, 58 getResolutions 14, 59 getServerUUID 59 O REST (continued) HTTP authorization 24 HTTP response codes 23 introduction 11 POST 23 principles 24 service name 11 online support site 6 S P SOAP 9, 27–28 envelopes 28 in web services architecture 27 specification 9 parameter 12–16, 46–48, 51, 55, 58–59 appId 12–16, 46–48, 51, 55, 58–59 dataSourceId 48, 51, 55 dimensionIds 48, 51, 55 dimFilters 48, 51, 55 dimId 48 filter 48 metricFilters 48, 51, 55 metricIds 48, 51, 55 numberOfPeriods 48, 51, 55 quantity 48 resolution 15–16, 46–48, 51, 55, 58 sort 48, 51, 55 timeBegin 48, 51, 55 timeEnd 48, 51, 55 timeOut 48, 51, 55 timePeriod 48, 51, 55 top 48, 51, 55 viewId 13–16, 46–48, 51, 55, 58–59 POST 23 R REST 11–16, 22–24 developer tools and tips 22 dmiquery 11 examples 12–16 GET 23 getApplications example 12 getDataViews example 13 getDimensions example 15 getDMIData example 16 getDMIData2 example 16 getDMIData3 example 16 getMetrics example 16 getResolutions example 14 62 V Version 28 W web services 27–29, 36 DataServerList 28 DataServerListWL 28 DC RUM architecture 27 DMIService 28–29 DMIServiceWL 28 JSP 36 obtaining WSDL 29 Version 28 Web services 9, 28, 30–31, 34–36, 45 data integration 35 diagnostics 34 generating stubs 30 getting data using loop 36 Java 31 method reference 45 software prerequisites 28 testing 35 usage 34 using in your application 31 WSDL 9, 29–30 generating stubs from 30 obtaining for web services 29 specification 9 Data Center Real User Monitoring DMI Web Services Getting Started