Vitality queries for checking server health

Use MobileFirst vitality queries to run a health check of your server, and determine the vitality status of your server.

You generally use the MobileFirst vitality queries from a load balancer or from a monitoring app (for example, Patrol).

You can run vitality queries for the server as a whole, for a specific adapter, for a specific app, or for a combination of. The following table shows some examples of vitality queries.

Table 1. Examples of queries that help determine server vitality
Query Purpose
http://<server>:<port>/<publicWorkLightContext>/ws/rest/vitality Checks the server as a whole.
http://<server>:<port>/<publicWorkLightContext>/ws/rest/vitality?app=MyApp Checks the server and the MyApp application.
http://<server>:<port>/<publicWorkLightContext>/ws/rest/vitality?app=MyApp&adapter=MyAdapter Checks the server, the MyApp application, and the MyAdapter adapter.
Note: Do not include the /<publicWorkLightContext> part of the URL if you use IBM MobileFirst™ Platform Foundation Developer Edition. You must add this part of the URL only if MobileFirst Server is running on another application server, such as Apache Tomcat or WebSphere® Application Server (full profile or Liberty profile).

Vitality queries return an XML content that contains a series of <ALERT> tags, one for each test.

Example query and response

By running the http://<server>:<port>/ws/rest/vitality?app=MyApp query, you might have the following successful response, with an <ALERT> tag for each of the three tests:

<ROOT>
  <ALERT>
    <DATE> 2011-05-17T15:31:35.583+0300 </DATE>
    <EVENTID>0</EVENTID>
    <SUBJECT>SRV</SUBJECT>
    <TYPE>I</TYPE>
    <COMPUTER>worklight.acme.com</COMPUTER>
    <DESCRIPTION>Server is running</DESCRIPTION>
  </ALERT>
  <ALERT>
    <DATE> 2011-05-17T15:31:35.640+0300 </DATE>
    <EVENTID>0</EVENTID>
    <SUBJECT>APPL</SUBJECT>
    <TYPE>I</TYPE>
    <COMPUTER>worklight.acme.com</COMPUTER>
    <DESCRIPTION>Application ‘MyApp' is deployed</DESCRIPTION>
  </ALERT>
  <ALERT>
    <DATE>2014-07-08T11:39:42.622+0300</DATE>
    <EVENTID>0</EVENTID>
    <SYSTEM>WRKL</SYSTEM>
    <SUBJECT>BUILD</SUBJECT>
    <COMPUTER>192.168.218.1</COMPUTER>
    <DESCRIPTION>6.2.0.00.20140707-1736</DESCRIPTION>
  </ALERT>
</ROOT>

Return values

The following table lists the attributes that might be returned, and their possible values.

Table 2. Return values and values
Return attribute Possible values
DATE Date value in JavaScript™ format
EVENTID 0 for the running server, deployed adapter, or deployed application

1 for not deployed adapter

2 for not deployed application

3 for malfunctioning server

SUBJECT SRV for MobileFirst Server

ADPT for adapter

APPL for application

BUILD for the version of the MobileFirst Server

TYPE

I – valid

E – error

COMPUTER Reporting computer name
DESCRIPTION Status description in plain text

The returning XML contains more attributes, which are undocumented constants that you must not use.