module NSOne::API::Stats

Public Instance Methods

network_usage(params = {}) click to toggle source

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

@param [Hash] params will be used as the request body

@option params [String] :period one of `1h`, `24h`, or `30d`

Default: 24h

@option params [Boolean] :expand if `true` breaks down stats by zone.

Default: `false`

@option params [Boolean] :aggregate if `true` returns aggregated stats across all zones and billing tiers

Default: `false`

@return [NSOne::Response]

# File lib/nsone/api/stats.rb, line 150
def network_usage(params = {})
  perform_request(HTTP_GET, "/stats/network/usage", params)
end
qps() click to toggle source

Returns current queries per second (QPS) for the account

@return [NSOne::Response]

# File lib/nsone/api/stats.rb, line 12
def qps()
  perform_request(HTTP_GET, "/stats/qps")
end
record_qps(zone, domain, type) click to toggle source

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

@param [String] zone zone name @param [String] domain record name @param [String] type record type (A, CNAME etc)

@return [NSOne::Response]

# File lib/nsone/api/stats.rb, line 40
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, "/stats/qps/#{zone}/#{domain}/#{type}")
end
record_usage(zone, domain, type, params = {}) click to toggle source

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

@param [Hash] params will be used as the request body @param [String] zone zone name @param [String] domain record name @param [String] type record type (A, CNAME etc)

@option params [String] :period one of `1h`, `24h`, or `30d`

Default: 24h

@option params [Boolean] :expand if `true` breaks down stats by zone.

Default: `false`

@option params [Boolean] :aggregate if `true` returns aggregated stats across all zones and billing tiers

Default: `false`

@return [NSOne::Response]

# File lib/nsone/api/stats.rb, line 122
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, "/stats/usage/#{zone}/#{domain}/#{type}", params)
end
region_usage(params = {}) click to toggle source

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

@param [Hash] params will be used as the request body

@option params [String] :period one of `1h`, `24h`, or `30d`

Default: 24h

@option params [Boolean] :expand if `true` breaks down stats by zone.

Default: `false`

@option params [Boolean] :aggregate if `true` returns aggregated stats across all zones and billing tiers

Default: `false`

@return [NSOne::Response]

# File lib/nsone/api/stats.rb, line 175
def region_usage(params = {})
  perform_request(HTTP_GET, "/stats/region/usage", params)
end
usage(params = {}) click to toggle source

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

@param [Hash] params will be used as the request body

@option params [String] :period one of `1h`, `24h`, or `30d`

Default: 24h

@option params [Boolean] :expand if `true` breaks down stats by zone.

Default: `false`

@option params [Boolean] :aggregate if `true` returns aggregated stats across all zones and billing tiers

Default: `false`

@return [NSOne::Response]

# File lib/nsone/api/stats.rb, line 68
def usage(params = {})
  perform_request(HTTP_GET, "/stats/usage", params)
end
zone_qps(zone) click to toggle source

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

@param [<Type>] zone <description>

@return [NSOne::Response]

# File lib/nsone/api/stats.rb, line 24
def zone_qps(zone)
  raise NSOne::MissingParameter, "zone cannot be blank" if blank?(zone)
  normalize_names!(zone)
  perform_request(HTTP_GET, "/stats/qps/#{zone}")
end
zone_usage(zone, params = {}) click to toggle source

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

@param [Hash] params will be used as the request body @param [String] zone NSOne zone name

@option params [String] :period one of `1h`, `24h`, or `30d`

Default: 24h

@option params [Boolean] :expand if `true` breaks down stats by zone.

Default: `false`

@option params [Boolean] :aggregate if `true` returns aggregated stats across all zones and billing tiers

Default: `false`

@return [NSOne::Response]

# File lib/nsone/api/stats.rb, line 93
def zone_usage(zone, params = {})
  raise NSOne::MissingParameter, "zone cannot be blank" if blank?(zone)
  normalize_names!(zone)
  perform_request(HTTP_GET, "/stats/usage/#{zone}", params)
end