"terminated with exit code 1, output: Required parameter 'LONGDATETIME' is missing"

I don’t understand why I get this error message:

terminated with exit code 1, output: Required parameter ‘LONGDATETIME’ is missing

because:

zones.d/director-global/commands.conf
object NotificationCommand “Notification Plugin Command” {
import “plugin-notification-command”
command = [ “/etc/icinga2/scripts/mail-host-notification.sh” ]
arguments += {
“-4” = {
skip_key = true
value = “$address$”
}
“-6” = {
skip_key = true
value = “$address6$”
}
“-b” = {
skip_key = true
value = “$notification.author$”
}
“-c” = “$notification.comment$”
“-d” = {
skip_key = true
value = “$icinga.long_date_time$”
}
“-f” = “$notification_mailfrom$”
“-i” = “$notification_icingaweb2url$”
“-l” = “$host.name$”
“-n” = “$host.display_name$”
“-o” = “$host.output$”
“-r” = “$user.email$”
“-s” = “$host.state$”
“-t” = {
skip_key = true
value = “$notification.type$”
}
“-v” = “$notification_logtosyslog$”
}
}

That’s in my object file:

Object ‘Notification Plugin Command’ of type ‘NotificationCommand’:
% declared in ‘/var/lib/icinga2/api/packages/director/2ad08c80-48b2-4966-ad24-72b4225c8b6f/zones.d/director-global/commands.conf’, lines 1:0-1:55

  • __name = “Notification Plugin Command”
  • arguments
    % = modified in ‘/var/lib/icinga2/api/packages/director/2ad08c80-48b2-4966-ad24-72b4225c8b6f/zones.d/director-global/commands.conf’, lines 4:5-34:5
    • -4
      • skip_key = true
      • value = “$address$”
    • -6
      • skip_key = true
      • value = “$address6$”
    • -b
      • skip_key = true
      • value = “$notification.author$”
    • -c = “$notification.comment$”
    • -d
      • skip_key = true
      • value = “$icinga.long_date_time$”
    • -f = “$notification_mailfrom$”
    • -i = “$notification_icingaweb2url$”
    • -l = “$host.name$”
    • -n = “$host.display_name$”
    • -o = “$host.output$”
    • -r = “$user.email$”
    • -s = “$host.state$”
    • -t
      • skip_key = true
      • value = “$notification.type$”
    • -v = “$notification_logtosyslog$”
  • command = [ “/etc/icinga2/scripts/mail-host-notification.sh” ]
    % = modified in ‘/var/lib/icinga2/api/packages/director/2ad08c80-48b2-4966-ad24-72b4225c8b6f/zones.d/director-global/commands.conf’, lines 3:5-3:66
  • env = null
  • execute
    % = modified in ‘methods-itl.conf’, lines 40:3-40:30
    % = modified in ‘methods-itl.conf’, lines 40:3-40:30
    • arguments = [ “notification”, “user”, “cr”, “itype”, “author”, “comment”, “resolvedMacros”, “useResolvedMacros” ]
    • deprecated = false
    • name = “Internal#PluginNotification”
    • side_effect_free = false
    • type = “Function”
  • name = “Notification Plugin Command”
  • package = “director”
  • source_location
    • first_column = 0
    • first_line = 1
    • last_column = 55
    • last_line = 1
    • path = “/var/lib/icinga2/api/packages/director/2ad08c80-48b2-4966-ad24-72b4225c8b6f/zones.d/director-global/commands.conf”
  • templates = [ “Notification Plugin Command”, “plugin-notification-command”, “plugin-notification-command” ]
    % = modified in ‘/var/lib/icinga2/api/packages/director/2ad08c80-48b2-4966-ad24-72b4225c8b6f/zones.d/director-global/commands.conf’, lines 1:0-1:55
    % = modified in ‘methods-itl.conf’, lines 39:2-39:122
    % = modified in ‘methods-itl.conf’, lines 39:2-39:122
  • timeout = 60
  • type = “NotificationCommand”
  • vars = null
  • zone = “director-global”

I really don’t see it.

The skip_key settings for the command arguments are wrong. The notification script expects them in the key value format.

But I set them without it in the director. How can I fix this?

To me it seems that you didn’t import the notification command as external command, but re-created it manually inside the Director. Select all the arguments which wrongly render skip_key one by one, and manually set skip_key=false.

arguments
% = modified in ‘/var/lib/icinga2/api/packages/director/2ad08c80-48b2-4966-ad24-72b4225c8b6f/zones.d/director-global/commands.conf’, lines 4:5-34:5
-4
skip_key = true
value = “$address$”
-6
skip_key = true
value = “$address6$”
-b
skip_key = true
value = “$notification.author$”
-c = “$notification.comment$”
-d
skip_key = true
value = “$icinga.long_date_time$”
-f = “$notification_mailfrom$”
-i = “$notification_icingaweb2url$”
-l = “$host.name$”
-n = “$host.display_name$”
-o = “$host.output$”
-r = “$user.email$”
-s = “$host.state$”
-t
skip_key = true
value = “$notification.type$”
-v = “$notification_logtosyslog$”
2 Likes

Why do have to do this. What is the main difference between the external and internal commands. What is the idea behind it?

The idea behind it is, that you sometimes have external commands that are very complex and you simply don’t want to recreate them in the director. Another thing is that there are contrib scripts and these notifications scripts, that are updated from time to time when you are updating icinga. If you recreate them with the director you will miss the changes. On the other hand you can’t change them freely inside the director, so you are more flexible if you recreate them. For the lazy ones external scripts are the way to go :wink: This way you only need to fire up the kickstart wizard from time to time.

2 Likes