Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Data source plugin for Lifeguard that generates random numbers.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 apps
Octocat-spinner-32 rel
Octocat-spinner-32 .gitignore
Octocat-spinner-32 Makefile
Octocat-spinner-32 README.md
Octocat-spinner-32 rebar
Octocat-spinner-32 rebar.config
README.md

Lifeguard Random Data Source

This is an example of a plugin for Lifeguard that implements a data source. The data source in this example simply generates random numbers.

Installation

To install the plugin, compile it and generate the release folder:

$ make deps
$ make rel

There will now be a folder rel/lifeguard_random. Copy this folder into your Lifeguard plugin directory and add lifeguard_random to the list of enabled plugins for Lifeguard. That's it!

Usage

Once the plugin is installed, you can use the random data source with your watches. To do this, enable the plugin and add a new data source to your sys.config file. Example:

{data_sources, [
    {"random", lifeguard_ds_random, []}
  ]},
{plugins, [lifeguard_random]}

Then, you can query it like this from a watch:

// Get one random number (in an array)
var data = Lifeguard.get("random");

// Get 10 random numbers
var data = Lifeguard.get("random", 10);
Something went wrong with that request. Please try again.