Changes between Version 3 and Version 4 of NSM2021/Agenda/AlertsIcinga2Email


Ignore:
Timestamp:
May 21, 2021, 7:13:26 PM (4 years ago)
Author:
admin
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • NSM2021/Agenda/AlertsIcinga2Email

    v3 v4  
    4747Test mail transport by `mail -s "Hello World" youremail@yourdomain.tld`
    4848
     49
     50=== Enable Email Notifications from Director ===
     51
     52On Icinga2, we can define custom scripts to execute different notifications. We use this feature to send emails and other notifications. For the simplicity we have created few scripts so it will enable us to put notifications when host or service category makes alerts.
     53
     54Download email scripts to the scripts directory.
     55
     56{{{
     57#!sh
     58cd /etc/icinga2/scripts
     59
     60wget https://raw.githubusercontent.com/LEARN-LK/Tutorials/master/Scripts/ICINGA2/icinga2-mail-host.sh
     61
     62wget https://raw.githubusercontent.com/LEARN-LK/Tutorials/master/Scripts/ICINGA2/icinga2-mail-service.sh
     63
     64chmod +x icinga2-mail-host.sh
     65
     66chmod +x icinga2-mail-service.sh
     67}}}
     68
     69
     70Next, on Icinga Director go to Commands
     71
     72[[Image(Ici-Di-Commands.png, 400px, nolink)]]
     73
     74Click `Add` to Add new Icinga Command with the following details.
     75
     76* Command Type: `Notification Plugin Command`
     77* Command Name: `Host Alarm By Email`
     78* Command: `/etc/icinga2/scripts/host-by-mail.sh`
     79
     80and click add. Now go to the `Arguments` tab of the created command. Then add an Argument like,
     81
     82Argument name: `-4`[[br]]
     83(Make sure you put the - symbol)[[br]]
     84Value type: `String`[[br]]
     85Value: `$address$`[[br]]
     86Required: `Yes`
     87
     88and Click `Add`.
     89
     90Next Click Back button [[Image(BackBtn.png, 100px, nolink)]] just below the command name on Top of the tab.
     91
     92Repeat above step and add following arguments as well
     93
     94[[Image(HostEmail.png, 400px, nolink)]]
     95
     96
     97