updown v0.1.1 Updown.Checks

Provides functions for retrieving information about checks

Summary

Functions

Retrieves the downtimes for a given check with the specified token

Retrieves a list of all current checks

Retrieves the metrics for a check with the specified token. For the input time, a DateTime struct may be used or a binary in the format “yyyy-mm-dd hh-mm-ss”

Retrieves a single check with the specified token

Functions

get_downtimes(token, page \\ 1)

Specs

get_downtimes(binary, integer) :: [%Updown.Downtime{duration: term, ended_at: term, error: term, started_at: term}]
Retrieves the downtimes for a given check with the specified token

## Examples

    iex> Updown.Checks.get_downtimes("rrrr")
    [%Updown.Downtime{...}, %Updown.Downtime{...}]
    iex> Updown.Checks.get_downtimes("oooo", 4)
    [] # <-- if no downtimes on specified page
get_list()

Specs

get_list :: [%Updown.Check{alias: term, apdex_t: term, down: term, down_since: term, enabled: term, error: term, favicon_url: term, last_check_at: term, last_status: term, next_check_at: term, period: term, published: term, ssl: term, string_match: term, token: term, uptime: term, url: term}]
Retrieves a list of all current checks.

## Examples

    iex> Updown.Checks.get_list
    [%Updown.Check{...}, %Updown.Check{...}] # <-- if you have two checks
    iex> Updown.Checks.get_list 
    [] # <-- if you have no checks
get_metrics(token, options \\ [])

Specs

get_metrics(binary, list) :: struct
Retrieves the metrics for a check with the specified token. For the input time, a DateTime struct may be used or a binary in the format "yyyy-mm-dd hh-mm-ss"


Available options are:
    :from (binary or DateTime)
    :to (binary or DateTime)
    :group (binary) #can group by "time" or "host"

## Examples

    iex> Updown.Checks.get_metrics("qqqq")
    %Updown.Metric{...} # <-- if token exists in your list of checks
    from = %DateTime{calendar: Calendar.ISO, day: 25, hour: 13, microsecond: {868569, 6}, minute: 26, month: 5, second: 8, std_offset: 0, time_zone: "Etc/UTC", utc_offset: 0, year: 2016, zone_abbr: "UTC"}
    iex> Updown.Checks.get_metrics("oooo", from: from, to: DateTime.utc_now, group: "host")
    {host, %Updown.Metric{...}, host, %Updown.Metric{...}, ...}
    iex> Updown.Checks.get_metrics("qqqq", from: "2016-06-15 13:37:23")
    %Updown.Metric{...}
get_token(token)

Specs

get_token(binary) :: %Updown.Check{alias: term, apdex_t: term, down: term, down_since: term, enabled: term, error: term, favicon_url: term, last_check_at: term, last_status: term, next_check_at: term, period: term, published: term, ssl: term, string_match: term, token: term, uptime: term, url: term}
Retrieves a single check with the specified token

## Examples

    iex> Updown.Checks.get_token("qqqq")
    %Updown.Checks{...}
    iex> Updown.Checks.get_token("rrrr")
    %Updown.Checks{...}