Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: adding alerts for event hub 04 PAGOPA-2681 #2818

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/next-core/05_messages.tf
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ module "event_hub03" {
}
private_dns_zone_record_A_name = "event_hub03"

alerts_enabled = var.ehns_alerts_enabled
metric_alerts = var.ehns_metric_alerts
alerts_enabled = var.ehns03_alerts_enabled
metric_alerts = var.ehns03_metric_alerts

# takes a list and replaces any elements that are lists with a
# flattened sequence of the list contents.
Expand Down Expand Up @@ -120,6 +120,9 @@ module "event_hub04" {
}
private_dns_zone_record_A_name = "event_hub04"

alerts_enabled = var.ehns04_alerts_enabled
metric_alerts = var.ehns04_metric_alerts

eventhubs = var.eventhubs_04

# takes a list and replaces any elements that are lists with a
Expand Down
43 changes: 40 additions & 3 deletions src/next-core/99_variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -756,18 +756,55 @@ variable "eventhubs_04" {
default = []
}

variable "ehns_alerts_enabled" {
variable "ehns03_alerts_enabled" {
type = bool
default = false
description = "Event hub alerts enabled?"
description = "Event hub 03 alerts enabled?"
}

variable "ehns04_alerts_enabled" {
type = bool
default = false
description = "Event hub 04 alerts enabled?"
}


variable "ehns_public_network_access" {
type = bool
description = "(Required) enables public network access to the event hubs"
}

variable "ehns_metric_alerts" {
variable "ehns03_metric_alerts" {
default = {}

description = <<EOD
Map of name = criteria objects
EOD

type = map(object({
# criteria.*.aggregation to be one of [Average Count Minimum Maximum Total]
aggregation = string
metric_name = string
description = string
# criteria.0.operator to be one of [Equals NotEquals GreaterThan GreaterThanOrEqual LessThan LessThanOrEqual]
operator = string
threshold = number
# Possible values are PT1M, PT5M, PT15M, PT30M and PT1H
frequency = string
# Possible values are PT1M, PT5M, PT15M, PT30M, PT1H, PT6H, PT12H and P1D.
window_size = string

dimension = list(object(
{
name = string
operator = string
values = list(string)
}
))
}))
}

variable "ehns04_metric_alerts" {
default = {}

description = <<EOD
Expand Down
6 changes: 4 additions & 2 deletions src/next-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -425,11 +425,13 @@
| <a name="input_dns_zone_wfesp"></a> [dns\_zone\_wfesp](#input\_dns\_zone\_wfesp) | The wfesp dns subdomain. | `string` | `null` | no |
| <a name="input_dns_zone_wisp2"></a> [dns\_zone\_wisp2](#input\_dns\_zone\_wisp2) | The wisp2 dns subdomain. | `string` | `null` | no |
| <a name="input_domain"></a> [domain](#input\_domain) | n/a | `string` | n/a | yes |
| <a name="input_ehns_alerts_enabled"></a> [ehns\_alerts\_enabled](#input\_ehns\_alerts\_enabled) | Event hub alerts enabled? | `bool` | `false` | no |
| <a name="input_ehns03_alerts_enabled"></a> [ehns03\_alerts\_enabled](#input\_ehns03\_alerts\_enabled) | Event hub 03 alerts enabled? | `bool` | `false` | no |
| <a name="input_ehns03_metric_alerts"></a> [ehns03\_metric\_alerts](#input\_ehns03\_metric\_alerts) | Map of name = criteria objects | <pre>map(object({<br/> # criteria.*.aggregation to be one of [Average Count Minimum Maximum Total]<br/> aggregation = string<br/> metric_name = string<br/> description = string<br/> # criteria.0.operator to be one of [Equals NotEquals GreaterThan GreaterThanOrEqual LessThan LessThanOrEqual]<br/> operator = string<br/> threshold = number<br/> # Possible values are PT1M, PT5M, PT15M, PT30M and PT1H<br/> frequency = string<br/> # Possible values are PT1M, PT5M, PT15M, PT30M, PT1H, PT6H, PT12H and P1D.<br/> window_size = string<br/><br/> dimension = list(object(<br/> {<br/> name = string<br/> operator = string<br/> values = list(string)<br/> }<br/> ))<br/> }))</pre> | `{}` | no |
| <a name="input_ehns04_alerts_enabled"></a> [ehns04\_alerts\_enabled](#input\_ehns04\_alerts\_enabled) | Event hub 04 alerts enabled? | `bool` | `false` | no |
| <a name="input_ehns04_metric_alerts"></a> [ehns04\_metric\_alerts](#input\_ehns04\_metric\_alerts) | Map of name = criteria objects | <pre>map(object({<br/> # criteria.*.aggregation to be one of [Average Count Minimum Maximum Total]<br/> aggregation = string<br/> metric_name = string<br/> description = string<br/> # criteria.0.operator to be one of [Equals NotEquals GreaterThan GreaterThanOrEqual LessThan LessThanOrEqual]<br/> operator = string<br/> threshold = number<br/> # Possible values are PT1M, PT5M, PT15M, PT30M and PT1H<br/> frequency = string<br/> # Possible values are PT1M, PT5M, PT15M, PT30M, PT1H, PT6H, PT12H and P1D.<br/> window_size = string<br/><br/> dimension = list(object(<br/> {<br/> name = string<br/> operator = string<br/> values = list(string)<br/> }<br/> ))<br/> }))</pre> | `{}` | no |
| <a name="input_ehns_auto_inflate_enabled"></a> [ehns\_auto\_inflate\_enabled](#input\_ehns\_auto\_inflate\_enabled) | Is Auto Inflate enabled for the EventHub Namespace? | `bool` | `false` | no |
| <a name="input_ehns_capacity"></a> [ehns\_capacity](#input\_ehns\_capacity) | Specifies the Capacity / Throughput Units for a Standard SKU namespace. | `number` | `null` | no |
| <a name="input_ehns_maximum_throughput_units"></a> [ehns\_maximum\_throughput\_units](#input\_ehns\_maximum\_throughput\_units) | Specifies the maximum number of throughput units when Auto Inflate is Enabled | `number` | `null` | no |
| <a name="input_ehns_metric_alerts"></a> [ehns\_metric\_alerts](#input\_ehns\_metric\_alerts) | Map of name = criteria objects | <pre>map(object({<br/> # criteria.*.aggregation to be one of [Average Count Minimum Maximum Total]<br/> aggregation = string<br/> metric_name = string<br/> description = string<br/> # criteria.0.operator to be one of [Equals NotEquals GreaterThan GreaterThanOrEqual LessThan LessThanOrEqual]<br/> operator = string<br/> threshold = number<br/> # Possible values are PT1M, PT5M, PT15M, PT30M and PT1H<br/> frequency = string<br/> # Possible values are PT1M, PT5M, PT15M, PT30M, PT1H, PT6H, PT12H and P1D.<br/> window_size = string<br/><br/> dimension = list(object(<br/> {<br/> name = string<br/> operator = string<br/> values = list(string)<br/> }<br/> ))<br/> }))</pre> | `{}` | no |
| <a name="input_ehns_public_network_access"></a> [ehns\_public\_network\_access](#input\_ehns\_public\_network\_access) | (Required) enables public network access to the event hubs | `bool` | n/a | yes |
| <a name="input_ehns_sku_name"></a> [ehns\_sku\_name](#input\_ehns\_sku\_name) | Defines which tier to use. | `string` | `"Standard"` | no |
| <a name="input_ehns_zone_redundant"></a> [ehns\_zone\_redundant](#input\_ehns\_zone\_redundant) | Specifies if the EventHub Namespace should be Zone Redundant (created across Availability Zones). | `bool` | `false` | no |
Expand Down
36 changes: 35 additions & 1 deletion src/next-core/env/dev/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ base_path_nodo_oncloud = "/nodo-sit"


ehns_public_network_access = true
ehns_metric_alerts = {
ehns03_metric_alerts = {
no_trx = {
aggregation = "Total"
metric_name = "IncomingMessages"
Expand Down Expand Up @@ -234,6 +234,40 @@ ehns_metric_alerts = {
},
}

ehns04_metric_alerts = {
no_trx = {
aggregation = "Total"
metric_name = "IncomingMessages"
description = "No messagge received in the last 24h"
operator = "LessThanOrEqual"
threshold = 1000
frequency = "PT1H"
window_size = "P1D"
dimension = [
{
name = "EntityName"
operator = "Include"
values = [
"nodo-dei-pagamenti-log",
"nodo-dei-pagamenti-re"
]
}
],
},
active_connections = {
aggregation = "Average"
metric_name = "ActiveConnections"
description = null
operator = "LessThanOrEqual"
threshold = 0
frequency = "PT5M"
window_size = "PT15M"
dimension = [],
}
}

ehns04_alerts_enabled = false

eventhubs_03 = [
{
name = "nodo-dei-pagamenti-log"
Expand Down
50 changes: 49 additions & 1 deletion src/next-core/env/prod/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ ehns_capacity = 5
ehns_zone_redundant = true
ehns_public_network_access = true

ehns_metric_alerts = {
ehns03_metric_alerts = {
no_trx = {
aggregation = "Total"
metric_name = "IncomingMessages"
Expand Down Expand Up @@ -300,7 +300,55 @@ ehns_metric_alerts = {
},
}

ehns04_metric_alerts = {
no_trx = {
aggregation = "Total"
metric_name = "IncomingMessages"
description = "No transactions received from acquirer in the last 24h"
operator = "LessThanOrEqual"
threshold = 1000
frequency = "PT1H"
window_size = "P1D"
dimension = [
{
name = "EntityName"
operator = "Include"
values = ["rtd-trx"]
}
],
},
active_connections = {
aggregation = "Average"
metric_name = "ActiveConnections"
description = null
operator = "LessThanOrEqual"
threshold = 0
frequency = "PT5M"
window_size = "PT15M"
dimension = [],
},
error_trx = {
aggregation = "Total"
metric_name = "IncomingMessages"
description = "Transactions rejected from one acquirer file received. trx write on eventhub. check immediately"
operator = "GreaterThan"
threshold = 0
frequency = "PT5M"
window_size = "PT30M"
dimension = [
{
name = "EntityName"
operator = "Include"
values = [
"nodo-dei-pagamenti-log",
"nodo-dei-pagamenti-re"
]
}
],
},
}

ehns04_alerts_enabled = true

eventhubs_03 = [
{
Expand Down
32 changes: 31 additions & 1 deletion src/next-core/env/uat/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ ehns_maximum_throughput_units = 5
ehns_capacity = 5
ehns_public_network_access = true

ehns_metric_alerts = {
ehns03_metric_alerts = {
no_trx = {
aggregation = "Total"
metric_name = "IncomingMessages"
Expand Down Expand Up @@ -244,6 +244,36 @@ ehns_metric_alerts = {
},
}

ehns04_metric_alerts = {
no_trx = {
aggregation = "Total"
metric_name = "IncomingMessages"
description = "No transactions received from acquirer in the last 24h"
operator = "LessThanOrEqual"
threshold = 1000
frequency = "PT1H"
window_size = "P1D"
dimension = [
{
name = "EntityName"
operator = "Include"
values = ["rtd-trx"]
}
],
},
active_connections = {
aggregation = "Average"
metric_name = "ActiveConnections"
description = null
operator = "LessThanOrEqual"
threshold = 0
frequency = "PT5M"
window_size = "PT15M"
dimension = [],
},
}

ehns04_alerts_enabled = false

eventhubs_03 = [
{
Expand Down