Skip to content

Commit

Permalink
fix alert afm calculator
Browse files Browse the repository at this point in the history
  • Loading branch information
pasqualespica committed Apr 4, 2024
1 parent 337e54b commit 8387d23
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 16 deletions.
41 changes: 25 additions & 16 deletions src/domains/afm-app/00_alert_afm_calculator.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
locals {
afm-calculator-dash = {
node-v1 = "https://portal.azure.com/?l=en.en-us#@pagopait.onmicrosoft.com/dashboard/arm/subscriptions/b9fc9419-6097-45fe-9f74-ba0641c91912/resourceGroups/dashboards/providers/Microsoft.Portal/dashboards/pagopa-p-opex_pagopa-afm-calculator-node-v1"
node-v2 = "https://portal.azure.com/?l=en.en-us#@pagopait.onmicrosoft.com/dashboard/arm/subscriptions/b9fc9419-6097-45fe-9f74-ba0641c91912/resourceGroups/dashboards/providers/Microsoft.Portal/dashboards/pagopa-p-opex_pagopa-afm-calculator-node-v2"
calculator-v1 = "https://portal.azure.com/?l=en.en-us#@pagopait.onmicrosoft.com/dashboard/arm/subscriptions/b9fc9419-6097-45fe-9f74-ba0641c91912/resourceGroups/dashboards/providers/Microsoft.Portal/dashboards/pagopa-p-opex_pagopa-afm-calculator-v1"
calculator-v2 = "https://portal.azure.com/?l=en.en-us#@pagopait.onmicrosoft.com/dashboard/arm/subscriptions/b9fc9419-6097-45fe-9f74-ba0641c91912/resourceGroups/dashboards/providers/Microsoft.Portal/dashboards/pagopa-p-opex_pagopa-afm-calculator-v2"
}
}

resource "azurerm_monitor_scheduled_query_rules_alert" "opex_pagopa-afm-calculator-responsetime-fees" {
count = var.env_short == "p" ? 1 : 0
resource_group_name = "dashboards"
name = "pagopa-${var.env_short}-opex_pagopa-afm-calculator-v1-responsetime @ _fees"
name = "pagopa-${var.env_short}-opex_pagopa-afm-calculator-v1-responsetime_fees"
location = var.location

action {
Expand All @@ -11,7 +20,7 @@ resource "azurerm_monitor_scheduled_query_rules_alert" "opex_pagopa-afm-calculat
}

data_source_id = data.azurerm_api_management.apim.id
description = "Response time for V1 version of /fees is less than or equal to 1.5s - https://portal.azure.com/?l=en.en-us#@pagopait.onmicrosoft.com/dashboard/arm/subscriptions/b9fc9419-6097-45fe-9f74-ba0641c91912/resourcegroups/dashboards/providers/microsoft.portal/dashboards/pagopa-p-opex_pagopa-afm-calculator"
description = "Response time for V1 version of /fees is less than or equal to 1.5s - ${local.afm-calculator-dash.calculator-v1}"
enabled = true
query = (<<-QUERY
let threshold = 1500;
Expand All @@ -34,7 +43,7 @@ AzureDiagnostics
resource "azurerm_monitor_scheduled_query_rules_alert" "opex_pagopa-afm-calculator-availability-fees" {
count = var.env_short == "p" ? 1 : 0
resource_group_name = "dashboards"
name = "pagopa-${var.env_short}-opex_pagopa-afm-calculator-v1-availability @ _fees"
name = "pagopa-${var.env_short}-opex_pagopa-afm-calculator-v1-availability_fees"
location = var.location

action {
Expand All @@ -44,7 +53,7 @@ resource "azurerm_monitor_scheduled_query_rules_alert" "opex_pagopa-afm-calculat
}

data_source_id = data.azurerm_api_management.apim.id
description = "Availability for V1 version of /fees is less than or equal to 99% - https://portal.azure.com/?l=en.en-us#@pagopait.onmicrosoft.com/dashboard/arm/subscriptions/b9fc9419-6097-45fe-9f74-ba0641c91912/resourcegroups/dashboards/providers/microsoft.portal/dashboards/pagopa-p-opex_pagopa-afm-calculator"
description = "Availability for V1 version of /fees is less than or equal to 99% - ${local.afm-calculator-dash.calculator-v1}"
enabled = true
query = (<<-QUERY
let threshold = 0.99;
Expand All @@ -70,7 +79,7 @@ AzureDiagnostics
resource "azurerm_monitor_scheduled_query_rules_alert" "opex_pagopa-afm-calculator-responsetime-feesbypsp" {
count = var.env_short == "p" ? 1 : 0
resource_group_name = "dashboards"
name = "pagopa-${var.env_short}-opex_pagopa-afm-calculator-v1-responsetime @ _psps_idPsp_fees"
name = "pagopa-${var.env_short}-opex_pagopa-afm-calculator-v1-responsetime_psps_idPsp_fees"
location = var.location

action {
Expand All @@ -80,7 +89,7 @@ resource "azurerm_monitor_scheduled_query_rules_alert" "opex_pagopa-afm-calculat
}

data_source_id = data.azurerm_api_management.apim.id
description = "Response time for V1 version of /psps/[^/]+/fees is less than or equal to 1.5s - https://portal.azure.com/?l=en.en-us#@pagopait.onmicrosoft.com/dashboard/arm/subscriptions/b9fc9419-6097-45fe-9f74-ba0641c91912/resourcegroups/dashboards/providers/microsoft.portal/dashboards/pagopa-p-opex_pagopa-afm-calculator"
description = "Response time for V1 version of /psps/[^/]+/fees is less than or equal to 1.5s - ${local.afm-calculator-dash.calculator-v1}"
enabled = true
query = (<<-QUERY
let threshold = 1500;
Expand All @@ -103,7 +112,7 @@ AzureDiagnostics
resource "azurerm_monitor_scheduled_query_rules_alert" "opex_pagopa-afm-calculator-availability-feesbypsp" {
count = var.env_short == "p" ? 1 : 0
resource_group_name = "dashboards"
name = "pagopa-${var.env_short}-opex_pagopa-afm-calculator-v1-availability @ _psps_idPsp_fees"
name = "pagopa-${var.env_short}-opex_pagopa-afm-calculator-v1-availability_psps_idPsp_fees"
location = var.location

action {
Expand All @@ -113,7 +122,7 @@ resource "azurerm_monitor_scheduled_query_rules_alert" "opex_pagopa-afm-calculat
}

data_source_id = data.azurerm_api_management.apim.id
description = "Availability for V1 version of /psps/[^/]+/fees is less than or equal to 99% - https://portal.azure.com/?l=en.en-us#@pagopait.onmicrosoft.com/dashboard/arm/subscriptions/b9fc9419-6097-45fe-9f74-ba0641c91912/resourcegroups/dashboards/providers/microsoft.portal/dashboards/pagopa-p-opex_pagopa-afm-calculator"
description = "Availability for V1 version of /psps/[^/]+/fees is less than or equal to 99% - ${local.afm-calculator-dash.calculator-v1}"
enabled = true
query = (<<-QUERY
let threshold = 0.99;
Expand All @@ -139,7 +148,7 @@ AzureDiagnostics
resource "azurerm_monitor_scheduled_query_rules_alert" "opex_pagopa-afm-calculator-v2-responsetime-fees" {
count = var.env_short == "p" ? 1 : 0
resource_group_name = "dashboards"
name = "pagopa-${var.env_short}-opex_pagopa-afm-calculator-v2-responsetime @ _fees_multi"
name = "pagopa-${var.env_short}-opex_pagopa-afm-calculator-v2-responsetime_fees_multi"
location = var.location

action {
Expand All @@ -149,7 +158,7 @@ resource "azurerm_monitor_scheduled_query_rules_alert" "opex_pagopa-afm-calculat
}

data_source_id = data.azurerm_api_management.apim.id
description = "Response time for V2 version of /fees is less than or equal to 1.5s - https://portal.azure.com/?l=en.en-us#@pagopait.onmicrosoft.com/dashboard/arm/subscriptions/b9fc9419-6097-45fe-9f74-ba0641c91912/resourcegroups/dashboards/providers/microsoft.portal/dashboards/pagopa-p-opex_pagopa-afm-calculator"
description = "Response time for V2 version of /fees is less than or equal to 1.5s - ${local.afm-calculator-dash.calculator-v2}"
enabled = true
query = (<<-QUERY
let threshold = 1500;
Expand All @@ -172,7 +181,7 @@ AzureDiagnostics
resource "azurerm_monitor_scheduled_query_rules_alert" "opex_pagopa-afm-calculator-v2-availability-fees" {
count = var.env_short == "p" ? 1 : 0
resource_group_name = "dashboards"
name = "pagopa-${var.env_short}-opex_pagopa-afm-calculator-v2-availability @ _fees_multi"
name = "pagopa-${var.env_short}-opex_pagopa-afm-calculator-v2-availability_fees_multi"
location = var.location

action {
Expand All @@ -182,7 +191,7 @@ resource "azurerm_monitor_scheduled_query_rules_alert" "opex_pagopa-afm-calculat
}

data_source_id = data.azurerm_api_management.apim.id
description = "Availability for V2 version of /fees is less than or equal to 99% - https://portal.azure.com/?l=en.en-us#@pagopait.onmicrosoft.com/dashboard/arm/subscriptions/b9fc9419-6097-45fe-9f74-ba0641c91912/resourcegroups/dashboards/providers/microsoft.portal/dashboards/pagopa-p-opex_pagopa-afm-calculator"
description = "Availability for V2 version of /fees is less than or equal to 99% - ${local.afm-calculator-dash.calculator-v2}"
enabled = true
query = (<<-QUERY
let threshold = 0.99;
Expand All @@ -208,7 +217,7 @@ AzureDiagnostics
resource "azurerm_monitor_scheduled_query_rules_alert" "opex_pagopa-afm-calculator-v2-responsetime-feesbypsp" {
count = var.env_short == "p" ? 1 : 0
resource_group_name = "dashboards"
name = "pagopa-${var.env_short}-opex_pagopa-afm-calculator-v2-responsetime @ _psps_idPsp_fees_multi"
name = "pagopa-${var.env_short}-opex_pagopa-afm-calculator-v2-responsetime_psps_idPsp_fees_multi"
location = var.location

action {
Expand All @@ -218,7 +227,7 @@ resource "azurerm_monitor_scheduled_query_rules_alert" "opex_pagopa-afm-calculat
}

data_source_id = data.azurerm_api_management.apim.id
description = "Response time for V2 version of /psps/[^/]+/fees is less than or equal to 1.5s - https://portal.azure.com/?l=en.en-us#@pagopait.onmicrosoft.com/dashboard/arm/subscriptions/b9fc9419-6097-45fe-9f74-ba0641c91912/resourcegroups/dashboards/providers/microsoft.portal/dashboards/pagopa-p-opex_pagopa-afm-calculator"
description = "Response time for V2 version of /psps/[^/]+/fees is less than or equal to 1.5s - ${local.afm-calculator-dash.calculator-v2}"
enabled = true
query = (<<-QUERY
let threshold = 1500;
Expand All @@ -241,7 +250,7 @@ AzureDiagnostics
resource "azurerm_monitor_scheduled_query_rules_alert" "opex_pagopa-afm-calculator-v2-availability-feesbypsp" {
count = var.env_short == "p" ? 1 : 0
resource_group_name = "dashboards"
name = "pagopa-${var.env_short}-opex_pagopa-afm-calculator-availability @ _psps_idPsp_fees_multi"
name = "pagopa-${var.env_short}-opex_pagopa-afm-calculator-availability_psps_idPsp_fees_multi"
location = var.location

action {
Expand All @@ -251,7 +260,7 @@ resource "azurerm_monitor_scheduled_query_rules_alert" "opex_pagopa-afm-calculat
}

data_source_id = data.azurerm_api_management.apim.id
description = "Availability for V2 version of /psps/[^/]+/fees is less than or equal to 99% - https://portal.azure.com/?l=en.en-us#@pagopait.onmicrosoft.com/dashboard/arm/subscriptions/b9fc9419-6097-45fe-9f74-ba0641c91912/resourcegroups/dashboards/providers/microsoft.portal/dashboards/pagopa-p-opex_pagopa-afm-calculator"
description = "Availability for V2 version of /psps/[^/]+/fees is less than or equal to 99% - ${local.afm-calculator-dash.calculator-v2}"
enabled = true
query = (<<-QUERY
let threshold = 0.99;
Expand Down
4 changes: 4 additions & 0 deletions src/domains/afm-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@
| [azurerm_monitor_scheduled_query_rules_alert.opex_pagopa-afm-calculator-availability-feesbypsp](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_scheduled_query_rules_alert) | resource |
| [azurerm_monitor_scheduled_query_rules_alert.opex_pagopa-afm-calculator-responsetime-fees](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_scheduled_query_rules_alert) | resource |
| [azurerm_monitor_scheduled_query_rules_alert.opex_pagopa-afm-calculator-responsetime-feesbypsp](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_scheduled_query_rules_alert) | resource |
| [azurerm_monitor_scheduled_query_rules_alert.opex_pagopa-afm-calculator-v2-availability-fees](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_scheduled_query_rules_alert) | resource |
| [azurerm_monitor_scheduled_query_rules_alert.opex_pagopa-afm-calculator-v2-availability-feesbypsp](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_scheduled_query_rules_alert) | resource |
| [azurerm_monitor_scheduled_query_rules_alert.opex_pagopa-afm-calculator-v2-responsetime-fees](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_scheduled_query_rules_alert) | resource |
| [azurerm_monitor_scheduled_query_rules_alert.opex_pagopa-afm-calculator-v2-responsetime-feesbypsp](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_scheduled_query_rules_alert) | resource |
| [helm_release.cert_mounter](https://registry.terraform.io/providers/hashicorp/helm/2.5.1/docs/resources/release) | resource |
| [helm_release.reloader](https://registry.terraform.io/providers/hashicorp/helm/2.5.1/docs/resources/release) | resource |
| [kubernetes_namespace.namespace](https://registry.terraform.io/providers/hashicorp/kubernetes/2.11.0/docs/resources/namespace) | resource |
Expand Down

0 comments on commit 8387d23

Please sign in to comment.