Skip to content

Latest commit

 

History

History
65 lines (48 loc) · 1.64 KB

readme-english.md

File metadata and controls

65 lines (48 loc) · 1.64 KB

Send bacula messages using telegram:

Create a Telegram Bot

Add the user @BotFather to your telegram account or access the address https://telegram.me/BotFather 
and follow the steps below:
- /newbot - create a new bot
- Type a name for your bot. Example: Bacula Test Bot
- Type a username for your bot. It must end in 'bot' Example: (bacula_test_bot)

Get the API KEY:
1234567890:AAFd2sDMplKGyoajsPWARnSOwa9EqHiy17U

- Replace the url with your API KEY
https://api.telegram.org/bot${API_TOKEN}/getUpdates
https://api.telegram.org/bot1234567890:AAFd2sDMplKGyoajsPWARnSOwa9EqHiy17U/getUpdates

Open in browser the URL. You will receive a JSON output, get the 'id' value.

{"ok":true,"result":[{"update_id":565543449,
"message":{"message_id":3,"from":{"id":123456789,"first_name":"Some Name","last_name":"Some Last Name",
"username":"someusername"},"chat":{"id":123456789,"first_name":"Some Name","last_name":"Some Last Name",
"username":"someuser","type":"private"},"date":1472165730,"text":"hello"}}]}

Or send a message to the @userinfobot bot that it will return the value of your id

Add a RunsScript in JobDefs Resource in the file bacula-dir.conf

JobDefs {
   ...
   RunScript {
     Command = "/etc/bacula/scripts/_send_telegram.sh %i"
     RunsWhen = After
     RunsOnFailure = yes
     RunsOnClient = no
     RunsOnSuccess = yes # default, you can drop this line
  }
}

Config dbdriver option in the Catalog Resource in the file bacula-dir.conf

Catalog {
   ...
   dbdriver = "mysql" or dbdriver = "pgsql"
   ...
}

Install dependencies

### Debian ###
apt-get install curl bc

### CentOS ###
yum -y install curl bc