How to create notifications for services and hosts using icinga2web

I have tried lot of things and followed the document but still no success.
I would like to know the proper way and steps to create notifications.

Hello @akshay,
Can you please provide more details on what you have done to get notification working? Are notifications enabled? What is the status of the notification feature when you run the command below?

icinga2 feature list

Regards
Alex

Disabled features: command compatlog elasticsearch gelf graphite icingadb livestatus opentsdb perfdata statusdata syslog
Enabled features: api checker debuglog ido-mysql influxdb mainlog notification

Hello @akshay,
Could you share some details of your setup with us? How are you configuring Icinga in general? Via text config files, using the director or some entirely different way?

Also: Did you prepare a mail server setup on your machine, which is able to send mails to you?

Helllo @lorenz i have setup postfix mail server and i can send mail from it.
i have configured Notifications from Icingadirector.

Very well, in this case you have to create notification Templates (one for Hosts and one for Services) and then create Notification-Apply-Rules.
The commands used in the templates should be mail-host-notifications, respectively mail-service-notification.
Could you post some screenshots from your configuration?






Looks good so far, what is the output of icinga2 object list --type=notification after deployment?
Should be a mass of Notifications.

iam not getting any notifications

yes, but are there any nofication objects? (They should show up with: icinga2 object list --type=notification)

i didnt understood where can i see icinga2 object list --type=notification) can you plz show me how it looks like. Do i need to create it from icinga director?

Ah, sorry, my Fault. You have to open a shell on the icinga2 system and type that command.
If you have some kind of graphical user interface, there is most like some program called terminal or something like that.
It should give you some kind of command-line interface.
The command has to executed as the root user (the administrative user), so prefixing the command with sudo will probably help.

yes i can see the notification objects

Object ‘hostname!procs!mail-icingaadmin’ of type ‘Notification’:
% declared in ‘/etc/icinga2/conf.d/notifications.conf’, lines 23:1-23:48

  • __name = “cnovlx31!procs!mail-icingaadmin”
  • command = “mail-service-notification”
    % = modified in ‘/etc/icinga2/conf.d/templates.conf’, lines 69:3-69:39
  • command_endpoint = “”
  • host_name = “cnovlx31”
    % = modified in ‘/etc/icinga2/conf.d/notifications.conf’, lines 23:1-23:48
  • interval = 1800
  • name = “mail-icingaadmin”
  • package = “_etc”
    % = modified in ‘/etc/icinga2/conf.d/notifications.conf’, lines 23:1-23:48
  • period = “24x7”
    % = modified in ‘/etc/icinga2/conf.d/templates.conf’, lines 82:3-82:17
  • service_name = “procs”
    % = modified in ‘/etc/icinga2/conf.d/notifications.conf’, lines 23:1-23:48
  • source_location
    • first_column = 1
    • first_line = 23
    • last_column = 48
    • last_line = 23
    • path = “/etc/icinga2/conf.d/notifications.conf”
  • states = [ “OK”, “Warning”, “Critical”, “Unknown” ]
    % = modified in ‘/etc/icinga2/conf.d/templates.conf’, lines 71:3-71:45
  • templates = [ “mail-icingaadmin”, “mail-service-notification” ]
    % = modified in ‘/etc/icinga2/conf.d/notifications.conf’, lines 23:1-23:48
    % = modified in ‘/etc/icinga2/conf.d/templates.conf’, lines 68:1-68:49
  • times = null
  • type = “Notification”
  • types = [ “Problem”, “Acknowledgement”, “Recovery”, “Custom”, “FlappingStart”, “FlappingEnd”, “DowntimeStart”, “DowntimeEnd”, “DowntimeRemoved” ]
    % = modified in ‘/etc/icinga2/conf.d/templates.conf’, lines 72:3-74:57
  • user_groups = [ “icingaadmins” ]
    % = modified in ‘/etc/icinga2/conf.d/notifications.conf’, lines 25:3-25:50
  • users = null
    % = modified in ‘/etc/icinga2/conf.d/notifications.conf’, lines 26:3-26:43
  • vars
    % = modified in ‘/etc/icinga2/conf.d/templates.conf’, lines 76:3-80:3
    • notification_logtosyslog = false
  • zone = “”

why is it in the /etc folder i think it will be only applied to the icinga host.
but i want notification for all hosts

Hello @akshay
Do you set a notification apply rule for all host and services?

Can you share files “/etc/icinga2/conf.d/notifications.conf” & “/etc/icinga2/conf.d/templates.conf” ? Please include your code in the code block format for easier viewing.

Regards
Alex

It seems like the configuration from /etc/icinga2/conf.d gets included, although you are using the director. This is rather uncommon and probably unintented. You might to take a look at the file /etc/icinga2/icinga2.conf, if there is a line looking like include_recursive "conf.d" you probably should deactivate it.
If your API configuration is in that directory, you might want to add a line like include "conf.d/api-users.conf" depending on how and where you wrote it.

If there are no notifications anymore after that, your assignement in the director is wrong.