I don't have any "Notification Command" option to choose from

This forum was archived to /woltlab and is now in read-only mode.
  • while creating the Notification Template.
    I don't have any "Notification Command" option to choose from. Where do I create this?

  • Notifications are not currently working with director. Hopefully there will be an update soon that will allow us to get them working!

  • You have to create a "Command" template of type "Notification Plugin Command"


    However even with the latest updates Notifications will still fail.

  • I'm looking for this too - I've been searching quite a lot to find out how to get notifications working with Director, but so far nothing has worked.

  • I've been having trouble with notifications as well and just now coming here I find out that it officially doesn't work. Sure would have been nice to know in advance, imho Director is quite the mess at the moment but hopefully things will get better.


    I have however managed to set up notifications and to have them executed, however they don't work and the mail-host-notification.sh script fails with exit code 64, output: Send options without primary recipient specified. After much digging I'm guessing this is because we cannot set the env in the NotificationCommand through director so nothing gets passed to the script and it fails. I'm going to try and set a static config file next and see if that works.


    Also, setting Time Periods doesn't work through director so there's that too.

  • I've been having trouble with notifications as well and just now coming here I find out that it officially doesn't work. Sure would have been nice to know in advance, imho Director is quite the mess at the moment but hopefully things will get better.


    I have however managed to set up notifications and to have them executed, however they don't work and the mail-host-notification.sh script fails with exit code 64, output: Send options without primary recipient specified. After much digging I'm guessing this is because we cannot set the env in the NotificationCommand through director so nothing gets passed to the script and it fails. I'm going to try and set a static config file next and see if that works.


    Also, setting Time Periods doesn't work through director so there's that too.

    It would be handy if you could tell me how you managed to get things working. What commands/configuration have you set up for it?

  • Hmm lets see if I can do that...


    In Director, under commands, Add Command of type "Notification Plugin Command" and the command /etc/icinga2/scripts/mail-host-notification.sh. You can also create a separate one for services and use mail-service-notification.sh



    Then under Notifications you first create a template with what you need, then a Object, then an apply rule, under Object you will now have the command on the pull-down list.


    Also, you must pull the newest Director from github as the older ones didn't generate any notification config files no matter what you configured in Director... but of course even with all this it still doesn't work, but its getting there.

  • I took the generated notification_apply.conf notification_templates.conf and commands.conf from director and moved them to static files, and then I added the env = { .... } under the NotificationCommand in commands.conf and renamed everything so it doesn't conflict with the ones from director (and thus leaving the director config intact) and notifications work as expected!!


    So that is the only thing missing in director for notifications to work, perhaps I'll submit a request to them to add this.

  • I took the generated notification_apply.conf notification_templates.conf and commands.conf from director and moved them to static files, and then I added the env = { .... } under the NotificationCommand in commands.conf and renamed everything so it doesn't conflict with the ones from director (and thus leaving the director config intact) and notifications work as expected!!


    So that is the only thing missing in director for notifications to work, perhaps I'll submit a request to them to add this.

    For me it doesn't generate the notification_apply.conf and notification_templates.conf, but I do get the commands.conf.
    By manually editing the static notification.conf/users.conf file, it however did work without issues and we're getting mails. The issue now is that we have to do everything manually, but still... it works ;)!

  • I'm facing the same problem right now.
    Started with Icinga2 from scratch and Director in order to make things faster when adding new hosts and basic checks (for a team that never really used any monitoring solution until now).
    Director looked like a much simpler way of doing the job right until everyone will learn the configuration language and implement source control.


    The notification part is one of the basic things you want to setup on a monitoring system. I created user and notification objects, yet it doesn't seems to be enough.


    Is it supposed to be edited by hand in conf files or Director will be able to apply notification settings for each host object in the future?
    I would love to see some basic documentation for this part.

  • I'm facing the same problem right now.

    Which one?

    [..] or Director will be able to apply notification settings for each host object in the future?

    This should already work fine. Choose your notification object, add an apply rule. Latest GIT master is strongly suggested in case you want to work with notifications. Btw, 1.1.0 is scheduled for release within a week.

    I would love to see some basic documentation for this part.

    That's still missing, will be made available. Notifications are working fine recently, I have already been made aware of a related blog post. It's German, but I guess Google Translate might help. And the screenshots should be self-explaining. It is currently not possible to pass environment variables to commands using the Director, regardless of the command type. And the Icinga 2 sample notifications scripts are based on such. But this shouldn't stop anyone from sending notifications. The linked blog post ships modified scripts able to work with normal command line parameters to solve this.


    Cheers,
    Thomas

  • while creating the Notification Template.
    I don't have any "Notification Command" option to choose from. Where do I create this?

    Could you please let us know whether you have been able to solve your
    issue?

    You have to create a "Command" template of type "Notification Plugin Command"

    This should probably have been the answer to your question. Please let us know whether it helped, so that we can close this thread. Latest comments are all but related to your initial problem, discussion starts getting confusing.


    Cheers,
    Thomas


    NB: And please pull the latest master, many other notification-related little issues have been fixed in the meantime.

  • @TomGelf thanks you for the quick reply! I really like to express my apparitions for your work on this module and community support.
    I'm checking the git repo from time to time and doing a pull.


    If things don't get as expected, I will open a thread of my own with the details.

  • This should probably have been the answer to your question. Please let us know whether it helped, so that we can close this thread. Latest comments are all but related to your initial problem, discussion starts getting confusing.


    Could you please let us know whether you have been able to solve yourissue?

    This should probably have been the answer to your question. Please let us know whether it helped, so that we can close this thread. Latest comments are all but related to your initial problem, discussion starts getting confusing.
    Cheers,
    Thomas


    NB: And please pull the latest master, many other notification-related little issues have been fixed in the meantime.

    I can create the "Command" Template with no issues but the Object gives error on Deploy.


    critical/config: Error: Validation failed for object 'CoquiNotificationCom' of type 'NotificationCommand'; Attribute 'zone': Object 'director-global' of type 'Zone' does not exist.Location: in /var/lib/icinga2/api/packages/director/icinga.coqui.com-1466535483-0/zones.d/director-global/commands.conf: 3:1-3:49/var/lib/icinga2/api/packages/director/icinga.coqui.com-1466535483-0/zones.d/director-global/commands.conf(1): library "methods"/var/lib/icinga2/api/packages/director/icinga.coqui.com-1466535483-0/zones.d/director-global/commands.conf(2): /var/lib/icinga2/api/packages/director/icinga.coqui.com-1466535483-0/zones.d/director-global/commands.conf(3): object NotificationCommand "CoquiNotificationCom" { ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^/var/lib/icinga2/api/packages/director/icinga.coqui.com-1466535483-0/zones.d/director-global/commands.conf(4): import "CoquiNotificationTemp"/var/lib/icinga2/api/packages/director/icinga.coqui.com-1466535483-0/zones.d/director-global/commands.conf(5):

  • ^^^


    I had this issue also, go to Director -> Zones, Add zone, name: director-global, global = yes and save/deploy, then I think I went into CLI and ran "icingacli director zone create director-global --is_global --object_type external_object" and after that restart icinga2.


    The issue is described in https://dev.icinga.org/issues/11525 which comes up if you google for the error you are receiving: Object 'director-global' of type 'Zone' does not exist

  • ^^^


    I had this issue also, go to Director -> Zones, Add zone, name: director-global, global = yes and save/deploy, then I think I went into CLI and ran "icingacli director zone create director-global --is_global --object_type external_object" and after that restart icinga2.


    The issue is described in https://dev.icinga.org/issues/11525 which comes up if you google for the error you are receiving: Object 'director-global' of type 'Zone' does not exist

    Thanks for that one!


    Now while creating the Apply Rule I get the following:


    critical/config: Error: 'apply' target type is ambiguous (can be one of 'Host' or 'Service'): use 'to' to specify a typeLocation: in /var/lib/icinga2/api/packages/director/icinga.coqui.com-1466693072-0/zones.d/director-global/notification_apply.conf: 1:0-1:17/var/lib/icinga2/api/packages/director/icinga.coqui.com-1466693072-0/zones.d/director-global/notification_apply.conf(1): apply Notification "UnixNotification" { ^^^^^^^^^^^^^^^^^^/var/lib/icinga2/api/packages/director/icinga.coqui.com-1466693072-0/zones.d/director-global/notification_apply.conf(2): import "UnixNotificationTemplate"/var/lib/icinga2/api/packages/director/icinga.coqui.com-1466693072-0/zones.d/director-global/notification_apply.conf(3):

  • OK. Assigned it to Hosts and now this:


    critical/config: Error: Validation failed for object '!UnixNotificationObject' of type 'Notification'; Attribute 'host_name': Attribute must not be empty.Location: in /var/lib/icinga2/api/packages/director/icinga.coqui.com-1466693918-1/zones.d/icinga.coqui.com/notifications.conf: 1:0-1:43/var/lib/icinga2/api/packages/director/icinga.coqui.com-1466693918-1/zones.d/icinga.coqui.com/notifications.conf(1): object Notification "UnixNotificationObject" { ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^/var/lib/icinga2/api/packages/director/icinga.coqui.com-1466693918-1/zones.d/icinga.coqui.com/notifications.conf(2): import "UnixNotificationTemplate"/var/lib/icinga2/api/packages/director/icinga.coqui.com-1466693918-1/zones.d/icinga.coqui.com/notifications.conf(3): critical/config: 1 error

  • Ups, sorry for that.


    Here goes the log error.



    Attached a screenshot for better viewing.