AppInternals Xpert REST API

Authors:

Matthew Hill

 

More details:

AppInternals REST API

The AppInternals Xpert Web Services API is designed to make it easy to bring external data into the product. The API uses a REST interface. Simple GET and POST requests to a URL will register metric types and update metric values. Using this REST API, it is possible to create simple scripts in any programming language that automatically feed data into AppInternals Xpert.  This interface also hosts its own web interface for browsing and configuring the data adapter interactively.

Using the web service only requires using two services. /config/newmetrictype and /put
Before pushing any metric values, you must first define the metric type using the /config/newmetrictype service. This will automatically create the DA for you if it does not already exist. Typically, the /config/newmetrictype service is used at the beginning of your program code to register each metric type that you will need.

Once the metric type is defined, you can regularly update the values for the metrics using the /put service. This service can be called as frequently as you like (whenever you have data that you would like to update). Once per second is the maximum granularity supported by AppInternals Xpert. Your code should generally have a loop that continues indefinitely that collects the data and then sends it to the AppInternals Web Services API using the /put/ service.

 

Hello World Example Code (Python)

    # The purpose of the DA is to create a single metric and update its value import urllib         # Register the metric type '/hello' for the DA 'DA-HelloWorld'     # Typically these metric type registrations are called once on program startup     response = urllib.urlopen('http://localhost:4433/config/newmetrictype/?da_id=DA-HelloWorld&path=/hello&display_name=Hello+World&description=Simple+Metric+Demonstration&units=Units&datatype=Value')         if (response.getcode() != 200):         raise Exception(""Error registering metricType with AppInternals.\n\tError Message: "" + response.read())         # Update the value of '/hello' for the DA 'DA-HelloWorld' with a value of 42.0     # These metric value updates are typically called repeatedly at short intervals (e.g. every 3 seconds)     response = urllib.urlopen('http://localhost:4433/put/hello?da_id=DA-HelloWorld&value=42.0')         if (response.getcode() != 200):         raise Exception(""Error sending metric value to AppInternals.\n\tError Message: "" + response.read())         print ""Hello world!  Everything worked! we now have a new DA (DA-HelloWorld) with a new metric (/hello) set to a value of 42.0""

 

Installation Steps:

  1. Download the attached .jar file
  2. Copy the jar file into your DSA bin directory.  On windows, this is usually: C:\Panorama\hedzup\mn\bin
  3. Start the web service by typing ""java -jar restda.jar""
  4. Login to the web service.  The default location is http://localhost:4433

Documentation and tutorials are embedded within the web service.  You will find them once you login.