| 25 | |
| 26 | Then log into Icinga Director and create two commands as follows. |
| 27 | |
| 28 | * Host Alarm to Telegram |
| 29 | |
| 30 | [[Image(HostAlarm-Telegram.png, 600px, nolink)]] |
| 31 | |
| 32 | Add following Arguments as well. |
| 33 | |
| 34 | [[Image(HAT-Args.png, 500px, nolink)]] |
| 35 | |
| 36 | * Service Alarm to Telegram |
| 37 | |
| 38 | [[Image(ServiceAlarm-Telegram.png, 600px, nolink)]] |
| 39 | |
| 40 | Add following Arguments as well. |
| 41 | |
| 42 | [[Image(SAT-Args.png, 500px, nolink)]] |
| 43 | |
| 44 | == Create Custom Variables == |
| 45 | |
| 46 | Above scripts uses two custom variables called tokencode and chat_id, these are Telegram User specific data and we have to define them on Iciga Director before applying it on Notifications. |
| 47 | |
| 48 | Go to Icinga Director --> `Data Field Categories` |
| 49 | |
| 50 | [[Image(DataCat1.png, 500px, nolink)]] |
| 51 | |
| 52 | Add a Data Category as below. |
| 53 | |
| 54 | [[Image(DataCat2.png, 500px, nolink)]] |
| 55 | |
| 56 | Then go to Icinga Director --> `Define Data Fields` |
| 57 | |
| 58 | Create two new Data Fields as follows: |
| 59 | |
| 60 | * Token Code |
| 61 | |
| 62 | [[Image(TokenCode.png, 500px, nolink)]] |
| 63 | |
| 64 | * Chat ID |
| 65 | |
| 66 | [[Image(ChatId.png, 500px, nolink)]] |
| 67 | |
| 68 | == Telegram Notification Templates == |
| 69 | |
| 70 | Create following templates with the given data. |
| 71 | |
| 72 | * Telegram Host Notification Template |
| 73 | |
| 74 | [[Image(THT.png, 500px, nolink)]] |
| 75 | |
| 76 | * Include custom fields we created earlier. Goto the Fields tab of the template and enter chat_id and tockencode as mandatory fields |
| 77 | |
| 78 | [[Image(Field_chatId.png, 500px, nolink)]] |
| 79 | |
| 80 | [[Image(Field_tokencode.png, 500px, nolink)]] |
| 81 | |
| 82 | * Telegram Service Notification Template |
| 83 | |
| 84 | [[Image(TST.png, 500px, nolink)]] |
| 85 | |
| 86 | * Goto the Fields tab of the template and enter `chat_id` and `tockencode` as mandatory fields based on previous guidelines. |
| 87 | |
| 88 | == Create Notifications to Telegram == |
| 89 | |
| 90 | In this setup, we shall create two notifications setups for Hosts and Services respectively. When assigning notifications we should select a user rather than a user group to avoid multiple duplicates of notifications. |
| 91 | |
| 92 | * Telegram-Host-Notification |
| 93 | |
| 94 | [[Image(THS.png, 600px, nolink)]] |
| 95 | |
| 96 | * Telegram-Service-Notification |
| 97 | |
| 98 | [[Image(TSN.png, 600px, nolink)]] |
| 99 | |
| 100 | |
| 101 | * Finally, Deploy the changes you did. |
| 102 | |