Creating Notification Command

Hello,
I tried out many things, but i dont get this Notification Script to work.

Im not calling a script, im calling a icingacli command. The Notification Script is shipped with the Jira Module. I created a Timeperiod and Users for the check. its also assigned to a Host with an apply rule.

Blockquote
object NotificationCommand “JIRA Host Notification” {
import “plugin-notification-command”
command = [ “/usr/bin/icingacli”, “jira”, “send”, “problem” ]
arguments += {
“–ack-author” = {
description = “This author name will be used when acknowledging Icinga problems once a JIRA issue got created”
value = “$jira_ack_author$”
}
“–command-pipe” = {
description = “Legacy Icinga command pipe. Should only be used on Icinga 1.x system without a correctly configured Icinga Web 2 monitoring module”
value = “$jira_command_pipe$”
}
“–description” = {
description = “JIRA issue description”
required = true
value = “$jira_description$”
}
“–host” = “$host.name$”
“–issuetype” = {
description = “JIRA issue type (e.g. Incident)”
required = true
value = “$jira_issuetype$”
}
“–no-acknowledge” = {
description = “D not acknowledge Icinga problems once a JIRA issue got created”
value = “$jira_no_acknowledge$”
}
“–project” = {
description = “JIRA project name (e.g. ITSM)”
required = true
value = “$jira_project$”
}
“–state” = {
description = “Host state (e.g. DOWN)”
value = “$host.state$”
}
“–summary” = {
description = “JIRA issue summary”
required = true
value = “$jira_summary$”
}
“–template” = {
description = “Issue template name (templates.ini section). This allows to pass custom fields to JIRA”
value = “$jira_template$”
}
}
vars.jira_description = “$host.output$”
vars.jira_summary = “$host.name$ is $host.state$”
}

What i did:
I created a Notification Template

Then i created a Host and assign the Script as check command “Jira Host Notification”

but it always give me an error.

Blockquote
critical/config: Error: Validation failed for object ‘pb-jira-test.intra.loyaltypartner.com’ of type ‘Host’; Attribute ‘check_command’: Object ‘JIRA Host Notification’ of type ‘CheckCommand’ does not exist.
Location: in [stage]/zones.d/director-global/host_templates.conf: 18:5-18:44
[stage]/zones.d/director-global/host_templates.conf(16): import “Generic”
[stage]/zones.d/director-global/host_templates.conf(17):
[stage]/zones.d/director-global/host_templates.conf(18): check_command = “JIRA Host Notification”
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[stage]/zones.d/director-global/host_templates.conf(19): }
[stage]/zones.d/director-global/host_templates.conf(20):

why does it work with every check_command, but not with this icingacli script?

it says the check command does not exist, maybe its in the wrong place? i have no idea …

Greetings

Ghost

Hello,

the error says you use your notification commadn as a host check command, this will not work.
You need to create a notification rule that uses your notification command and apply the notification rule to hosts you want to be notified by this rule.

Regards,
Carsten

Hey Carsten

Thank you ! i will try it out