Re: [icinga-users] NotificationCommand arguments not inherited

2016-10-18 Thread Lee Clemens
On 10/18/2016 08:50 AM, Markus Frosch wrote:
> On 17.10.2016 20:20, Lee Clemens wrote:
>> arguments = {
>> "--host-output" = {
>> required = true
>> value = "$host.output$"
>> }
>> "--host-state" = {
>> required = true
>> value = "$host.state$"
>> }
>> }
> 
> Hey Lee,
> your problem is that you are *replacing* arguments there.
> 
> What you should do: ( += )
> 
> Regards
> Markus Frosch
> 

Thank you Markus! That makes perfect sense. I created 
https://dev.icinga.org/issues/12941 to address being able to append (vs 
replace) arguments in Director.

Thanks,
Lee Clemens
___
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users


Re: [icinga-users] NotificationCommand arguments not inherited

2016-10-18 Thread Markus Frosch
On 17.10.2016 20:20, Lee Clemens wrote:
> arguments = {
> "--host-output" = {
> required = true
> value = "$host.output$"
> }
> "--host-state" = {
> required = true
> value = "$host.state$"
> }
> }

Hey Lee,
your problem is that you are *replacing* arguments there.

What you should do: ( += )

arguments += {
"--host-output" = {
required = true
value = "$host.output$"
}
"--host-state" = {
required = true
value = "$host.state$"
}
}

So you are adding values to the existing dictionary, like a merge (you would 
replace keys that have the same name).

Regards
Markus Frosch
-- 
Icinga Open Source Monitoring
https://www.icinga.org
___
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users


[icinga-users] NotificationCommand arguments not inherited

2016-10-17 Thread Lee Clemens
Hello,

I created the following Notification Plugin Commands via Icinga2 Director, but 
the arguments from the parent template don't appear to be used when the command 
is executed.

- Email Template
- Email Host Template
- Standard Email Host (object)


template NotificationCommand "Email Template" {
import "plugin-notification-command"
arguments = {
"--host-address" = {
required = true
value = "$host.address$"
}
"--host-display-name" = {
required = true
value = "$host.display_name$"
}
"--host-name" = {
required = true
value = "$host.name$"
}
"--notification-author" = {
required = true
value = "$notification.author$"
}
"--notification-comment" = {
required = true
value = "$notification.comment$"
}
"--notification-type" = {
required = true
value = "$notification.type$"
}
"--user-email" = {
required = true
value = "$user.email$"
}
}
}



template NotificationCommand "Email Host Template" {
import "plugin-notification-command"
import "Email Template"

command = [ "/etc/icinga2/scripts/mail-host.py" ]
arguments = {
"--host-output" = {
required = true
value = "$host.output$"
}
"--host-state" = {
required = true
value = "$host.state$"
}
}
}


object NotificationCommand "Standard Email Host" {
import "plugin-notification-command"
import "Email Host Template"

}


[2016-10-17 12:38:02 -0400] warning/PluginNotificationTask: Notification 
command for object 'hostname.example.com' (PID: 8596, arguments: 
'/etc/icinga2/scripts/mail-host.py' '--host-output' 'PING CRITICAL - Packet 
loss = 100%' '--host-state' 'DOWN') terminated with exit code 2, output: usage: 
mail-host.py [-h] --host-name HOST_NAME --host-address HOST_ADDRESS 


As you can see from the warning message, only the two arguments directly on 
"Email Host Template" where used when executing the command.
Since it imports "Email Template", I expected the other arguments to be passed 
along as well.

Should all of the arguments be inherited and used through when it is executed?

Changing it to:

object NotificationCommand "Standard Email Host" {
import "plugin-notification-command"
import "Email Template"
import "Email Host Template"

}


Didn't resolve the issue either, with the same two arguments being the only 
ones used executing the command.

Happy to file a bug if that's the case.

Icinga2 2.5.4

Thanks,
Lee Clemens
___
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users