API Monitoring

From AlertFox Website Monitoring

Jump to: navigation, search

Contents

API and web services (cloud) monitoring

AlertFox API and web services (cloud) monitoring checks the availability and performance of APIs and web services. Using the AlertFox scripting technology the full flow of almost all APIs can be simulated and replayed periodically, from our global monitoring stations.

When you offer or rely on an API it's essential to monitor it as it's not easy to tell if an API is down or experiencing problems. With API and web services (cloud) monitoring rapidly identifies any performance issues and provides assurance that your API is smoothly delivering your product or service.

In addition to informing you about your API performance, AlertFox monitoring can keep your clients informed. If you publish your API and web services (cloud) monitoring results via a Public Status Dashboard you'll not only satisfy clients' growing demand for greater transparency, you'll also save resources as, rather than contacting your support team to get an update on the status of your service, your clients can simply refer to your dashboard to obtain information about its uptime and performance.

For a simple Representational State Transfer (REST) API, a regular HTTP Sensor (http/https) will check a specific URL and the XML or JSON data object that is returned. Using these regular monitors you can check for the absence or presence of a certain strings to identify errors in simple single call APIs.

For more complex interaction patterns, an iMacros ‘script’ monitor allows multi-step transaction monitoring and provides confirmation of more complex API responses. Scripts can also remember the state by either cookies or other mechanisms.

Which protocols and features do you support?

AlertFox API and web services (cloud) monitoring supports all types of APIs including: REST, SOAP, oAuth, JSON, XML, RSS feeds, openID and XML-RPC. We have yet to find an API we cannot monitor!

REST Examples

Consuming RESTful HTTP/XML APIs With AlertFox Sensors

The sensor requests data from an HTTP or HTTPS URL (using GET), parses the XML results and uses selected data from the XML as sensor value in AlertFox. With this technique you can import data from many APIs into AlertFox, as long as they are offering an interface that works with simple HTTP GETs and replies with XML data. Services like these are often called “REST APIs or RESTful APIs”. This type of API is becoming more and more common.

The main application we see for this is sensor is to

  • Monitor your own APIs for uptime and performance

But you can also use other public API as input:

  • Monitor current weather conditions using Google.com (see example below), Wheatherbug.com, and www.weather.com, in order to control our datacenter cooling system by tracking outside and inside temperatures.
  • Monitor the ranking of your domain on Compete.com

The only tricky part about this sensor is to supply the necessary URL parameters for the sensor. It requires a good knowledge of the API and the XML output.


Monitoring Outdoor Temperatures using Free Data from iGoogle

Using the following URL you can get weather data from Google (it seems to be a part of iGoogle):

 http://www.google.com/ig/api?weather=Portland

It returns date like this:

 <?xml version="1.0"?>
 -<xml_api_reply version="1">-<weather section="0" row="0" mobile_zipped="1" mobile_row="0" tab_id="0" module_id="0">
 -<forecast_information>
     <city data="Portland, OR"/>
      <postal_code data="portland"/>
      <latitude_e6 data=""/><longitude_e6 data=""/>
      <forecast_date data="2011-05-22
   ...


You can now use the keyword feature of our HTTP Sensor to verify that the API returns the correct data. In that example, you can for example check for the word "portland" in the response. => See the RESTful API (iGoogle) sensor in our demo account.

As you have seen a classic sensor is normally sufficient for monitoring REST APIs, but you can use the browser based iMacros sensors if you want to monitor (script) more complex test patterns:

 URL GOTO=http://www.google.com/ig/api?weather=portland
 TAG POS=1 TYPE=SPAN ATTR=TXT:Portland,<SP>OR
Monitoring RESTful API with a web browser.

This macro checks for the word portland in the response (run in iMacros Browser or Internet Explorer, iMacros for Firefox does not yet support working with XML responses).

Alternatively you can use iMacros's relative positioning to check (extract) exactly a specific attribute of the response:

 URL GOTO=http://www.google.com/ig/api?weather=portland
 TAG POS=1 TYPE=SPAN ATTR=TXT:*city*
 TAG POS=R2 TYPE=SPAN ATTR=TXT:* EXTRACT=TXT
Check a specific attribute of the XML response with Internet Explorer.

Display a list of invoices

REST Result:

   <?xml version="1.0" encoding="UTF-8" ?> 
 - <INVOICEList xmlns:xlink="http://www.w3.org/1999/xlink">
   <INVOICE xlink:href="http://www.thomas-bayer.com/sqlrest/INVOICE/37/">37</INVOICE> 
   <INVOICE xlink:href="http://www.thomas-bayer.com/sqlrest/INVOICE/52/">52</INVOICE> 
   <INVOICE xlink:href="http://www.thomas-bayer.com/sqlrest/INVOICE/99/">99</INVOICE> 
   </INVOICEList>

Thus the keyword for your "REST Sensor" (based on the AlertFox HTTP Sensor) can be for example the word INVOICE or 99 (if you want to check for a certain invoice.

See Also

Creating checks for all types of APIs is part of our free macro creation service.

Personal tools
home
Toolbox

Website Monitoring