NotificationCommand doesn't inherit arguments from its templates?

We are attempting to set up a set of notification commands based around a common template. My goal was to build the notification commands and their templates completely in Icinga Director. I built a NotificationCommand template and created a number of arguments that need to be passed to the command. See below:

template NotificationCommand "NQ2 Host Notification Command Template" {
    import "plugin-notification-command"
    import "NQ2 Notification Command Template"

    arguments += {
        check_type = {
            description = "Is the alert for a host or a service?"
            order = 0
            repeat_key = false
            required = true
            skip_key = true
            value = "host"
        }
        contact_email = {
            description = "Email address to send notification to (Should be depricated when page is through NQ2)"
            order = 13
            repeat_key = false
            required = true
            skip_key = true
        }
        format_type = {
            description = "Are we expecting to ticket or page?"
            order = 1
            repeat_key = false
            required = true
            skip_key = true
        }
        host_ack_author = {
            description = "User who acknowledged the alert"
            order = 10
            repeat_key = false
            required = true
            skip_key = true
        }
        host_ack_comment = {
            description = "Comment left by user when acknowledging an alert"
            order = 11
            repeat_key = false
            required = true
            skip_key = true
        }
        host_address = {
            description = "Either hostname or ip address for the host"
            order = 5
            repeat_key = false
            required = true
            skip_key = true
            value = "$host.address$"
        }
        host_output = {
            description = "The last check’s output"
            order = 6
            repeat_key = false
            required = true
            skip_key = true
            value = "$host.output$"
        }
        host_state = {
            description = "State of the host (UP or DOWN)"
            order = 4
            repeat_key = false
            required = true
            skip_key = true
            value = "$host.state$"
        }
        hostname = {
            description = "Hostname"
            order = 3
            repeat_key = false
            required = true
            skip_key = true
            value = "$host.name$"
        }
        icinga_url = {
            description = "URL for icinga-master"
            order = 16
            repeat_key = false
            required = true
            skip_key = true
            value = "icinga.corp.net"
        }
        long_date_time = {
            description = "The last state change’s timestamp."
            order = 7
            repeat_key = false
            required = true
            skip_key = true
        }
        long_host_output = {
            order = 9
            repeat_key = false
            required = true
            skip_key = true
        }
        notification_type = {
            description = "What type of notification should be sent"
            order = 2
            repeat_key = false
            required = true
            skip_key = true
            value = "$notification.type$"
        }
        runbook = {
            description = "Runbook"
            order = 8
            repeat_key = false
            required = true
            skip_key = true
        }
        ta_sitename = {
            description = "Zone the host is located in"
            order = 12
            repeat_key = false
            required = true
            skip_key = true
            value = "$host.zone$"
        }
        team_name = {
            description = "Team who owns the server"
            order = 14
            repeat_key = false
            required = true
            skip_key = true
            value = "$host.vars.team$"
        }
        ticket_priority = {
            description = "Level of priority for a ticket (if generating one)"
            order = 15
            repeat_key = false
            required = true
            skip_key = true
        }
    }
}

However, when I create a notification command that inherits that template, it doesn’t inherit any of the arguments. Is this expected behavior? I would think this defeats a lot of the usefulness of notification templates.

object NotificationCommand "NQ Host Ticket Notification Command" {
    import "plugin-notification-command"
    import "NQ2 Host Notification Command Template"

}

Versions:

[root@icinga-master01d ~]# icingacli director --version
Icinga Web 2  2.7.3
Git Commit    06cabfe8ba28cf545a42c92f25484383191a4e51
PHP Version   7.1.30
MODULE       VERSION
director     master
incubator    0.5.0
ipl          v0.4.0
monitoring   2.7.3
reactbundle  0.7.0

Did you click on the Show resolved button?
If not, the Director will only show the imported templates, not their content.
Before clickingimage

After clicking image

Unfortunately, when I try to do that, Icinga web/director throws an error. Working to find the source and resolve that now:

A single CommandArgument cannot be resolved

#0 /usr/share/icingaweb2/modules/director/library/Director/Objects/IcingaArguments.php(309): Icinga\Module\Director\Objects\IcingaCommandArgument->toPlainObject(Boolean, Boolean, NULL, Boolean)
#1 /usr/share/icingaweb2/modules/director/library/Director/Objects/IcingaObject.php(2860): Icinga\Module\Director\Objects\IcingaArguments->toPlainObject(Boolean, Boolean)
#2 /usr/share/icingaweb2/modules/director/library/Director/Web/ObjectPreview.php(46): Icinga\Module\Director\Objects\IcingaObject->toPlainObject(Boolean)
#3 /usr/share/icingaweb2/modules/director/library/Director/Web/Controller/ObjectController.php(155): Icinga\Module\Director\Web\ObjectPreview->renderTo(Object(Icinga\Module\Director\Controllers\CommandController))
#4 /usr/share/icingaweb2/modules/director/application/controllers/CommandController.php(55): Icinga\Module\Director\Web\Controller\ObjectController->renderAction()
#5 /usr/share/icingaweb2/library/vendor/Zend/Controller/Action.php(507): Icinga\Module\Director\Controllers\CommandController->renderAction()
#6 /usr/share/php/Icinga/Web/Controller/Dispatcher.php(76): Zend_Controller_Action->dispatch(String)
#7 /usr/share/icingaweb2/library/vendor/Zend/Controller/Front.php(937): Icinga\Web\Controller\Dispatcher->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#8 /usr/share/php/Icinga/Application/Web.php(300): Zend_Controller_Front->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#9 /usr/share/php/Icinga/Application/webrouter.php(99): Icinga\Application\Web->dispatch()
#10 /usr/share/icingaweb2/public/index.php(4): require_once(String)
#11 {main}

Unfortunately it does not appear that the arguments are being imported:

Before:

object NotificationCommand "NQ Host Ticket Notification Command" {
    import "plugin-notification-command"
    import "NQ2 Host Notification Command Template"

}

After:

object NotificationCommand "NQ Host Ticket Notification Command" {
    import "plugin-notification-command"
    command = [ "/home/icingadirector/notify-via-nq2" ]
}

Looking through the config snippet in your first post again, I noticed that many of the arguments don’t have a value set at all.
I’m sure, but this does not sound very useful and/or correct.

Also you still have a hostname of your employer/customer in your example at the icinga_url argument. May want to obscure that :wink:

Also²: Please use a release version of the Director instead of the master branch. The master may contain bug fixes that introduce new unexpected bugs.

Hi,

Can you clarify on that, do you mean the final rendered configuration object, or is that a visual thing inside the Director?

Cheers,
Michael