Changes between Version 1 and Version 2 of NSM2021/Agenda/AlertsIcinga2Telegram


Ignore:
Timestamp:
May 22, 2021, 7:47:18 PM (4 years ago)
Author:
admin
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • NSM2021/Agenda/AlertsIcinga2Telegram

    v1 v2  
    99== Create new command on Icinga2 ==
    1010
    11 We have created a custom bash code to translate Icinga notifications to Telegram. Download it into the scripts directory.
     11We have created custom bash codes to translate Icinga notifications to Telegram. Download them into the scripts directory.
    1212
    1313{{{
     
    2323chmod +x icinga2-telegram-service.sh
    2424}}}
     25
     26Then 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
     46Above 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
     48Go to Icinga Director --> `Data Field Categories`
     49
     50[[Image(DataCat1.png, 500px, nolink)]]
     51
     52Add a Data Category as below.
     53
     54[[Image(DataCat2.png, 500px, nolink)]]
     55
     56Then go to Icinga Director --> `Define Data Fields`
     57
     58Create 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
     70Create 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
     90In 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