WIP added some schema info for uptime kuma

This commit is contained in:
Paul Wilde 2024-06-21 16:57:20 +01:00
parent 4db09a73b3
commit 83bcea98dc
2 changed files with 41 additions and 3 deletions

View file

@ -1676,6 +1676,43 @@ properties:
an account at https://healthchecks.io (or self-host Healthchecks) if an account at https://healthchecks.io (or self-host Healthchecks) if
you'd like to use this service. See borgmatic monitoring you'd like to use this service. See borgmatic monitoring
documentation for details. documentation for details.
uptimekuma:
type: object
required: ['ping_url', 'push_code']
additionalProperties: false
properties:
ping_url:
type: string
description: |
Uptime Kuma base URL or UUID to notify when a backup
begins, ends, or errors
example: https://example.uptime.kuma
push_code:
type: string
description: |
Uptime Kuma "Push Code" from the push URL you have been given.
For example, the push code for:
'https://uptime.kuma/api/push/0evpM0MIdE?status=up&msg=OK&ping='
would be '0evpM0MIdE'
states:
type: array
items:
type: string
enum:
- start
- finish
- fail
uniqueItems: true
description: |
List of one or more monitoring states to ping for: "start",
"finish", and/or "fail". Defaults to pinging for all
states.
example:
- start, finish, fail
description: |
Configuration for a monitoring integration with Uptime Kuma using
the 'Push' monitor type.
See more information here: https://uptime.kuma.pet
cronitor: cronitor:
type: object type: object
required: ['ping_url'] required: ['ping_url']

View file

@ -20,9 +20,10 @@ def ping_monitor(hook_config, config, config_filename, state, monitoring_log_lev
If this is a dry run, then don't actually ping anything. If this is a dry run, then don't actually ping anything.
''' '''
run_states = hook_config.get('states', ['success','fail']) run_states = hook_config.get('states', ['start','finish','fail'])
if state.name.lower() in run_states: if state.name.lower() in run_states:
dry_run_label = ' (dry run; not actually pinging)' if dry_run else '' dry_run_label = ' (dry run; not actually pinging)' if dry_run else ''
status = state.name.lower() == "fail" ? "down" : "up" status = state.name.lower() == "fail" ? "down" : "up"
@ -41,7 +42,7 @@ def ping_monitor(hook_config, config, config_filename, state, monitoring_log_lev
if not response.ok: if not response.ok:
response.raise_for_status() response.raise_for_status()
except requests.exceptions.RequestException as error: except requests.exceptions.RequestException as error:
logger.warning(f'{config_filename}: ntfy error: {error}') logger.warning(f'{config_filename}: Uptime Kuma error: {error}')
def destroy_monitor( def destroy_monitor(