Hello
I am tryin to configure xmpp notification (on Debian 11)
I installed XMPP Notifications :: Icinga Exchange and test it in CLI it’s worked great
But I’m unable to use it with icinga
When I try to send notification test from WebUI
I’ve got error in icinga log
[2023-02-05 15:35:05 +0100] warning/PluginNotificationTask: Notification command for object 'host.fr' (PID: -1, arguments: 'sh' '-c' '') terminated with exit code 3, output: Error: Non-optional macro 'notification_output' used in argument '-O' is missing.
I tryin to modify the script to make this argument not needed but it’s another error with argument missing …
sudo icinga2 --version
icinga2 - The Icinga 2 network monitoring daemon (version: r2.13.6-1)
System information:
Platform: Debian GNU/Linux
Platform version: 11 (bullseye)
Kernel: Linux
Kernel version: 5.10.0-20-amd64
Architecture: x86_64
Build information:
Compiler: GNU 10.2.1
Build host: runner-hh8q3bz2-project-575-concurrent-0
OpenSSL version: OpenSSL 1.1.1n 15 Mar 2022
Application information:
General paths:
Config directory: /etc/icinga2
Data directory: /var/lib/icinga2
Log directory: /var/log/icinga2
Cache directory: /var/cache/icinga2
Spool directory: /var/spool/icinga2
Run directory: /run/icinga2
Disabled features: command compatlog debuglog elasticsearch gelf graphite ido-pgsql influxdb influxdb2 livestatus opentsdb perfdata statusdata syslog
Enabled features: api checker icingadb mainlog notification
Notification is activated
I’ve got set the template conf like this (follow the doc of the script)
template Notification "host-jabber-notification" {
command = "jabber-notification-command"
states = [ Up, Down]
types = [ Problem, Acknowledgement, Recovery, Custom,
FlappingStart, FlappingEnd,
DowntimeStart, DowntimeEnd, DowntimeRemoved ]
vars += {
notification_xmpp_password = "password"
notification_xmpp_sender = "icinga@host.tld"
notification_output = "$host.output$"
notification_state = "$host.state$"
}
period = "24x7"
}
template Notification "service-jabber-notification" {
command = "jabber-notification-command"
states = [ OK, Warning, Critical, Unknown ]
types = [ Problem, Acknowledgement, Recovery, Custom,
FlappingStart, FlappingEnd,
DowntimeStart, DowntimeEnd, DowntimeRemoved ]
vars += {
notification_xmpp_password = "password"
notification_xmpp_sender = "icinga@host.tld"
notification_output = "$service.output$"
notification_state = "$service.state$"
}
period = "24x7"
}
And the command conf
Object 'jabber-notification-command' of type 'NotificationCommand':
% declared in '/etc/icinga2/zones.d/master/commands.conf', lines 222:1-222:56
* __name = "jabber-notification-command"
* arguments
% = modified in '/etc/icinga2/zones.d/master/commands.conf', lines 225:3-276:3
* -D
* required = true
* value = "$notification_date$"
* -H
* required = true
* value = "$notification_hostname$"
* -O
* required = true
* value = "$notification_output$"
* -S
* required = true
* value = "$notification_state$"
* -a = "$notification_author$"
* -c = "$notification_comment$"
* -d
* value = "$notification_hostdisplayname$"
* -e
* value = "$notification_servicename$"
* -f
* description = "JID to send from"
* required = true
* value = "$notification_xmpp_sender$"
* -p
* description = "Password for XMPP account"
* required = true
* value = "$notification_xmpp_password$"
* -r
* required = true
* value = "$notification_userjid$"
* -t
* required = true
* value = "$notification_type$"
* -u
* value = "$notification_servicedisplayname$"
* command = [ "/etc/icinga2/scripts/jabber-notification.py" ]
% = modified in '/etc/icinga2/zones.d/master/commands.conf', lines 223:3-223:61
* env = null
* execute
% = modified in 'methods-itl.conf', lines 23:3-23:30
* arguments = [ "notification", "user", "cr", "itype", "author", "comment", "resolvedMacros", "useResolvedMacros" ]
* deprecated = false
* name = "Internal#PluginNotification"
* side_effect_free = false
* type = "Function"
* name = "jabber-notification-command"
* package = "_etc"
* source_location
* first_column = 1
* first_line = 222
* last_column = 56
* last_line = 222
* path = "/etc/icinga2/zones.d/master/commands.conf"
* templates = [ "jabber-notification-command", "plugin-notification-command" ]
% = modified in '/etc/icinga2/zones.d/master/commands.conf', lines 222:1-222:56
% = modified in 'methods-itl.conf', lines 22:2-22:122
* timeout = 60
* type = "NotificationCommand"
* vars
% = modified in '/etc/icinga2/zones.d/master/commands.conf', lines 278:3-287:3
* notification_author = "$notification.author$"
* notification_comment = "$notification.comment$"
* notification_date = "$icinga.long_date_time$"
* notification_hostdisplayname = "$host.display_name$"
* notification_hostname = "$host.name$"
* notification_servicename = "$service.name$"
* notification_type = "$notification.type$"
* notification_userjid = "$userjid$"
* zone = "master"
And users conf
object User "myuser" {
import "generic-user"
vars.userjid = "mycontact@host.tld"
display_name = "user"
groups = [ "icingaadmins" ]
email = bbb@host.tld"
}
object UserGroup "icingaadmins" {
display_name = "Icinga 2 Admin Group"
}
And in notifications.conf I apply it like this
apply Notification "jabber-host" to Host {
command = "jabber-notification-command"
users = [ "myuser" ]
assign where true
}
apply Notification "jabber-service" to Service {
command = "jabber-notification-command"
users = [ "myuser" ]
assign where true
}
I tryin to switch command use to {service,host}-jabber-notification insteed of jabber-notification-command in command section but unble to relaod icinge because
usage!jabber-service’ of type ‘Notification’; Attribute ‘command’: Object ‘service-jabber-notification’ of type ‘NotificationCommand’ does not exist.
If someone have any idea