Plugin API - Linux2Go/Surveilr GitHub Wiki

The plugin API (brewing here: https://code.launchpad.net/~soren/surveilr/plugins) is as follows:

A data point is sent to Surveilr:

{ 'timestamp': 13217362355575,
  'metrics': { 'duration': 85000,
               'response_size': 12435 }}

After getting accepted into Surveilr, it gets sent to plugins like so:

{ 'timestamp': 13217362355575,
  'service_id': 'NUD2opa92uFD9JaFefXktCxzEUW',
  'user_id': 'DYRKd63MjksWEy844DDfFkspwez',
  'metrics': { 'duration': 85000,
               'response_size': 12435 },
  'saved_state': <whatever> }

The plugin does something to the data and returns a simple JSON object:

{ 'state': <whatever> }

This new state will overwrite the existing saved_state.

In the near future, this will be extended to let the plugin

  • raise alerts (e.g. "Anomaly detected") which will typically result in an SMS being sent to the user, and
  • provide predictions for the service (e.g. "if the current trend holds, service failure is expected in 272 days").

A good structure for this data needs to be sorted out first.

⚠️ **GitHub.com Fallback** ⚠️