Notifications in Icinga2 Director "Required parameter ‘LONGDATETIME’ is missing"

Hey there,

I’m pretty new in this Community and already browsed alot for similar Topics, but didn’t find any solution that worked for me yet.

I’m configuring Notifications in Icinga2 Director, which will be part of my final exam. But I can’t get it working, because I always get that error, showing like this in my logs:

[2021-03-24 16:03:07 +0100] information/Notification: Sending reminder 'Problem' notification 'ubuntu!apt!Service-Notifications' for user 'test'

[2021-03-24 16:03:07 +0100] information/Notification: Completed sending 'Problem' notification 'ubuntu!apt!Service-Notifications' for checkable 'ubuntu!apt' and user 'test' using command 'mail-service-notification.sh'.

[2021-03-24 16:03:07 +0100] warning/PluginNotificationTask: Notification command for object 'ubuntu!apt' (PID: 18909, arguments: '/etc/icinga2/scripts/mail-service-notification.sh') terminated with exit code 1, output: Required parameter 'LONGDATETIME' is missing.

What I have done so far to configure Notifications:

  • Created a Timeperiod for a 24x7 notify, monday-sunday
  • Created a group icingaadmin, with myself as user in it. My user has a valid email there
  • Created the command for the 2 mail-scripts mail-host-notification.sh and mail-service-notification.sh. My example of the command as shown below for hosts.

  • Created the Notification itself.
  • Mailing via -mail -s works perfect, and I’m also able to send a scripted mail calling the script itself in the folder.

I’m pretty stuck in here and thinking about it for a while now. Strange thing is, that sometimes the notification itself isn’t executed in the logs or the director, even if it should. Sending custom notifications doesn’t work as well. Does anyone have an idea what I’m missing?

Hi @Sil3nce

if you enable the debuglog in icinga2, you will see what exact command is executed.

icinga2 feature enable debuglog

The debug log is located in /var/log/icinga2.

Edit: Did you create the command arguments for the notification command in director?

Hey @ritzgu , thanks for the fast reply

I did create the external command, if that’s what you mean:

I’m wondering if the director itself isn’t able to open the script, because longdatetime is the first param needed. Or if I kind of have to create all the params through fields myself? I pretty much created all of it through the guides provided from icinga.

I’m now just working through the debug logs and will provide you with informations as soon as I get them.

What I mean is: Did you add all arguments in the “Arguments” tab?

1 Like

No I didn’t add them, thanks for this input. I will work it out.

1 Like

I think this will solve your problem. :slight_smile: Good luck with your final thesis.

Kind regards
@ritzgu

Hey @ritzgu , it was exactly this fault. Thanks for helping me out, cheers!
Kind regards