Skip to content

Commit

Permalink
Ccl 1465 (#17)
Browse files Browse the repository at this point in the history
* CCL-1465: Adding webhook snow integration

Signed-off-by: Babatunde Kassim <[email protected]>

* CCL-1465: Adding webhook snow integration

Signed-off-by: Babatunde Kassim <[email protected]>

---------

Signed-off-by: Babatunde Kassim <[email protected]>
  • Loading branch information
babatundekassim-ho authored Dec 9, 2024
1 parent 0bc192b commit 1b81224
Show file tree
Hide file tree
Showing 3 changed files with 183 additions and 0 deletions.
52 changes: 52 additions & 0 deletions alerts/webhook_alert_integration/alerts_profile.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
resource "dynatrace_alerting" "cosmos-integration-alerting-profile" {
name = var.alerting_profile_name
rules {
rule {
include_mode = var.availability_include_mode
delay_in_minutes = var.availability_delay_in_minutes
severity_level = "AVAILABILITY"
}
rule {
include_mode = var.custom_alert_include_mode
delay_in_minutes = var.custom_alert_delay_in_minutes
severity_level = "CUSTOM_ALERT"
}
rule {
include_mode = var.errors_include_mode
delay_in_minutes = var.errors_delay_in_minutes
severity_level = "ERRORS"
}
rule {
include_mode = var.monitoring_unavailable_include_mode
delay_in_minutes = var.monitoring_unavailable_delay_in_minutes
severity_level = "MONITORING_UNAVAILABLE"
}
rule {
include_mode = var.performance_include_mode
delay_in_minutes = var.performance_delay_in_minutes
severity_level = "PERFORMANCE"
}
rule {
include_mode = var.resource_contention_include_mode
delay_in_minutes = var.resource_contention_delay_in_minutes
severity_level = "RESOURCE_CONTENTION"
}
}
}

resource "dynatrace_webhook_notification" "snow_webhook_integration" {
active = var.active
name = var.integration_notification_name
profile = dynatrace_alerting.cosmos-snow-alerting-profile.id
url = var.webhook_url
insecure = var.insecure
notify_event_merges = var.notify_closed_problems
notify_closed_problems = var.notify_closed_problems
payload = var.payload
use_oauth_2 = var.use_oauth_2
oauth_2_credentials {
access_token_url = var.access_token_url
client_id = var.client_id
client_secret = var.client_secret
}
}
8 changes: 8 additions & 0 deletions alerts/webhook_alert_integration/providers.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
terraform {
required_providers {
dynatrace = {
version = "~> 1.0"
source = "dynatrace-oss/dynatrace"
}
}
}
123 changes: 123 additions & 0 deletions alerts/webhook_alert_integration/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
variable "alerting_profile_name" {
type = string
description = "The name of the alerting profile."
}

variable "availability_include_mode" {
type = string
description = "The inclusion mode for availability rule."
}

variable "availability_delay_in_minutes" {
type = string
description = "The delay in minutes for availability rule."
}

variable "custom_alert_include_mode" {
type = string
description = "The inclusion mode for custom alert rule."
}

variable "custom_alert_delay_in_minutes" {
type = string
description = "The delay in minutes for custom alert rule."
}

variable "errors_include_mode" {
type = string
description = "The inclusion mode for error alert rule."
}

variable "errors_delay_in_minutes" {
type = string
description = "The delay in minutes for error alert rule."
}

variable "monitoring_unavailable_include_mode" {
type = string
description = "The inclusion mode for monitoring unavailable alert rule."
}

variable "monitoring_unavailable_delay_in_minutes" {
type = string
description = "The delay in minutes for monitoring unavailable alert rule."
}

variable "performance_include_mode" {
type = string
description = "The inclusion mode for performance alert rule."
}

variable "performance_delay_in_minutes" {
type = string
description = "The delay in minutes for performance alert rule."
}

variable "resource_contention_include_mode" {
type = string
description = "The inclusion mode for resource contention alert rule."
}

variable "resource_contention_delay_in_minutes" {
type = string
description = "The delay in minutes for resource contention alert rule."
}

variable "active" {
type = bool
description = "The configuration is enabled"
}

variable "integration_notification_name" {
type = string
description = "The name of the notification configuration"
}

variable "webhook_url" {
type = string
description = "The URL of the WebHook endpoint"
}

variable "insecure" {
type = bool
default = false
description = "Accept any, including self-signed and invalid, SSL certificate"
}

variable "notify_event_merges" {
type = bool
default = false
description = "Call webhook if new events merge into existing problems"
}

variable "notify_closed_problems" {
type = bool
default = false
description = "Send email if problem is closed"
}

variable "use_oauth_2" {
type = bool
default = false
description = "Use OAuth 2.0 for authentication"
}

variable "access_token_url" {
type = string
description = "Access token URL"
}

variable "client_id" {
type = string
description = "Client ID"
}

variable "client_secret" {
type = string
description = "Client secret"
}

variable "payload" {
type = string
description = "The content of the notification message"
}

0 comments on commit 1b81224

Please sign in to comment.