Skip to content

Commit

Permalink
Monitor healthchecks using gatus
Browse files Browse the repository at this point in the history
  • Loading branch information
claha committed Aug 5, 2023
1 parent 6991372 commit b9c7452
Show file tree
Hide file tree
Showing 5 changed files with 426 additions and 373 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/autorestic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
--extra-vars "b2_account_id=ci b2_account_key=ci \
backblaze_homeassistant_key=ci \
backblaze_zigbee2mqtt_key=ci \
healthchecks_backup_homeassistant_url=ci \
healthchecks_backup_zigbee2mqtt_url=ci"
healthchecks_backup_homeassistant_ping_url=ci \
healthchecks_backup_zigbee2mqtt_ping_url=ci"
cd ~/autorestic && docker compose run autorestic
4 changes: 2 additions & 2 deletions roles/autorestic/templates/autorestic.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ locations:
keep-daily: 7
hooks:
success:
- 'curl {{ healthchecks_backup_homeassistant_url }}'
- 'curl {{ healthchecks_backup_homeassistant_ping_url }}'
zigbee2mqtt:
from: {{ services_path }}/zigbee2mqtt
to:
Expand All @@ -45,4 +45,4 @@ locations:
keep-daily: 7
hooks:
success:
- 'curl {{ healthchecks_backup_zigbee2mqtt_url }}'
- 'curl {{ healthchecks_backup_zigbee2mqtt_ping_url }}'
1 change: 1 addition & 0 deletions roles/gatus/defaults/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ service_name: "{{ ansible_role_name }}"
service_path: "{{ services_path }}/{{ service_name }}"
gatus_icmp_endpoints: []
gatus_dns_endpoints: []
gatus_healthcheck_endpoints: []
16 changes: 16 additions & 0 deletions roles/gatus/templates/config.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,19 @@ endpoints:
success-threshold: {{ endpoint.success_threshold }}
{% endif %}
{% endfor %}
{% for endpoint in gatus_healthcheck_endpoints %}
- name: {{ endpoint.name }}
url: "{{ endpoint.url }}"
headers:
X-Api-Key: {{ healthchecks_api_key }}
conditions:
- "[BODY].status == up"
alerts:
- type: telegram
{% if endpoint.failure_threshold is defined %}
failure-threshold: {{ endpoint.failure_threshold }}
{% endif %}
{% if endpoint.success_threshold is defined %}
success-threshold: {{ endpoint.success_threshold }}
{% endif %}
{% endfor %}
Loading

0 comments on commit b9c7452

Please sign in to comment.