Skip to content

Commit

Permalink
[infra] feat: notify Discord role when URLs check fails (#1824)
Browse files Browse the repository at this point in the history
  • Loading branch information
GresilleSiffle authored Nov 9, 2023
1 parent 30801ce commit a377e6e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
8 changes: 8 additions & 0 deletions infra/ansible/inventory.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ all:
- https://api.tournesol.app/admin
- https://webanalytics.tournesol.app/login

# ID of the Discord role that will be highlighted when a monitored
# URL is unreachable. (optional)
discord_role_id_urls_checks: 928020834885464086

grafana_domain_name: "grafana.{{domain_name}}"
grafana_scheme: https
plausible_hosting_tag: "2023.09.28"
Expand Down Expand Up @@ -170,6 +174,10 @@ all:
- https://api.staging.tournesol.app/admin
- https://webanalytics.staging.tournesol.app/login

# ID of the Discord role that will be highlighted when a monitored
# URL is unreachable. (optional)
discord_role_id_urls_checks: 928020834885464086

grafana_domain_name: "grafana.{{domain_name}}"
grafana_scheme: https
plausible_hosting_tag: "2023.09.28"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ do
echo "error checking $u"
{% if discord_infra_alert_webhook is defined and discord_infra_alert_webhook != "" %}
wget -qO /dev/null \
--post-data='{"content": "health check of '"$u"' failed"}' \
{% if discord_role_id_urls_checks is defined and discord_role_id_urls_checks %}
--post-data='{"content": "🚨 <@&{{discord_role_id_urls_checks}}> - health check of '"$u"' failed"}' \
{% else %}
--post-data='{"content": "🚨 health check of '"$u"' failed"}' \
{% endif %}
--header='Content-Type:application/json' \
'{{discord_infra_alert_webhook}}?wait=true'
echo "alert sent"
Expand Down

0 comments on commit a377e6e

Please sign in to comment.