title: Icinga2 notification just once on state change
body: <p>I have set up icinga2 to monitor a few services with different intervals, so one service might be checked every 10 seconds. If it gives a critical error I will receive a notification, but I will receive it every 10 seconds if the error persists, or until I acknowledge it. I just want to receive it once for each state change. Then maybe after a specified time again, but it is not that important.</p>
  
  <p>Here is my config:</p>
  
  <p>This is more or less the standard template.conf, but I have added the "interval=0s", because I read that it should prevent notifications from being sent multiple times.</p>
  
  <pre><code>template Notification "mail-service-notification" {
    command = "mail-service-notification"
  
    interval = 0s
  
    states = [ OK, Critical ]
    types = [ Problem, Acknowledgement, Recovery, Custom,
          FlappingStart, FlappingEnd,
          DowntimeStart, DowntimeEnd, DowntimeRemoved ]
  
    vars += {
      notification_logtosyslog = false
    }
  
    period = "24x7"
  }
  </code></pre>
  
  <p>And here is the part of the notification.conf that includes the template:</p>
  
  <pre><code>object NotificationCommand "telegram-service-notification" {
      import "plugin-notification-command"
  
      command = [ SysconfDir + "/icinga2/scripts/telegram-service-notification.sh" ]
  
      env = {
          NOTIFICATIONTYPE = "$notification.type$"
          SERVICEDESC = "$service.name$"
          HOSTNAME = "$host.name$"
          HOSTALIAS = "$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$"
          TELEGRAM_BOT_TOKEN = TelegramBotToken
          TELEGRAM_CHAT_ID = "$user.vars.telegram_chat_id$"
      }
  }
  
  apply Notification "telegram-icingaadmin" to Service {
      import "mail-service-notification"
      command = "telegram-service-notification"
      user_groups = [ "icingaadmins" ]
      assign where host.name
  }
  </code></pre>