Module: NSOne::API::Stats

Defined in:
lib/nsone/api/stats.rb

Instance Method Summary collapse

Instance Method Details

#network_usage(params = {}) ⇒ NSOne::Response

Returns statistics and graphs on ‘NSOne Network` level (Managed/Dedicated)

Parameters:

  • params (Hash) (defaults to: {})

    will be used as the request body

Options Hash (params):

  • :period (String)

    one of ‘1h`, `24h`, or `30d`

    Default: 24h

  • :expand (Boolean)

    if ‘true` breaks down stats by zone.

    Default: ‘false`

  • :aggregate (Boolean)

    if ‘true` returns aggregated stats across all zones and billing tiers

    Default: ‘false`

Returns:



88
89
90
# File 'lib/nsone/api/stats.rb', line 88

def network_usage(params = {})
  perform_request(HTTP_GET, "/v1/stats/network/usage", params)
end

#qpsNSOne::Response

Returns current queries per second (QPS) for the account

Returns:



12
13
14
# File 'lib/nsone/api/stats.rb', line 12

def qps()
  perform_request(HTTP_GET, "/v1/stats/qps")
end

#record_qps(zone, domain, type) ⇒ NSOne::Response

Returns current queries per second (QPS) for a specific record

Parameters:

  • zone (String)

    zone name

  • domain (String)

    record name

  • type (String)

    record type (A, CNAME etc)

Returns:

Raises:



38
39
40
41
42
43
44
# File 'lib/nsone/api/stats.rb', line 38

def record_qps(zone, domain, type)
  raise NSOne::MissingParameter, "zone cannot be blank" if blank?(zone)
  raise NSOne::MissingParameter, "domain cannot be blank" if blank?(domain)
  raise NSOne::MissingParameter, "type cannot be blank" if blank?(type)
  normalize_names!(zone, domain)
  perform_request(HTTP_GET, "/v1/stats/qps/#{zone}/#{domain}/#{type}")
end

#record_usage(zone, domain, type, params = {}) ⇒ NSOne::Response

Returns statistics and graphs for a given record over a given period

Parameters:

  • params (Hash) (defaults to: {})

    will be used as the request body

  • zone (String)

    zone name

  • domain (String)

    record name

  • type (String)

    record type (A, CNAME etc)

Options Hash (params):

  • :period (String)

    one of ‘1h`, `24h`, or `30d`

    Default: 24h

  • :expand (Boolean)

    if ‘true` breaks down stats by zone.

    Default: ‘false`

  • :aggregate (Boolean)

    if ‘true` returns aggregated stats across all zones and billing tiers

    Default: ‘false`

Returns:

Raises:



164
165
166
167
168
169
170
# File 'lib/nsone/api/stats.rb', line 164

def record_usage(zone, domain, type, params = {})
  raise NSOne::MissingParameter, "zone cannot be blank" if blank?(zone)
  raise NSOne::MissingParameter, "domain cannot be blank" if blank?(domain)
  raise NSOne::MissingParameter, "type cannot be blank" if blank?(type)
  normalize_names!(zone, domain)
  perform_request(HTTP_GET, "/v1/stats/usage/#{zone}/#{domain}/#{type}", params)
end

#region_usage(params = {}) ⇒ NSOne::Response

Returns total usage (Queries) during ‘:period` per region/Geo-Location. At the moment NSOne API return the following areas: Europe, North America, Oceania, Africa, Asia

Parameters:

  • params (Hash) (defaults to: {})

    will be used as the request body

Options Hash (params):

  • :period (String)

    one of ‘1h`, `24h`, or `30d`

    Default: 24h

  • :expand (Boolean)

    if ‘true` breaks down stats by zone.

    Default: ‘false`

  • :aggregate (Boolean)

    if ‘true` returns aggregated stats across all zones and billing tiers

    Default: ‘false`

Returns:



112
113
114
# File 'lib/nsone/api/stats.rb', line 112

def region_usage(params = {})
  perform_request(HTTP_GET, "/v1/stats/region/usage", params)
end

#usage(params = {}) ⇒ NSOne::Response

Returns statistics and graphs for the entire account over a given period

Parameters:

  • params (Hash) (defaults to: {})

    will be used as the request body

Options Hash (params):

  • :period (String)

    one of ‘1h`, `24h`, or `30d`

    Default: 24h

  • :expand (Boolean)

    if ‘true` breaks down stats by zone.

    Default: ‘false`

  • :aggregate (Boolean)

    if ‘true` returns aggregated stats across all zones and billing tiers

    Default: ‘false`

Returns:



65
66
67
# File 'lib/nsone/api/stats.rb', line 65

def usage(params = {})
  perform_request(HTTP_GET, "/v1/stats/usage", params)
end

#zone_qps(zone) ⇒ NSOne::Response

Returns current queries per second (QPS) for a specific zone

Parameters:

  • zone (<Type>)

    <description>

Returns:

Raises:



23
24
25
26
27
# File 'lib/nsone/api/stats.rb', line 23

def zone_qps(zone)
  raise NSOne::MissingParameter, "zone cannot be blank" if blank?(zone)
  normalize_names!(zone)
  perform_request(HTTP_GET, "/v1/stats/qps/#{zone}")
end

#zone_usage(zone, params = {}) ⇒ NSOne::Response

Returns statistics and graphs for a given zone over a given period

Parameters:

  • params (Hash) (defaults to: {})

    will be used as the request body

  • zone (String)

    NSOne zone name

Options Hash (params):

  • :period (String)

    one of ‘1h`, `24h`, or `30d`

    Default: 24h

  • :expand (Boolean)

    if ‘true` breaks down stats by zone.

    Default: ‘false`

  • :aggregate (Boolean)

    if ‘true` returns aggregated stats across all zones and billing tiers

    Default: ‘false`

Returns:

Raises:



136
137
138
139
140
# File 'lib/nsone/api/stats.rb', line 136

def zone_usage(zone, params = {})
  raise NSOne::MissingParameter, "zone cannot be blank" if blank?(zone)
  normalize_names!(zone)
  perform_request(HTTP_GET, "/v1/stats/usage/#{zone}", params)
end