Skip to content

Commit

Permalink
fix: [PAYMCLOUD-171]: Update metric configuration for monitoring pods…
Browse files Browse the repository at this point in the history
… of nodo-cron (#2567)

Update metric configuration for monitoring pods

Change metric_namespace to Microsoft.ContainerService/managedClusters and metric_name to kube_pod_status_phase. Added new dimension for pod phases with values "Failed" and "Pending." This improves the granularity of pod status monitoring.

Signed-off-by: Fabio Felici <[email protected]>
  • Loading branch information
ffppa authored Nov 20, 2024
1 parent 67c501d commit e1cf5e5
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 25 deletions.
17 changes: 11 additions & 6 deletions src/domains/nodo-app/00_monitor.tf
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,20 @@ resource "azurerm_monitor_metric_alert" "aks_nodo_moetrics" {

criteria {
aggregation = "Average"
metric_namespace = "Insights.Container/pods"
metric_name = "podCount"
metric_namespace = "Microsoft.ContainerService/managedClusters"
metric_name = "kube_pod_status_phase"
operator = "GreaterThan"
threshold = 200
dimension {
name = "kubernetes namespace"
name = "Namespace"
operator = "Include"
values = ["nodo-cron"]
}
dimension {
name = "phase"
operator = "Include"
values = ["Failed", "Pending"]
}
}
action {
action_group_id = data.azurerm_monitor_action_group.slack.id
Expand All @@ -67,12 +72,12 @@ resource "azurerm_monitor_metric_alert" "aks_nodo_moetrics_error" {

criteria {
aggregation = "Average"
metric_namespace = "Insights.Container/pods"
metric_name = "podCount"
metric_namespace = "Microsoft.ContainerService/managedClusters"
metric_name = "kube_pod_status_phase"
operator = "GreaterThan"
threshold = 30
dimension {
name = "kubernetes namespace"
name = "Namespace"
operator = "Include"
values = ["nodo-cron"]
}
Expand Down
38 changes: 19 additions & 19 deletions src/domains/nodo-app/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# nodo-app

<!-- markdownlint-disable -->
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
<!-- BEGIN_TF_DOCS -->
## Requirements

| Name | Version |
Expand Down Expand Up @@ -285,7 +285,7 @@
| <a name="input_apim_dns_zone_prefix"></a> [apim\_dns\_zone\_prefix](#input\_apim\_dns\_zone\_prefix) | The dns subdomain for apim. | `string` | `null` | no |
| <a name="input_apim_nodo_auth_decoupler_enable"></a> [apim\_nodo\_auth\_decoupler\_enable](#input\_apim\_nodo\_auth\_decoupler\_enable) | Apply decoupler to nodo-auth product apim policy | `bool` | `true` | no |
| <a name="input_apim_nodo_decoupler_enable"></a> [apim\_nodo\_decoupler\_enable](#input\_apim\_nodo\_decoupler\_enable) | Apply decoupler to nodo product apim policy | `bool` | `true` | no |
| <a name="input_app_gateway_allowed_paths_pagopa_onprem_only"></a> [app\_gateway\_allowed\_paths\_pagopa\_onprem\_only](#input\_app\_gateway\_allowed\_paths\_pagopa\_onprem\_only) | Allowed paths from pagopa onprem only | <pre>object({<br> paths = list(string)<br> ips = list(string)<br> })</pre> | n/a | yes |
| <a name="input_app_gateway_allowed_paths_pagopa_onprem_only"></a> [app\_gateway\_allowed\_paths\_pagopa\_onprem\_only](#input\_app\_gateway\_allowed\_paths\_pagopa\_onprem\_only) | Allowed paths from pagopa onprem only | <pre>object({<br/> paths = list(string)<br/> ips = list(string)<br/> })</pre> | n/a | yes |
| <a name="input_cidr_subnet_vmss"></a> [cidr\_subnet\_vmss](#input\_cidr\_subnet\_vmss) | VMSS network address space. | `list(string)` | n/a | yes |
| <a name="input_cname_record_name"></a> [cname\_record\_name](#input\_cname\_record\_name) | n/a | `string` | `"config"` | no |
| <a name="input_create_wisp_converter"></a> [create\_wisp\_converter](#input\_create\_wisp\_converter) | CREATE WISP dismantling system infra | `bool` | `false` | no |
Expand All @@ -312,39 +312,39 @@
| <a name="input_nodo_pagamenti_auth_password"></a> [nodo\_pagamenti\_auth\_password](#input\_nodo\_pagamenti\_auth\_password) | Default password used for nodo-auth | `string` | `"PLACEHOLDER"` | no |
| <a name="input_nodo_pagamenti_subkey_required"></a> [nodo\_pagamenti\_subkey\_required](#input\_nodo\_pagamenti\_subkey\_required) | Enabled subkeys for nodo dei pagamenti api | `bool` | `false` | no |
| <a name="input_nodo_pagamenti_x_forwarded_for"></a> [nodo\_pagamenti\_x\_forwarded\_for](#input\_nodo\_pagamenti\_x\_forwarded\_for) | X-Forwarded-For IP address used for nodo-auth | `string` | n/a | yes |
| <a name="input_nodo_re_to_datastore_function"></a> [nodo\_re\_to\_datastore\_function](#input\_nodo\_re\_to\_datastore\_function) | Nodo RE to datastore function | <pre>object({<br> always_on = bool<br> kind = string<br> sku_size = string<br> sku_tier = string<br> maximum_elastic_worker_count = number<br> })</pre> | <pre>{<br> "always_on": true,<br> "kind": "Linux",<br> "maximum_elastic_worker_count": 1,<br> "sku_size": "B1",<br> "sku_tier": "Basic"<br>}</pre> | no |
| <a name="input_nodo_re_to_datastore_function"></a> [nodo\_re\_to\_datastore\_function](#input\_nodo\_re\_to\_datastore\_function) | Nodo RE to datastore function | <pre>object({<br/> always_on = bool<br/> kind = string<br/> sku_size = string<br/> sku_tier = string<br/> maximum_elastic_worker_count = number<br/> })</pre> | <pre>{<br/> "always_on": true,<br/> "kind": "Linux",<br/> "maximum_elastic_worker_count": 1,<br/> "sku_size": "B1",<br/> "sku_tier": "Basic"<br/>}</pre> | no |
| <a name="input_nodo_re_to_datastore_function_app_image_tag"></a> [nodo\_re\_to\_datastore\_function\_app\_image\_tag](#input\_nodo\_re\_to\_datastore\_function\_app\_image\_tag) | Nodo RE to Datastore function app docker image tag. Defaults to 'latest' | `string` | `"latest"` | no |
| <a name="input_nodo_re_to_datastore_function_autoscale"></a> [nodo\_re\_to\_datastore\_function\_autoscale](#input\_nodo\_re\_to\_datastore\_function\_autoscale) | Nodo RE functions autoscaling parameters | <pre>object({<br> default = number<br> minimum = number<br> maximum = number<br> })</pre> | n/a | yes |
| <a name="input_nodo_re_to_datastore_function_autoscale"></a> [nodo\_re\_to\_datastore\_function\_autoscale](#input\_nodo\_re\_to\_datastore\_function\_autoscale) | Nodo RE functions autoscaling parameters | <pre>object({<br/> default = number<br/> minimum = number<br/> maximum = number<br/> })</pre> | n/a | yes |
| <a name="input_nodo_re_to_datastore_function_subnet"></a> [nodo\_re\_to\_datastore\_function\_subnet](#input\_nodo\_re\_to\_datastore\_function\_subnet) | Address prefixes subnet | `list(string)` | `null` | no |
| <a name="input_nodo_re_to_datastore_network_policies_enabled"></a> [nodo\_re\_to\_datastore\_network\_policies\_enabled](#input\_nodo\_re\_to\_datastore\_network\_policies\_enabled) | Network policies enabled | `bool` | `false` | no |
| <a name="input_nodo_re_to_tablestorage_function"></a> [nodo\_re\_to\_tablestorage\_function](#input\_nodo\_re\_to\_tablestorage\_function) | Nodo RE to datastore function | <pre>object({<br> always_on = bool<br> kind = string<br> sku_size = string<br> sku_tier = string<br> maximum_elastic_worker_count = number<br> })</pre> | n/a | yes |
| <a name="input_nodo_re_to_tablestorage_function"></a> [nodo\_re\_to\_tablestorage\_function](#input\_nodo\_re\_to\_tablestorage\_function) | Nodo RE to datastore function | <pre>object({<br/> always_on = bool<br/> kind = string<br/> sku_size = string<br/> sku_tier = string<br/> maximum_elastic_worker_count = number<br/> })</pre> | n/a | yes |
| <a name="input_nodo_re_to_tablestorage_function_app_image_tag"></a> [nodo\_re\_to\_tablestorage\_function\_app\_image\_tag](#input\_nodo\_re\_to\_tablestorage\_function\_app\_image\_tag) | Nodo RE to Table Storage function app docker image tag. Defaults to 'latest' | `string` | `"latest"` | no |
| <a name="input_nodo_re_to_tablestorage_function_autoscale"></a> [nodo\_re\_to\_tablestorage\_function\_autoscale](#input\_nodo\_re\_to\_tablestorage\_function\_autoscale) | Nodo RE functions autoscaling parameters | <pre>object({<br> default = number<br> minimum = number<br> maximum = number<br> })</pre> | n/a | yes |
| <a name="input_nodo_re_to_tablestorage_function_autoscale"></a> [nodo\_re\_to\_tablestorage\_function\_autoscale](#input\_nodo\_re\_to\_tablestorage\_function\_autoscale) | Nodo RE functions autoscaling parameters | <pre>object({<br/> default = number<br/> minimum = number<br/> maximum = number<br/> })</pre> | n/a | yes |
| <a name="input_nodo_re_to_tablestorage_function_subnet"></a> [nodo\_re\_to\_tablestorage\_function\_subnet](#input\_nodo\_re\_to\_tablestorage\_function\_subnet) | Address prefixes subnet | `list(string)` | `null` | no |
| <a name="input_nodo_re_to_tablestorage_network_policies_enabled"></a> [nodo\_re\_to\_tablestorage\_network\_policies\_enabled](#input\_nodo\_re\_to\_tablestorage\_network\_policies\_enabled) | Network policies enabled | `bool` | `false` | no |
| <a name="input_nodo_user_node_pool"></a> [nodo\_user\_node\_pool](#input\_nodo\_user\_node\_pool) | AKS node pool user configuration | <pre>object({<br> enabled = bool,<br> name = string,<br> vm_size = string,<br> os_disk_type = string,<br> os_disk_size_gb = string,<br> node_count_min = number,<br> node_count_max = number,<br> node_labels = map(any),<br> node_taints = list(string),<br> node_tags = map(any),<br> nodo_pool_max_pods = number,<br> })</pre> | n/a | yes |
| <a name="input_nodo_verifyko_to_datastore_function"></a> [nodo\_verifyko\_to\_datastore\_function](#input\_nodo\_verifyko\_to\_datastore\_function) | Nodo Verify KO events to datastore function | <pre>object({<br> always_on = bool<br> kind = string<br> sku_size = string<br> sku_tier = string<br> maximum_elastic_worker_count = number<br> zone_balancing_enabled = bool<br> })</pre> | n/a | yes |
| <a name="input_nodo_user_node_pool"></a> [nodo\_user\_node\_pool](#input\_nodo\_user\_node\_pool) | AKS node pool user configuration | <pre>object({<br/> enabled = bool,<br/> name = string,<br/> vm_size = string,<br/> os_disk_type = string,<br/> os_disk_size_gb = string,<br/> node_count_min = number,<br/> node_count_max = number,<br/> node_labels = map(any),<br/> node_taints = list(string),<br/> node_tags = map(any),<br/> nodo_pool_max_pods = number,<br/> })</pre> | n/a | yes |
| <a name="input_nodo_verifyko_to_datastore_function"></a> [nodo\_verifyko\_to\_datastore\_function](#input\_nodo\_verifyko\_to\_datastore\_function) | Nodo Verify KO events to datastore function | <pre>object({<br/> always_on = bool<br/> kind = string<br/> sku_size = string<br/> sku_tier = string<br/> maximum_elastic_worker_count = number<br/> zone_balancing_enabled = bool<br/> })</pre> | n/a | yes |
| <a name="input_nodo_verifyko_to_datastore_function_app_image_tag"></a> [nodo\_verifyko\_to\_datastore\_function\_app\_image\_tag](#input\_nodo\_verifyko\_to\_datastore\_function\_app\_image\_tag) | Nodo Verify KO to Datastore function app docker image tag. Defaults to 'latest' | `string` | `"latest"` | no |
| <a name="input_nodo_verifyko_to_datastore_function_autoscale"></a> [nodo\_verifyko\_to\_datastore\_function\_autoscale](#input\_nodo\_verifyko\_to\_datastore\_function\_autoscale) | Nodo Verify KO event functions autoscaling parameters | <pre>object({<br> default = number<br> minimum = number<br> maximum = number<br> })</pre> | n/a | yes |
| <a name="input_nodo_verifyko_to_datastore_function_autoscale"></a> [nodo\_verifyko\_to\_datastore\_function\_autoscale](#input\_nodo\_verifyko\_to\_datastore\_function\_autoscale) | Nodo Verify KO event functions autoscaling parameters | <pre>object({<br/> default = number<br/> minimum = number<br/> maximum = number<br/> })</pre> | n/a | yes |
| <a name="input_nodo_verifyko_to_datastore_function_subnet"></a> [nodo\_verifyko\_to\_datastore\_function\_subnet](#input\_nodo\_verifyko\_to\_datastore\_function\_subnet) | Address prefixes subnet | `list(string)` | `null` | no |
| <a name="input_nodo_verifyko_to_datastore_network_policies_enabled"></a> [nodo\_verifyko\_to\_datastore\_network\_policies\_enabled](#input\_nodo\_verifyko\_to\_datastore\_network\_policies\_enabled) | Network policies enabled | `bool` | `false` | no |
| <a name="input_nodo_verifyko_to_tablestorage_function"></a> [nodo\_verifyko\_to\_tablestorage\_function](#input\_nodo\_verifyko\_to\_tablestorage\_function) | Nodo Verify KO events to table storage function | <pre>object({<br> always_on = bool<br> kind = string<br> sku_size = string<br> sku_tier = string<br> maximum_elastic_worker_count = number<br> zone_balancing_enabled = bool<br> })</pre> | n/a | yes |
| <a name="input_nodo_verifyko_to_tablestorage_function"></a> [nodo\_verifyko\_to\_tablestorage\_function](#input\_nodo\_verifyko\_to\_tablestorage\_function) | Nodo Verify KO events to table storage function | <pre>object({<br/> always_on = bool<br/> kind = string<br/> sku_size = string<br/> sku_tier = string<br/> maximum_elastic_worker_count = number<br/> zone_balancing_enabled = bool<br/> })</pre> | n/a | yes |
| <a name="input_nodo_verifyko_to_tablestorage_function_app_image_tag"></a> [nodo\_verifyko\_to\_tablestorage\_function\_app\_image\_tag](#input\_nodo\_verifyko\_to\_tablestorage\_function\_app\_image\_tag) | Nodo Verify KO events to Table Storage function app docker image tag. Defaults to 'latest' | `string` | `"latest"` | no |
| <a name="input_nodo_verifyko_to_tablestorage_function_autoscale"></a> [nodo\_verifyko\_to\_tablestorage\_function\_autoscale](#input\_nodo\_verifyko\_to\_tablestorage\_function\_autoscale) | Nodo Verify KO events to Table Storage functions autoscaling parameters | <pre>object({<br> default = number<br> minimum = number<br> maximum = number<br> })</pre> | n/a | yes |
| <a name="input_nodo_verifyko_to_tablestorage_function_autoscale"></a> [nodo\_verifyko\_to\_tablestorage\_function\_autoscale](#input\_nodo\_verifyko\_to\_tablestorage\_function\_autoscale) | Nodo Verify KO events to Table Storage functions autoscaling parameters | <pre>object({<br/> default = number<br/> minimum = number<br/> maximum = number<br/> })</pre> | n/a | yes |
| <a name="input_nodo_verifyko_to_tablestorage_function_subnet"></a> [nodo\_verifyko\_to\_tablestorage\_function\_subnet](#input\_nodo\_verifyko\_to\_tablestorage\_function\_subnet) | Address prefixes subnet | `list(string)` | `null` | no |
| <a name="input_nodo_verifyko_to_tablestorage_network_policies_enabled"></a> [nodo\_verifyko\_to\_tablestorage\_network\_policies\_enabled](#input\_nodo\_verifyko\_to\_tablestorage\_network\_policies\_enabled) | Network policies enabled | `bool` | `false` | no |
| <a name="input_pod_disruption_budgets"></a> [pod\_disruption\_budgets](#input\_pod\_disruption\_budgets) | Pod disruption budget for domain namespace | <pre>map(object({<br> name = optional(string, null)<br> minAvailable = optional(number, null)<br> matchLabels = optional(map(any), {})<br> }))</pre> | `{}` | no |
| <a name="input_pod_disruption_budgets"></a> [pod\_disruption\_budgets](#input\_pod\_disruption\_budgets) | Pod disruption budget for domain namespace | <pre>map(object({<br/> name = optional(string, null)<br/> minAvailable = optional(number, null)<br/> matchLabels = optional(map(any), {})<br/> }))</pre> | `{}` | no |
| <a name="input_prefix"></a> [prefix](#input\_prefix) | n/a | `string` | n/a | yes |
| <a name="input_route_aks"></a> [route\_aks](#input\_route\_aks) | AKS routing table | <pre>list(object({<br> name = string<br> address_prefix = string<br> next_hop_type = string<br> next_hop_in_ip_address = string<br> }))</pre> | n/a | yes |
| <a name="input_storage_account_info"></a> [storage\_account\_info](#input\_storage\_account\_info) | Storage account | <pre>object({<br> account_kind = string<br> account_tier = string<br> account_replication_type = string<br> access_tier = string<br> advanced_threat_protection_enable = bool<br> })</pre> | <pre>{<br> "access_tier": "Hot",<br> "account_kind": "StorageV2",<br> "account_replication_type": "LRS",<br> "account_tier": "Standard",<br> "advanced_threat_protection_enable": true<br>}</pre> | no |
| <a name="input_tags"></a> [tags](#input\_tags) | n/a | `map(any)` | <pre>{<br> "CreatedBy": "Terraform"<br>}</pre> | no |
| <a name="input_tls_cert_check_helm"></a> [tls\_cert\_check\_helm](#input\_tls\_cert\_check\_helm) | tls cert helm chart configuration | <pre>object({<br> chart_version = string,<br> image_name = string,<br> image_tag = string<br> })</pre> | n/a | yes |
| <a name="input_route_aks"></a> [route\_aks](#input\_route\_aks) | AKS routing table | <pre>list(object({<br/> name = string<br/> address_prefix = string<br/> next_hop_type = string<br/> next_hop_in_ip_address = string<br/> }))</pre> | n/a | yes |
| <a name="input_storage_account_info"></a> [storage\_account\_info](#input\_storage\_account\_info) | Storage account | <pre>object({<br/> account_kind = string<br/> account_tier = string<br/> account_replication_type = string<br/> access_tier = string<br/> advanced_threat_protection_enable = bool<br/> })</pre> | <pre>{<br/> "access_tier": "Hot",<br/> "account_kind": "StorageV2",<br/> "account_replication_type": "LRS",<br/> "account_tier": "Standard",<br/> "advanced_threat_protection_enable": true<br/>}</pre> | no |
| <a name="input_tags"></a> [tags](#input\_tags) | n/a | `map(any)` | <pre>{<br/> "CreatedBy": "Terraform"<br/>}</pre> | no |
| <a name="input_tls_cert_check_helm"></a> [tls\_cert\_check\_helm](#input\_tls\_cert\_check\_helm) | tls cert helm chart configuration | <pre>object({<br/> chart_version = string,<br/> image_name = string,<br/> image_tag = string<br/> })</pre> | n/a | yes |
| <a name="input_vmss_instance_number"></a> [vmss\_instance\_number](#input\_vmss\_instance\_number) | availability zones for vmss | `number` | n/a | yes |
| <a name="input_vmss_zones"></a> [vmss\_zones](#input\_vmss\_zones) | availability zones for vmss | `list(string)` | n/a | yes |
| <a name="input_wfesp_dismantling"></a> [wfesp\_dismantling](#input\_wfesp\_dismantling) | n/a | <pre>object({<br> channel_list = string<br> wfesp_fixed_url = string<br> })</pre> | n/a | yes |
| <a name="input_wisp_converter"></a> [wisp\_converter](#input\_wisp\_converter) | n/a | <pre>object({<br> enable_apim_switch = bool # enable WISP dismantling<br> brokerPSP_whitelist = string<br> channel_whitelist = string<br> nodoinviarpt_paymenttype_whitelist = string<br> dismantling_primitives = string<br> dismantling_rt_primitives = string<br> checkout_predefined_expiration_time = number<br> wisp_ecommerce_channels = string<br> })</pre> | n/a | yes |
| <a name="input_wfesp_dismantling"></a> [wfesp\_dismantling](#input\_wfesp\_dismantling) | n/a | <pre>object({<br/> channel_list = string<br/> wfesp_fixed_url = string<br/> })</pre> | n/a | yes |
| <a name="input_wisp_converter"></a> [wisp\_converter](#input\_wisp\_converter) | n/a | <pre>object({<br/> enable_apim_switch = bool # enable WISP dismantling<br/> brokerPSP_whitelist = string<br/> channel_whitelist = string<br/> nodoinviarpt_paymenttype_whitelist = string<br/> dismantling_primitives = string<br/> dismantling_rt_primitives = string<br/> checkout_predefined_expiration_time = number<br/> wisp_ecommerce_channels = string<br/> })</pre> | n/a | yes |

## Outputs

No outputs.
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
<!-- END_TF_DOCS -->

0 comments on commit e1cf5e5

Please sign in to comment.