* openapi: update /stats method

This commit is contained in:
Simon Zolin 2019-08-27 12:56:16 +03:00 committed by Ildar Kamalov
parent 4a58266ba3
commit 55ceca6314
1 changed files with 16 additions and 138 deletions

View File

@ -214,18 +214,6 @@ paths:
# General statistics methods # General statistics methods
# -------------------------------------------------- # --------------------------------------------------
/stats_top:
get:
tags:
- stats
operationId: statusTop
summary: 'Get DNS server top client, domain and blocked statistics'
responses:
200:
description: OK
schema:
$ref: "#/definitions/StatsTop"
/stats: /stats:
get: get:
tags: tags:
@ -234,46 +222,10 @@ paths:
summary: 'Get DNS server statistics' summary: 'Get DNS server statistics'
responses: responses:
200: 200:
description: 'Returns general statistics for the last 24 hours' description: 'Returns statistics data'
schema: schema:
$ref: "#/definitions/Stats" $ref: "#/definitions/Stats"
/stats_history:
get:
tags:
- stats
operationId: stats_history
summary: 'Get historical DNS server statistics for the last 24 hours'
parameters:
-
name: start_time
in: query
type: string
description: 'Start time in ISO8601 (example: `2018-05-04T17:55:33+00:00`)'
required: true
-
name: end_time
in: query
type: string
description: 'End time in ISO8601 (example: `2018-05-04T17:55:33+00:00`)'
required: true
-
name: time_unit
in: query
type: string
description: 'Time unit (`minutes` or `hours`)'
required: true
enum:
- minutes
- hours
responses:
501:
description: 'Requested time window is outside of supported range. It will be supported later, but not now.'
200:
description: 'Returns historical stats for the specified time interval.'
schema:
$ref: '#/definitions/StatsHistory'
/stats_reset: /stats_reset:
post: post:
tags: tags:
@ -1103,28 +1055,29 @@ definitions:
type: "boolean" type: "boolean"
Stats: Stats:
type: "object" type: "object"
description: "General server stats for the last 24 hours" description: "Server statistics data"
required:
- "dns_queries"
- "blocked_filtering"
- "replaced_safebrowsing"
- "replaced_parental"
- "replaced_safesearch"
- "avg_processing_time"
properties: properties:
dns_queries: time_units:
type: "string"
description: "Time units (hours | days)"
example: "hours"
num_dns_queries:
type: "integer" type: "integer"
description: "Total number of DNS queries" description: "Total number of DNS queries"
example: 123 example: 123
blocked_filtering: num_blocked_filtering:
type: "integer" type: "integer"
description: "Number of requests blocked by filtering rules" description: "Number of requests blocked by filtering rules"
example: 50 example: 50
replaced_safebrowsing: num_replaced_safebrowsing:
type: "integer" type: "integer"
description: "Number of requests blocked by the safebrowsing module" description: "Number of requests blocked by safebrowsing module"
example: 5 example: 5
replaced_parental: num_replaced_safesearch:
type: "integer"
description: "Number of requests blocked by safesearch module"
example: 5
num_replaced_parental:
type: "integer" type: "integer"
description: "Number of blocked adult websites" description: "Number of blocked adult websites"
example: 15 example: 15
@ -1133,110 +1086,35 @@ definitions:
format: "float" format: "float"
description: "Average time in milliseconds on processing a DNS" description: "Average time in milliseconds on processing a DNS"
example: 0.34 example: 0.34
StatsTop:
type: "object"
description: "Server stats top charts"
required:
- "top_queried_domains"
- "top_clients"
- "top_blocked_domains"
properties:
top_queried_domains: top_queried_domains:
type: "array" type: "array"
items: items:
type: "object" type: "object"
example:
example.org: 12312
example.com: 321
example.net: 5555
top_clients: top_clients:
type: "array" type: "array"
items: items:
type: "object" type: "object"
example:
127.0.0.1: 12312
192.168.0.1: 13211
192.168.0.3: 13211
top_blocked_domains: top_blocked_domains:
type: "array" type: "array"
items: items:
type: "object" type: "object"
example:
example.org: 12312
example.com: 321
example.net: 5555
StatsHistory:
type: "object"
description: "Historical stats of the DNS server. Example below is for 5 minutes. Values are from oldest to newest."
required:
- "dns_queries"
- "blocked_filtering"
- "replaced_safebrowsing"
- "replaced_parental"
- "replaced_safesearch"
- "avg_processing_time"
properties:
dns_queries: dns_queries:
type: "array" type: "array"
items: items:
type: "integer" type: "integer"
example:
- 1201
- 1501
- 1251
- 1231
- 120
blocked_filtering: blocked_filtering:
type: "array" type: "array"
items: items:
type: "integer" type: "integer"
example:
- 421
- 124
- 5
- 12
- 43
replaced_safebrowsing: replaced_safebrowsing:
type: "array" type: "array"
items: items:
type: "integer" type: "integer"
example:
- 1
- 0
- 5
- 0
- 0
replaced_parental: replaced_parental:
type: "array" type: "array"
items: items:
type: "integer" type: "integer"
example:
- 120
- 10
- 5
- 12
- 1
replaced_safesearch:
type: "array"
items:
type: "integer"
example:
- 1
- 0
- 0
- 0
- 5
avg_processing_time:
type: "array"
items:
type: "number"
format: "float"
example:
- 1.25
- 5.12
- 4.12
- 123.12
- 0.12
DhcpConfig: DhcpConfig:
type: "object" type: "object"
description: "Built-in DHCP server configuration" description: "Built-in DHCP server configuration"