Extract ICINGA COMMUNITY TO ADD SWITCH

Before you ask a question, you can check the troubleshooting documentation first, maybe you can find an answer here.

Please describe your problem as detailed as possible and don’t forget to use a meaningful title :slight_smile:
We also have a markdown formatting guide to help you make your topics more readable!

Give as much information as you can, e.g.

  • Version used (icinga2 --version) : version: r2.13.6-1

  • Operating System and version : centos 7 3.10.0-1160.80.1.el7.x86_64

  • Enabled features (icinga2 feature list) : Disabled features: command compatlog debuglog elasticsearch gelf icingadb influxdb influxdb2 opentsdb perfdata statusdata syslog
    Enabled features: api checker graphite ido-mysql livestatus mainlog notification

  • Icinga Web 2 version and modules (System - About) :

  • Config validation (icinga2 daemon -C) :
    [ /]# icinga2 daemon -C
    [2024-07-22 12:29:02 +0100] information/cli: Icinga application loader (version: r2.13.6-1)
    [2024-07-22 12:29:02 +0100] information/cli: Loading configuration file(s).
    [2024-07-22 12:29:02 +0100] information/ConfigItem: Committing config item(s).
    [2024-07-22 12:29:02 +0100] information/ApiListener: My API identity: icingadirector
    [2024-07-22 12:29:03 +0100] warning/ApplyRule: Apply rule ‘Apply Parent Core a06-ss02-ab02-30’ (in /var/lib/icinga2/api/packages/director/8ed000bb-1196-4de3-ab5f-d4ce0c711250/zones.d/director-global/dependency_apply.conf: 17:1-17:61) for type ‘Dependency’ does not match anywhere!
    [2024-07-22 12:29:03 +0100] warning/ApplyRule: Apply rule ‘Apply Parent Core a06-ss02-ab02-32’ (in /var/lib/icinga2/api/packages/director/8ed000bb-1196-4de3-ab5f-d4ce0c711250/zones.d/director-global/dependency_apply.conf: 24:1-24:61) for type ‘Dependency’ does not match anywhere!
    [2024-07-22 12:29:03 +0100] warning/ApplyRule: Apply rule ‘ssh’ (in /etc/icinga2/conf.d/services.conf: 49:1-49:19) for type ‘Service’ does not match anywhere!
    [2024-07-22 12:29:03 +0100] warning/ApplyRule: Apply rule ‘SMTP 587’ (in /var/lib/icinga2/api/packages/director/8ed000bb-1196-4de3-ab5f-d4ce0c711250/zones.d/director-global/service_apply.conf: 138:1-138:24) for type ‘Service’ does not match anywhere!
    [2024-07-22 12:29:03 +0100] warning/ApplyRule: Apply rule ‘FTP 21’ (in /var/lib/icinga2/api/packages/director/8ed000bb-1196-4de3-ab5f-d4ce0c711250/zones.d/director-global/service_apply.conf: 281:1-281:22) for type ‘Service’ does not match anywhere!
    [2024-07-22 12:29:03 +0100] warning/ApplyRule: Apply rule ‘IMAP 143’ (in /var/lib/icinga2/api/packages/director/8ed000bb-1196-4de3-ab5f-d4ce0c711250/zones.d/director-global/service_apply.conf: 325:1-325:24) for type ‘Service’ does not match anywhere!
    [2024-07-22 12:29:03 +0100] warning/ApplyRule: Apply rule ‘POP3 110’ (in /var/lib/icinga2/api/packages/director/8ed000bb-1196-4de3-ab5f-d4ce0c711250/zones.d/director-global/service_apply.conf: 336:1-336:24) for type ‘Service’ does not match anywhere!
    [2024-07-22 12:29:03 +0100] warning/ApplyRule: Apply rule ‘S-IMAP 993’ (in /var/lib/icinga2/api/packages/director/8ed000bb-1196-4de3-ab5f-d4ce0c711250/zones.d/director-global/service_apply.conf: 347:1-347:26) for type ‘Service’ does not match anywhere!
    [2024-07-22 12:29:03 +0100] warning/ApplyRule: Apply rule ‘SMTP 25’ (in /var/lib/icinga2/api/packages/director/8ed000bb-1196-4de3-ab5f-d4ce0c711250/zones.d/director-global/service_apply.conf: 358:1-358:23) for type ‘Service’ does not match anywhere!
    [2024-07-22 12:29:03 +0100] warning/ApplyRule: Apply rule ‘SMTP 465’ (in /var/lib/icinga2/api/packages/director/8ed000bb-1196-4de3-ab5f-d4ce0c711250/zones.d/director-global/service_apply.conf: 369:1-369:24) for type ‘Service’ does not match anywhere!
    [2024-07-22 12:29:03 +0100] warning/ApplyRule: Apply rule ‘SPOP 995’ (in /var/lib/icinga2/api/packages/director/8ed000bb-1196-4de3-ab5f-d4ce0c711250/zones.d/director-global/service_apply.conf: 402:1-402:24) for type ‘Service’ does not match anywhere!
    [2024-07-22 12:29:03 +0100] information/ConfigItem: Instantiated 1 GraphiteWriter.
    [2024-07-22 12:29:03 +0100] information/ConfigItem: Instantiated 1 NotificationComponent.
    [2024-07-22 12:29:03 +0100] information/ConfigItem: Instantiated 1 LivestatusListener.
    [2024-07-22 12:29:03 +0100] information/ConfigItem: Instantiated 1 IdoMysqlConnection.
    [2024-07-22 12:29:03 +0100] information/ConfigItem: Instantiated 1 CheckerComponent.
    [2024-07-22 12:29:03 +0100] information/ConfigItem: Instantiated 5 UserGroups.
    [2024-07-22 12:29:03 +0100] information/ConfigItem: Instantiated 3 TimePeriods.
    [2024-07-22 12:29:03 +0100] information/ConfigItem: Instantiated 10 Users.
    [2024-07-22 12:29:03 +0100] information/ConfigItem: Instantiated 877 Services.
    [2024-07-22 12:29:03 +0100] information/ConfigItem: Instantiated 7 ServiceGroups.
    [2024-07-22 12:29:03 +0100] information/ConfigItem: Instantiated 1 ScheduledDowntime.
    [2024-07-22 12:29:03 +0100] information/ConfigItem: Instantiated 40 Zones.
    [2024-07-22 12:29:03 +0100] information/ConfigItem: Instantiated 2 NotificationCommands.
    [2024-07-22 12:29:03 +0100] information/ConfigItem: Instantiated 940 Notifications.
    [2024-07-22 12:29:03 +0100] information/ConfigItem: Instantiated 81 Hosts.
    [2024-07-22 12:29:03 +0100] information/ConfigItem: Instantiated 1 IcingaApplication.
    [2024-07-22 12:29:03 +0100] information/ConfigItem: Instantiated 15 HostGroups.
    [2024-07-22 12:29:03 +0100] information/ConfigItem: Instantiated 856 Dependencies.
    [2024-07-22 12:29:03 +0100] information/ConfigItem: Instantiated 8 Comments.
    [2024-07-22 12:29:03 +0100] information/ConfigItem: Instantiated 1 Downtime.
    [2024-07-22 12:29:03 +0100] information/ConfigItem: Instantiated 38 Endpoints.
    [2024-07-22 12:29:03 +0100] information/ConfigItem: Instantiated 1 FileLogger.
    [2024-07-22 12:29:03 +0100] information/ConfigItem: Instantiated 5 ApiUsers.
    [2024-07-22 12:29:03 +0100] information/ConfigItem: Instantiated 245 CheckCommands.
    [2024-07-22 12:29:03 +0100] information/ConfigItem: Instantiated 1 ApiListener.
    [2024-07-22 12:29:03 +0100] information/ScriptGlobal: Dumping variables to file ‘/var/cache/icinga2/icinga2.vars’
    [2024-07-22 12:29:03 +0100] information/cli: Finished validating the configuration file(s).

  • If you run multiple Icinga 2 instances, the zones.conf file (or icinga2 object list --type Endpoint and icinga2 object list --type Zone) from all affected nodes

hello team

we’re tried to add one switch in order to monitor the services , unfortunetly there nos services collected , refer to the screenshot below :

as you can see in yellow above, now we want to extract the community name from icinga2 but we couldn’t :
[ conf.d]# cat commands.conf

/* Command objects */

/* Notification Commands
 *
 * Please check the documentation for all required and
 * optional parameters.
 */

object NotificationCommand "mail-host-notification" {
  command = [ ConfigDir + "/scripts/mail-host-notification.sh" ]

  arguments += {
    "-4" = "$notification_address$"
    "-6" = "$notification_address6$"
    "-b" = "$notification_author$"
    "-c" = "$notification_comment$"
    "-d" = {
      required = true
      value = "$notification_date$"
    }
    "-f" = {
      value = "$notification_from$"
      description = "Set from address. Requires GNU mailutils (Debian/Ubuntu) or mailx (RHEL/SUSE)"
    }
    "-i" = "$notification_icingaweb2url$"
    "-l" = {
      required = true
      value = "$notification_hostname$"
    }
    "-n" = {
      required = true
      value = "$notification_hostdisplayname$"
    }
    "-o" = {
      required = true
      value = "$notification_hostoutput$"
    }
    "-r" = {
      required = true
      value = "$notification_useremail$"
    }
    "-s" = {
      required = true
      value = "$notification_hoststate$"
    }
    "-t" = {
      required = true
      value = "$notification_type$"
    }
    "-v" = "$notification_logtosyslog$"
  }

  vars += {
    notification_address = "$address$"
    notification_address6 = "$address6$"
    notification_author = "$notification.author$"
    notification_comment = "$notification.comment$"
    notification_type = "$notification.type$"
    notification_date = "$icinga.long_date_time$"
    notification_hostname = "$host.name$"
    notification_hostdisplayname = "$host.display_name$"
    notification_hostoutput = "$host.output$"
    notification_hoststate = "$host.state$"
    notification_useremail = "$user.email$"
  }
}

object NotificationCommand "mail-service-notification" {
  command = [ ConfigDir + "/scripts/mail-service-notification.sh" ]

  arguments += {
    "-4" = "$notification_address$"
    "-6" = "$notification_address6$"
    "-b" = "$notification_author$"
    "-c" = "$notification_comment$"
    "-d" = {
      required = true
      value = "$notification_date$"
    }
    "-e" = {
      required = true
      value = "$notification_servicename$"
    }
    "-f" = {
      value = "$notification_from$"
      description = "Set from address. Requires GNU mailutils (Debian/Ubuntu) or mailx (RHEL/SUSE)"
    }
    "-i" = "$notification_icingaweb2url$"
    "-l" = {
      required = true
      value = "$notification_hostname$"
    }
    "-n" = {
      required = true
      value = "$notification_hostdisplayname$"
    }
    "-o" = {
      required = true
      value = "$notification_serviceoutput$"
    }
    "-r" = {
      required = true
      value = "$notification_useremail$"
    }
    "-s" = {
      required = true
      value = "$notification_servicestate$"
    }
    "-t" = {
      required = true
      value = "$notification_type$"
    }
    "-u" = {
      required = true
      value = "$notification_servicedisplayname$"
    }
    "-v" = "$notification_logtosyslog$"
  }

  vars += {
    notification_address = "$address$"
    notification_address6 = "$address6$"
    notification_author = "$notification.author$"
    notification_comment = "$notification.comment$"
    notification_type = "$notification.type$"
    notification_date = "$icinga.long_date_time$"
    notification_hostname = "$host.name$"
    notification_hostdisplayname = "$host.display_name$"
    notification_servicename = "$service.name$"
    notification_serviceoutput = "$service.output$"
    notification_servicestate = "$service.state$"
    notification_useremail = "$user.email$"
    notification_servicedisplayname = "$service.display_name$"
  }
}

/*
 * If you prefer to use the notification scripts with environment
 * variables instead of command line parameters, you can use
 * the following commands. They have been updated from < 2.7
 * to support the new notification scripts and should help
 * with an upgrade.
 * Remove the comment blocks and comment the notification commands above.
 */

/*

object NotificationCommand "mail-host-notification" {
  command = [ ConfigDir + "/scripts/mail-host-notification.sh" ]

  env = {
    NOTIFICATIONTYPE = "$notification.type$"
    HOSTDISPLAYNAME = "$host.display_name$"
    HOSTNAME = "$host.name$"
    HOSTADDRESS = "$address$"
    HOSTSTATE = "$host.state$"
    LONGDATETIME = "$icinga.long_date_time$"
    HOSTOUTPUT = "$host.output$"
    NOTIFICATIONAUTHORNAME = "$notification.author$"
    NOTIFICATIONCOMMENT = "$notification.comment$"
    HOSTDISPLAYNAME = "$host.display_name$"
    USEREMAIL = "$user.email$"
  }
}

object NotificationCommand "mail-service-notification" {
  command = [ ConfigDir + "/scripts/mail-service-notification.sh" ]

  env = {
    NOTIFICATIONTYPE = "$notification.type$"
    SERVICENAME = "$service.name$"
    HOSTNAME = "$host.name$"
    HOSTDISPLAYNAME = "$host.display_name$"
    HOSTADDRESS = "$address$"
    SERVICESTATE = "$service.state$"
    LONGDATETIME = "$icinga.long_date_time$"
    SERVICEOUTPUT = "$service.output$"
    NOTIFICATIONAUTHORNAME = "$notification.author$"
    NOTIFICATIONCOMMENT = "$notification.comment$"
    HOSTDISPLAYNAME = "$host.display_name$"
    SERVICEDISPLAYNAME = "$service.display_name$"
    USEREMAIL = "$user.email$"
  }
}

*/

appending your prompt reply

Thanks for your question. Please consider following the markdown formatting guide for future logs and config snippets.

Unrelated to your question, your Icinga 2 version is a bit outdated, please consider updating.

The daemon validation log you have posted in your first comment contains lots of warnings about non matching apply rules. For example:

[2024-07-22 12:29:03 +0100] warning/ApplyRule: Apply rule ‘Apply Parent Core a06-ss02-ab02-30’ (in /var/lib/icinga2/api/packages/director/8ed000bb-1196-4de3-ab5f-d4ce0c711250/zones.d/director-global/dependency_apply.conf: 17:1-17:61) for type ‘Dependency’ does not match anywhere!

It seems like you have defined services which are not properly applied to hosts. As the file path in the logs implies the usage of the Icinga Director, please refer to Service Apply for Example - Icinga Director.

I hope this will help you out. Otherwise, please consider sharing the Director configuration in question.

1 Like