Icinga2 version 2.10. mail-service-notification Required parameter 'LONGDATETIME' is missing

Hi All,

I am trying to configure notification in icinga using director. I have added users, notification command, timeperiod. But while checking email notification I am getting below error.

2019-09-11 11:45:27 +0530] notice/Process: PID 22892 ('/etc/icinga2/scripts/mail-service-notification.sh') terminated with exit code 1
[2019-09-11 11:45:27 +0530] warning/PluginNotificationTask: Notification command for object 'nginx-dummyhost' (PID: 22892, arguments: '/etc/icinga2/scripts/mail-service-notification.sh') terminated with exit code 1, output: Required parameter 'LONGDATETIME' is missing.

Please help me to fix the issue

You need to check the command you use and which parameters needed. if you use the default notification script that is shipped with icinga you need these paramters set:

Services:

Required parameters:
  -d LONGDATETIME ($icinga.long_date_time$)
  -e SERVICENAME ($service.name$)
  -l HOSTNAME ($host.name$)
  -n HOSTDISPLAYNAME ($host.display_name$)
  -o SERVICEOUTPUT ($service.output$)
  -r USEREMAIL ($user.email$)
  -s SERVICESTATE ($service.state$)
  -t NOTIFICATIONTYPE ($notification.type$)
  -u SERVICEDISPLAYNAME ($service.display_name$)

Optional parameters:
  -4 HOSTADDRESS ($address$)
  -6 HOSTADDRESS6 ($address6$)
  -b NOTIFICATIONAUTHORNAME ($notification.author$)
  -c NOTIFICATIONCOMMENT ($notification.comment$)
  -i ICINGAWEB2URL ($notification_icingaweb2url$, Default: unset)
  -f MAILFROM ($notification_mailfrom$, requires GNU mailutils (Debian/Ubuntu) or mailx (RHEL/SUSE))
  -v ($notification_sendtosyslog$, Default: false)

Hosts:

[root@koelin01 ~]# /etc/icinga2/scripts/mail-host-notification.sh
Required parameter 'LONGDATETIME' is missing.

Required parameters:
  -d LONGDATETIME ($icinga.long_date_time$)
  -l HOSTNAME ($host.name$)
  -n HOSTDISPLAYNAME ($host.display_name$)
  -o HOSTOUTPUT ($host.output$)
  -r USEREMAIL ($user.email$)
  -s HOSTSTATE ($host.state$)
  -t NOTIFICATIONTYPE ($notification.type$)

Optional parameters:
  -4 HOSTADDRESS ($address$)
  -6 HOSTADDRESS6 ($address6$)
  -b NOTIFICATIONAUTHORNAME ($notification.author$)
  -c NOTIFICATIONCOMMENT ($notification.comment$)
  -i ICINGAWEB2URL ($notification_icingaweb2url$, Default: unset)
  -f MAILFROM ($notification_mailfrom$, requires GNU mailutils (Debian/Ubuntu) or mailx (RHEL/SUSE))
  -v ($notification_sendtosyslog$, Default: false)

if not you have to check the script which parameters are required.

1 Like

thanks, @anon66228339. I am using default templates. I have followed the below steps after installation of director module
1> added commands for host and service notifications using default scripts “/etc/icinga2/scripts/mail-service-notification.sh”
2> added time periods templates and objects
3> added uses group, users template, and users
4> added host group, host template
5> added notification templates and notification object using apply rule matching to host group.

Almost all settings are defaults. but after adding one host in a director I am testing custom notification there I am gettings this error. All the setup is installed on ubuntu 18 with latest icinga and icingaweb version.

Check the command in the director if it sets the longdate correct.

1 Like