Could you please give me a hint what colon I need to delete?
Do I need to delete the “https:” ?
[2022-07-28 12:30:47 +0000] warning/PluginNotificationTask: Notification command for object 'test' (PID: 1271034, arguments: '/usr/bin/env' 'ROCKETCHAT_WEBHOOK_URL="https://URL/hooks/6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"' '/etc/icinga2/scripts/notify_rocketchat' '-host.action_url' 'https://URL/hooks/6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' '-host.display_name' 'test' '-host.name' 'test' '-host.output' 'PING CRITICAL - Packet loss = 100%' '-host.state' 'DOWN' '-icinga.timet' '1659011447') terminated with exit code 2, output: parse "\"https://URL/hooks/6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"": first path segment in URL cannot contain colon
delete the service url here and try again
vars.rocketchat_service_action_url = "https://URL/hooks/6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Hello, I already did - the apply.conf looks like this rn:
zones.d/s060w44/notification_apply.conf
apply Notification "host rocketchat" to Host {
import "rocketchat-notifiy-template-host"
assign where match("*", host.name)
states = [ Down, Up ]
types = [ Acknowledgement, Custom, Problem, Recovery ]
users = [ "rocket.chat" ]
vars.rocketchat_host_action_url = "https://URL/hooks/6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
restart icinga2 and post the log of a host notification
Hello,
[2022-07-29 07:03:17 +0000] notice/Process: PID 1609543 ('/usr/bin/env' 'ROCKETCHAT_WEBHOOK_URL="https://URL/hooks/6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"' '/etc/icinga2/scripts/notify_rocketchat' '-host.action_url' 'https://URL/hooks/6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' '-host.display_name' 'test' '-host.name' 'test' '-host.output' 'PING CRITICAL - Packet loss = 100%' '-host.state' 'DOWN' '-icinga.timet' '1659078197') terminated with exit code 2
[2022-07-29 07:03:17 +0000] warning/PluginNotificationTask: Notification command for object 'test' (PID: 1609543, arguments: '/usr/bin/env' 'ROCKETCHAT_WEBHOOK_URL="https://URL/hooks/6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"' '/etc/icinga2/scripts/notify_rocketchat' '-host.action_url' 'https://URL/hooks/6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' '-host.display_name' 'test' '-host.name' 'test' '-host.output' 'PING CRITICAL - Packet loss = 100%' '-host.state' 'DOWN' '-icinga.timet' '1659078197') terminated with exit code 2, output: parse "\"https://URL/hooks/6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"": first path segment in URL cannot contain colon
zones.d/director-global/commands.conf
object NotificationCommand "rocketchat host" {
import "plugin-notification-command"
command = [
"/usr/bin/env",
"ROCKETCHAT_WEBHOOK_URL=\"https://URL/hooks/6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"",
"/etc/icinga2/scripts/notify_rocketchat"
]
arguments += {
"-host.action_url" = "$rocketchat_host_action_url$"
"-host.display_name" = "$host.display_name$"
"-host.name" = "$host.name$"
"-host.output" = "$host.output$"
"-host.state" = "$host.state$"
"-icinga.timet" = "$icinga.timet$"
"-service.action_url" = "$rocketchat_service_action_url$"
"-service.display_name" = "$service.display_name$"
"-service.name" = "$service.name$"
"-service.output" = "$service.output$"
"-service.state" = "$service.state$"
}
vars.rocketchat_host_action_url = "$host.action_url$"
vars.rocketchat_service_action_url = "$service.action_url$"
}
zones.d/s060w44/notification_templates.conf
template Notification "rocketchat-notifiy-template-host" {
command = "rocketchat host"
states = [ Critical, OK ]
types = [ Acknowledgement, Problem, Recovery ]
users = [ "rocket.chat" ]
vars.rocketchat_host_action_url = "https://URL/hooks/6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
zones.d/s060w44/notification_apply.conf
apply Notification "host rocketchat" to Host {
import "rocketchat-notifiy-template-host"
assign where match("*", host.name)
states = [ Down, Up ]
types = [ Acknowledgement, Custom, Problem, Recovery ]
users = [ "rocket.chat" ]
vars.rocketchat_host_action_url = "https://URL/hooks/6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
remove the
vars.rocketchat_host_action_url = “https://URL/hooks/6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”
from
zones.d/s060w44/notification_apply.conf
and
zones.d/s060w44/notification_templates.conf
it causes troubles
Hello, I still get the error:
[2022-07-29 07:57:18 +0000] warning/PluginNotificationTask: Notification command for object 'test' (PID: 1626783, arguments: '/usr/bin/env' 'ROCKETCHAT_WEBHOOK_URL="https://URL/hooks/6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"' '/etc/icinga2/scripts/notify_rocketchat' '-host.action_url' 'https://URL/hooks/6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' '-host.display_name' 'test' '-host.name' 'test' '-host.output' 'PING CRITICAL - Packet loss = 100%' '-host.state' 'DOWN' '-icinga.timet' '1659081438') terminated with exit code 2, output: parse "\"https://URL/hooks/6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"": first path segment in URL cannot contain colon
object NotificationCommand "rocketchat host" {
import "plugin-notification-command"
command = [
"/usr/bin/env",
"ROCKETCHAT_WEBHOOK_URL=\"https://URL/hooks/6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"",
"/etc/icinga2/scripts/notify_rocketchat"
]
arguments += {
"-host.action_url" = "$rocketchat_host_action_url$"
"-host.display_name" = "$host.display_name$"
"-host.name" = "$host.name$"
"-host.output" = "$host.output$"
"-host.state" = "$host.state$"
"-icinga.timet" = "$icinga.timet$"
"-service.action_url" = "$rocketchat_service_action_url$"
"-service.display_name" = "$service.display_name$"
"-service.name" = "$service.name$"
"-service.output" = "$service.output$"
"-service.state" = "$service.state$"
}
vars.rocketchat_host_action_url = "$host.action_url$"
vars.rocketchat_service_action_url = "$service.action_url$"
}
zones.d/s060w44/notification_templates.conf
template Notification "rocketchat-notifiy-template-host" {
command = "rocketchat host"
states = [ Critical, OK ]
types = [ Acknowledgement, Problem, Recovery ]
users = [ "rocket.chat" ]
vars.rocketchat_host_action_url = "https://URL/hooks/6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
zones.d/s060w44/notification_apply.conf
apply Notification "host rocketchat" to Host {
import "rocketchat-notifiy-template-host"
assign where match("*", host.name)
states = [ Down, Up ]
types = [ Acknowledgement, Custom, Problem, Recovery ]
users = [ "rocket.chat" ]
vars.rocketchat_host_action_url = "https://URL/hooks/6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
remove the!!!
vars.rocketchat_host_action_url = “https://URL/hooks/6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”
!!!
restart icinga2 and post the log of a host notification
After recreating the command I can finally remove it:
zones.d/director-global/commands.conf
object NotificationCommand "rocketchat host" {
import "plugin-notification-command"
command = [
"/usr/bin/env",
"ROCKETCHAT_WEBHOOK_URL=\"https://URL/hooks/6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"",
"/etc/icinga2/scripts/notify_rocketchat"
]
arguments += {
"-host.action_url" = "$rocketchat_host_action_url$"
"-host.display_name" = "$host.display_name$"
"-host.name" = {
skip_key = true
value = "$host.name$"
}
"-host.output" = "$host.output$"
"-host.state" = "$host.state$"
"-icinga.timet" = "$icinga.timet$"
"-service.action_url" = "$rocketchat_service_action_url$"
"-service.display_name" = "$service.display_name$"
"-service.name" = "$service.name$"
"-service.output" = "$service.output$"
"-service.state" = "$service.state$"
}
}
[2022-07-29 10:31:24 +0000] warning/PluginNotificationTask: Notification command for object 'test' (PID: 1674417, arguments: '/usr/bin/env' 'ROCKETCHAT_WEBHOOK_URL="https://URL/hooks/6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"' '/etc/icinga2/scripts/notify_rocketchat' '-host.action_url' 'https://URL/hooks/6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' '-host.display_name' 'test' 'test' '-host.output' 'PING CRITICAL - Packet loss = 100%' '-host.state' 'DOWN' '-icinga.timet' '1659090684') terminated with exit code 2, output: -host.* is given, missing some of: -host.name, -host.state
no you didn’t or you didnt restart because it hostaction url is still in your log:
-host.action_url’ 'https://UR…
Hello, I’ve removed the the argument -host.action_url
in the director.
But I still get the same error.
[2022-08-01 11:10:04 +0000] warning/PluginNotificationTask: Notification command for object 'test' (PID: 2997474, arguments: '/usr/bin/env' 'ROCKETCHAT_WEBHOOK_URL="https://URL/hooks/6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"' '/etc/icinga2/scripts/notify_rocketchat' '-host.display_name' 'test' 'test' '-host.output' 'PING CRITICAL - Packet loss = 100%' '-host.state' 'DOWN' '-icinga.timet' '1659352204') terminated with exit code 2, output: -host.* is given, missing some of: -host.name, -host.state
your host.name argument in icinga director seems to have the setting skip key = true.
please fix that
3rd image this post Rocket.Chat notification help - #3 by 329854343
1 Like
Hey, sorry for stealing your time, but now I get the old error I used to get befor:
[2022-08-01 13:16:32 +0000] warning/PluginNotificationTask: Notification command for object 'test' (PID: 3036259, arguments: '/usr/bin/env' 'ROCKETCHAT_WEBHOOK_URL="https://URL/hooks/6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"' '/etc/icinga2/scripts/notify_rocketchat' '-host.display_name' 'test' '-host.name' 'test' '-host.output' 'PING CRITICAL - Packet loss = 100%' '-host.state' 'DOWN' '-icinga.timet' '1659359792') terminated with exit code 2, output: parse "\"https://URL/hooks/6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"": first path segment in URL cannot contain colon
i think there is something wrong with your url
or maybe the quotes are not needed:
use that as command:
/usr/bin/env ROCKETCHAT_WEBHOOK_URL=https://test/hook /etc/icinga2/scripts/notify_rocketchat
deploy in director
You are the god of Icinga2!!! It works! 
Your advice would be a great addition to the instructions of the plugin!
Thank you for helping me out so much!