Skip to content

Instantly share code, notes, and snippets.

@esseti
Last active February 2, 2017 16:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save esseti/5d81db337c186b3d4e4305339ad2bad7 to your computer and use it in GitHub Desktop.
Save esseti/5d81db337c186b3d4e4305339ad2bad7 to your computer and use it in GitHub Desktop.
Barman Notification on Slack
#!/bin/bash
#this should be run in a cron task every day or week.
#fill in CHANNEL and WEBHOOK URL
RESULT="$(barman check all)"
RESULT2="$(barman list-backup all)"
PAYLOAD='payload={"channel": "<SPECIFY THE CHANNEL>","username": "barman","icon_emoji": ":robot_face:","color": "info","fields": [{"title": "Check","value": "'${RESULT}'","short": False},{"title": "list backup","value": "'${RESULT2}'","short": False}],}'
curl -X POST --data "$PAYLOAD" https://hooks.slack.com/services/<YOUR URL>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment