Page tree
Skip to end of metadata
Go to start of metadata

For those of you who wants to include information provided by MoSKito Control in other tools (like iphone or android applications for example), there is a rest api, that can be used to get the data.

Currently the api is extremely easy and straight forward, it has two calls.

 

Control

The control call returns all data MoSKito Control has. 

URL: http://server : port/moskito-control/rest/control

This is how the reply looks like:

{
   "protocolVersion":1,
   "currentServerTimestamp":1371450961758,
   "applications":[
      {
         "name":"SecondApp",
         "applicationColor":"GREEN",
         "components":[

         ]
      },
      {
         "name":"FirstApp",
         "applicationColor":"PURPLE",
         "components":[
            {
               "name":"localhost",
               "category":"web",
               "color":"ORANGE",
               "messages":[
                  "Configured-5m-ThreadCount: 60"
               ],
               "lastUpdateTimestamp":1371450953474,
               "ISO8601Timestamp":"2013-06-17T08:35:53,474"
            },
            {
               "name":"server04",
               "category":"web",
               "color":"ORANGE",
               "messages":[
                  "Configured-5m-ThreadCount: 60"
               ],
               "lastUpdateTimestamp":1371450953475,
               "ISO8601Timestamp":"2013-06-17T08:35:53,475"
            },
            {
               "name":"serverXYZ",
               "category":"web",
               "color":"PURPLE",
               "messages":[
                  "Can't connect to the FirstApp.serverXYZ @ 2013-06-17T08:35:53,474"
               ],
               "lastUpdateTimestamp":1371450953474,
               "ISO8601Timestamp":"2013-06-17T08:35:53,474"
            }
         ]
      }
   ]
}

 

What the fields mean:

  • protocolVersion - this is a version of the protocol, which will increase once the protocol is changed, so your parser can react to it.
  • applications - list of the configured applications and their states.
  • currentServerTimestamp - timestamp the reply is generated at

 

 

 

 

  For each applications following fields/attributes are transmitted:

  • name - name of the application.
  • applicationColor - the overall state of the application, the same state control shows in the top bar.

  • components - list of components.

 

For each component following fields/attributes are transmitted:

  • name - components name.
  • category - category of the component (web, biz, app, whatever).
  • color - the state of this component.
  • lastUpdateTimestamp - the timestamp when control could update the state of this component last time.
  • ISO8601Timestamp - same as lastUpdateTimestamp in human-readable-iso8601-compatible style.
  • messages - messages by the component, which can include states of all thresholds in the current component state.

 

History

The history call returns the history for the changes in the application state for a given application.

URL: http://server : port/moskito-control/rest/history/<appname>

This is how the reply looks like:

{
   "protocolVersion":1,
   "currentServerTimestamp":1371451723506,
   "historyItems":[
      {
         "timestamp":1371450633390,
         "isoTimestamp":"2013-06-17T08:30:33,390",
         "oldStatus":"GREEN",
         "newStatus":"ORANGE",
         "componentName":"server04",
         "oldMessages":[

         ],
         "newMessages":[
            "Configured-5m-ThreadCount: 61"
         ]
      },
      {
         "timestamp":1371450633390,
         "isoTimestamp":"2013-06-17T08:30:33,390",
         "oldStatus":"GREEN",
         "newStatus":"ORANGE",
         "componentName":"localhost",
         "oldMessages":[

         ],
         "newMessages":[
            "Configured-5m-ThreadCount: 61"
         ]
      },
      {
         "timestamp":1371450603383,
         "isoTimestamp":"2013-06-17T08:30:03,383",
         "oldStatus":"RED",
         "newStatus":"GREEN",
         "componentName":"localhost",
         "oldMessages":[
            "Configured-5m-ThreadCount: 60"
         ],
         "newMessages":[

         ]
      },
      {
         "timestamp":1371450603382,
         "isoTimestamp":"2013-06-17T08:30:03,382",
         "oldStatus":"RED",
         "newStatus":"GREEN",
         "componentName":"server04",
         "oldMessages":[
            "Configured-5m-ThreadCount: 60"
         ],
         "newMessages":[

         ]
      },
      {
         "timestamp":1371377169544,
         "isoTimestamp":"2013-06-16T12:06:09,544",
         "oldStatus":"NONE",
         "newStatus":"RED",
         "componentName":"server04",
         "oldMessages":[
            "None yet"
         ],
         "newMessages":[
            "Configured-5m-ThreadCount: 60"
         ]
      },
      {
         "timestamp":1371377169543,
         "isoTimestamp":"2013-06-16T12:06:09,543",
         "oldStatus":"NONE",
         "newStatus":"RED",
         "componentName":"localhost",
         "oldMessages":[
            "None yet"
         ],
         "newMessages":[
            "Configured-5m-ThreadCount: 60"
         ]
      },
      {
         "timestamp":1371377169530,
         "isoTimestamp":"2013-06-16T12:06:09,530",
         "oldStatus":"NONE",
         "newStatus":"PURPLE",
         "componentName":"serverXYZ",
         "oldMessages":[
            "None yet"
         ],
         "newMessages":[
            "Can't connect to the FirstApp.serverXYZ @ 2013-06-16T12:06:09,530"
         ]
      }
   ],
   "applicationName":"FirstApp"
}

 

What the fields mean:

  • protocolVersion - this is a version of the protocol, which will increase once the protocol is changed, so your parser can react to it.
  • applicationName - name of the application (in case you forgot(wink)
  • currentServerTimestamp - timestamp the reply is generated at
  • historyItems - list of history entries - which are basically state changes.

For each item in historyItems: 

  • timestamp - the timestamp when this history item has been added.
  • isoTimestamp - same as timestamp in human-readable-iso8601-compatible style.
  • oldStatus - status before the change 
  • newStatus - status after the change
  • componentName - name of the component
  • oldMessages - messages before the state change(string array).
  • newMessages - messages after the state change (string array).


Charts

There are two methods to retrieve chart data, by lines and by points. The background is, that different chart engines take different approaches how they draw and need according data structures. Theoretically it's possible to make recalculations from line to point and vice versa on the end client, but we wanted to save cpu and battery time, and therefore offer two different ways to get the data.


Points

URL: http://server : port/moskito-control/rest/charts/points/<appname>

produces following reply:

{
  "protocolVersion": 1,
  "currentServerTimestamp": 1378107977595,
  "charts": [
    {
        "name": "Sessions",
        "points": [Point],
        "lineNames": [
           "FirstLineName",
           "SecondLineName",
           ....
        ]
    },
    //next chart.
},


where each Point is build up from following structure:

"caption": "caption as string",
"values": ["value as string for each line one value"],
"timestamp": timestamp as long
 



Lines

 

URL: http://server : port/moskito-control/rest/charts/lines/<appname>

 

produces following reply:

{
  "protocolVersion": 1,
  "currentServerTimestamp": 1378107977595,
  "charts": [
  {
    "name": "Sessions 50",
    "lines": [
      {
        "lineName": "SessionCount Cur Absolute@server04",
        "values": [
          "17",
          "16",
          "16",
        ]
      },
      {
        "lineName": "SessionCount Cur anotherserver",
        "values": [
          "15",
          "23",
          "23",
        ]
      },

     //next line
    ],
    "captions": [
      "07:48",
      "07:49",
      "07:50",
    ],
    "timestamps": [
       1379310483643,
       1379310543643,
       1379310603643,
    ]
  },
//... next chart


The internal data structure is built up like this:

"charts": [Chart]

where each Chart element contains of following attributes

    "name": "Name of the chart",
    "lines": [Line]
    "captions": ["Caption as String"]
    "timestamps": [timestamp as long]

and finally a Line:

"lineName": "Line name as String",
"values": ["value - number as String"]

And the attributes mean following: 

  • name - name of the chart that is also a caption on the chart.
  • captions - list of caption for x-points.
  • timestamps - timestamps for the x points, that are source of the captions.
  • values - list of y points for each line.
  • lineName - name of the line.

 

Status

The status call is used to provide information about the internal status of the application and is used for debug purposes. It can be changed without further notice. 

URL: http://server : port/moskito-control/rest/status

  • No labels