Slack And Pagerduty Notification on Icinga2

Strange, you reported it’s working somewhere, but I don’t see vars.enable_pagerduty = true anywhere. Please could you search for a such setting in the output of icinga2 object list -t service and share respective services?

Output of icinga2 object list -t service

root@icinga:/home/ubuntu# icinga2 object list -t service
Object ‘saaskarma!check-ssh’ of type ‘Service’:
% declared in ‘/var/lib/icinga2/api/packages/director/cf8654a7-a0ee-4e70-853d-23bc6366dc6f/zones.d/master/service_apply.conf’, lines 1:0-1:24

  • __name = “saaskarma!check-ssh”
  • action_url = “”
  • check_command = “ssh”
    % = modified in ‘/var/lib/icinga2/api/packages/director/cf8654a7-a0ee-4e70-853d-23bc6366dc6f/zones.d/master/service_templates.conf’, lines 2:5-2:25
  • check_interval = 300
  • check_period = “”
  • check_timeout = null
  • command_endpoint = “saaskarma”
    % = modified in ‘/var/lib/icinga2/api/packages/director/cf8654a7-a0ee-4e70-853d-23bc6366dc6f/zones.d/master/service_templates.conf’, lines 3:5-3:32
  • display_name = “check-ssh”
  • enable_active_checks = true
  • enable_event_handler = true
  • enable_flapping = false
  • enable_notifications = true
  • enable_passive_checks = true
  • enable_perfdata = true
  • event_command = “”
  • flapping_ignore_states = null
  • flapping_threshold = 0
  • flapping_threshold_high = 30
  • flapping_threshold_low = 25
  • groups =
  • host_name = “saaskarma”
    % = modified in ‘/var/lib/icinga2/api/packages/director/cf8654a7-a0ee-4e70-853d-23bc6366dc6f/zones.d/master/service_apply.conf’, lines 1:0-1:24
  • icon_image = “”
  • icon_image_alt = “”
  • max_check_attempts = 3
  • name = “check-ssh”
    % = modified in ‘/var/lib/icinga2/api/packages/director/cf8654a7-a0ee-4e70-853d-23bc6366dc6f/zones.d/master/service_apply.conf’, lines 1:0-1:24
  • notes = “”
  • notes_url = “”
  • package = “director”
    % = modified in ‘/var/lib/icinga2/api/packages/director/cf8654a7-a0ee-4e70-853d-23bc6366dc6f/zones.d/master/service_apply.conf’, lines 1:0-1:24
  • retry_interval = 60
  • source_location
    • first_column = 0
    • first_line = 1
    • last_column = 24
    • last_line = 1
    • path = “/var/lib/icinga2/api/packages/director/cf8654a7-a0ee-4e70-853d-23bc6366dc6f/zones.d/master/service_apply.conf”
  • templates = [ “check-ssh”, “check_ssh”, “host var overrides (Director)” ]
    % = modified in ‘/var/lib/icinga2/api/packages/director/cf8654a7-a0ee-4e70-853d-23bc6366dc6f/zones.d/master/service_apply.conf’, lines 1:0-1:24
    % = modified in ‘/var/lib/icinga2/api/packages/director/cf8654a7-a0ee-4e70-853d-23bc6366dc6f/zones.d/master/service_templates.conf’, lines 1:0-1:27
    % = modified in ‘/var/lib/icinga2/api/packages/director/cf8654a7-a0ee-4e70-853d-23bc6366dc6f/zones.d/director-global/001-director-basics.conf’, lines 28:3-28:43
  • type = “Service”
  • vars = null
    % = modified in ‘/var/lib/icinga2/api/packages/director/cf8654a7-a0ee-4e70-853d-23bc6366dc6f/zones.d/director-global/001-director-basics.conf’, lines 43:7-43:50
  • volatile = false
  • zone = “master”
    % = modified in ‘/var/lib/icinga2/api/packages/director/cf8654a7-a0ee-4e70-853d-23bc6366dc6f/zones.d/master/service_apply.conf’, lines 1:0-1:24
    % = modified in ‘/var/lib/icinga2/api/packages/director/cf8654a7-a0ee-4e70-853d-23bc6366dc6f/zones.d/master/service_apply.conf’, lines 6:5-6:19

Object ‘saaskarma!ping4’ of type ‘Service’:
% declared in ‘/etc/icinga2/conf.d/services.conf’, lines 26:1-26:21

  • __name = “saaskarma!ping4”
  • action_url = “”
  • check_command = “ping4”
    % = modified in ‘/etc/icinga2/conf.d/services.conf’, lines 29:3-29:25
  • check_interval = 60
    % = modified in ‘/etc/icinga2/zones.d/global-templates/templates.conf’, lines 35:3-35:21
  • check_period = “”
  • check_timeout = null
  • command_endpoint = “”
  • display_name = “ping4”
  • enable_active_checks = true
  • enable_event_handler = true
  • enable_flapping = false
  • enable_notifications = true
  • enable_passive_checks = true
  • enable_perfdata = true
  • event_command = “”
  • flapping_ignore_states = null
  • flapping_threshold = 0
  • flapping_threshold_high = 30
  • flapping_threshold_low = 25
  • groups =
  • host_name = “saaskarma”
    % = modified in ‘/etc/icinga2/conf.d/services.conf’, lines 26:1-26:21
  • icon_image = “”
  • icon_image_alt = “”
  • max_check_attempts = 5
    % = modified in ‘/etc/icinga2/zones.d/global-templates/templates.conf’, lines 34:3-34:24
  • name = “ping4”
    % = modified in ‘/etc/icinga2/conf.d/services.conf’, lines 26:1-26:21
  • notes = “”
  • notes_url = “”
  • package = “_etc”
    % = modified in ‘/etc/icinga2/conf.d/services.conf’, lines 26:1-26:21
  • retry_interval = 30
    % = modified in ‘/etc/icinga2/zones.d/global-templates/templates.conf’, lines 36:3-36:22
  • source_location
    • first_column = 1
    • first_line = 26
    • last_column = 21
    • last_line = 26
    • path = “/etc/icinga2/conf.d/services.conf”
  • templates = [ “ping4”, “generic-service” ]
    % = modified in ‘/etc/icinga2/conf.d/services.conf’, lines 26:1-26:21
    % = modified in ‘/etc/icinga2/zones.d/global-templates/templates.conf’, lines 33:1-33:34
  • type = “Service”
  • vars
    • enable_email_for = “web”
      % = modified in ‘/etc/icinga2/zones.d/global-templates/templates.conf’, lines 39:3-39:31
    • enable_pagerduty = true
      % = modified in ‘/etc/icinga2/zones.d/global-templates/templates.conf’, lines 37:3-37:30
    • slack_notifications = “enabled”
      % = modified in ‘/etc/icinga2/zones.d/global-templates/templates.conf’, lines 38:3-38:38
  • volatile = false
  • zone = “master”
    % = modified in ‘/etc/icinga2/conf.d/services.conf’

Just a question is there any way to modify slack and PagerDuty variable using Icinga Web as I have created all the objects , commands, services, host templete using web.?

Attac


hing image for your reference.


There seems to be a template in templates.conf you imported only for ping4.

So one question is the template.conf is responsible for slack_notification and PagerDuty?
If Yes then how to do for other services? Also I have 2 zones “global-template” and “master” so in which zone template.conf should be placed?
Is it possible using Icinga Web?

OK, first of all, what is there?

template Host “generic-host” {
check_command = “hostalive”
max_check_attempts = 3
check_interval = 1m
retry_interval = 30s
vars.enable_pagerduty = true
vars.slack_notifications = “enabled”
vars.enable_email_for = “web”
}

/**

  • Provides default settings for services. By convention
  • all services should import this template.
    */
    template Service “generic-service” {
    max_check_attempts = 5
    check_interval = 1m
    retry_interval = 30s
    vars.enable_pagerduty = true
    vars.slack_notifications = “enabled”
    vars.enable_email_for = “web”
    }

/**

  • Provides default settings for users. By convention
  • all users should inherit from this template.
    */

template User “generic-user” {

}

The services you miss notifications for seem to miss import “generic-service” as in ping4. If you created some via Director, you should add the generic-service template there.

But how to add notification in web?
bca the service for which import is missing is created using web.

On which page of web exactly?

this page where notification is empty but for ping4 service notification has user name.

Sorry, no. This definitely is not the page for service creation. I guess you want Icinga Director > Services etc…

While creating service notification option is not there

Under Imports add generic-service.

Import is not giving an option for generic-service.

Then you have to add the custom variable enable_pagerduty with value true by yourself to such services. However, I’m not a Director pro.

Means do I need to add arguments and fields with name enable_pagerduty and value as true?
If possible please share documentation link for custom variable as I am at level zero for icinga setup so it will be very helpful!!

Well…

And the amount of documentation neither sounds promising:

https://icinga.com/docs/icinga-director/latest/doc/12-Handling-custom-variables/

first create a datafield in icinga director name it enable_pagerduty since that the varname of you assign rule and use type boolean.

than you add the datafield to the service template or any root service template your servicetemplates can inherit from.

look at that thread, adding a field to a command is very similar to adding a field to a service

Hello,
We will perform these steps and let you know if any help is require.