1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_restic.git synced 2024-12-11 23:41:32 +01:00

Merge pull request #73 from rndmh3ro/monitoring

add a monitoring call possibility
This commit is contained in:
L3D 2022-07-12 22:07:49 +02:00 committed by GitHub
commit efd21f0d0a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View file

@ -153,6 +153,7 @@ Available variables:
| `log_to_journald` | no | Optionally switch logging to journald with the name of the backup job as the tag | | `log_to_journald` | no | Optionally switch logging to journald with the name of the backup job as the tag |
| `mail_on_error` | no | Optionally send a mail if the backupjob will fail *(mailx is required)* | | `mail_on_error` | no | Optionally send a mail if the backupjob will fail *(mailx is required)* |
| `mail_address` | if `mail_on_error` is true | The mail addressto recive mails if you enabled ``mail_on_error``. | | `mail_address` | if `mail_on_error` is true | The mail addressto recive mails if you enabled ``mail_on_error``. |
| `monitoring_call` | no | A command that will be called if the backup is *successful*. Useful for heartbeat monitoring systems that warn when no heartbeat is received. Use the full command, you need to run. Example: `curl https://monitoring.example.com/api/push/E9Wzm4lJ2O?status=up&msg=OK&ping=` |
Example: Example:
```yaml ```yaml

View file

@ -178,6 +178,9 @@ fi
if [[ $? -eq 0 ]] if [[ $? -eq 0 ]]
then then
echo "$(date -u '+%Y-%m-%d %H:%M:%S') OK" {{ forget_result_log }} echo "$(date -u '+%Y-%m-%d %H:%M:%S') OK" {{ forget_result_log }}
{% if item.monitoring_call is defined %}
{{ item.monitoring_call }}
{% endif %}
else else
echo "$(date -u '+%Y-%m-%d %H:%M:%S') ERROR" {{ forget_result_log }} echo "$(date -u '+%Y-%m-%d %H:%M:%S') ERROR" {{ forget_result_log }}
{% if item.mail_on_error is defined and item.mail_on_error == true %} {% if item.mail_on_error is defined and item.mail_on_error == true %}