mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2025-01-07 19:05:39 +00:00
commit
06c12cc3ac
@ -23,7 +23,7 @@ from ..lib.errors import (
|
|||||||
AccountCreateFail, AccountUpdateFail, AccountDeleteFail,
|
AccountCreateFail, AccountUpdateFail, AccountDeleteFail,
|
||||||
AccountCreateDuplicate, AccountNotExists,
|
AccountCreateDuplicate, AccountNotExists,
|
||||||
UserCreateFail, UserCreateDuplicate, UserUpdateFail, UserDeleteFail,
|
UserCreateFail, UserCreateDuplicate, UserUpdateFail, UserDeleteFail,
|
||||||
UserUpdateFailEmail,
|
UserUpdateFailEmail
|
||||||
)
|
)
|
||||||
from ..decorators import (
|
from ..decorators import (
|
||||||
api_basic_auth, api_can_create_domain, is_json, apikey_auth,
|
api_basic_auth, api_can_create_domain, is_json, apikey_auth,
|
||||||
@ -1195,3 +1195,21 @@ def sync_domains():
|
|||||||
domain = Domain()
|
domain = Domain()
|
||||||
domain.update()
|
domain.update()
|
||||||
return 'Finished synchronization in background', 200
|
return 'Finished synchronization in background', 200
|
||||||
|
|
||||||
|
@api_bp.route('/health', methods=['GET'])
|
||||||
|
@apikey_auth
|
||||||
|
def health():
|
||||||
|
domain = Domain()
|
||||||
|
domain_to_query = domain.query.first()
|
||||||
|
|
||||||
|
if not domain_to_query:
|
||||||
|
current_app.logger.error("No domain found to query a health check")
|
||||||
|
return make_response("Unknown", 503)
|
||||||
|
|
||||||
|
try:
|
||||||
|
domain.get_domain_info(domain_to_query.name)
|
||||||
|
except Exception as e:
|
||||||
|
current_app.logger.error("Health Check - Failed to query authoritative server for domain {}".format(domain_to_query.name))
|
||||||
|
return make_response("Down", 503)
|
||||||
|
|
||||||
|
return make_response("Up", 200)
|
||||||
|
@ -782,6 +782,32 @@ paths:
|
|||||||
'422':
|
'422':
|
||||||
description: 'Returned when something is wrong with the content of the request. Contains an error message'
|
description: 'Returned when something is wrong with the content of the request. Contains an error message'
|
||||||
|
|
||||||
|
'/servers/{server_id}/health':
|
||||||
|
get:
|
||||||
|
security:
|
||||||
|
- APIKeyHeader: []
|
||||||
|
summary: Perfoms health check
|
||||||
|
operationId: health_check
|
||||||
|
tags:
|
||||||
|
- Monitoring
|
||||||
|
parameters:
|
||||||
|
- name: server_id
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
description: The id of the server to retrieve
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Healthcheck succeeded
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
example: "up"
|
||||||
|
'503':
|
||||||
|
description: Healthcheck failed
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
example: Down/Unknown
|
||||||
|
|
||||||
'/pdnsadmin/zones':
|
'/pdnsadmin/zones':
|
||||||
get:
|
get:
|
||||||
security:
|
security:
|
||||||
|
Loading…
Reference in New Issue
Block a user