From 9c25525ea07c1781decc3fddef96031b7eac475c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Chauvet?= Date: Wed, 4 Dec 2024 20:47:43 +0100 Subject: [PATCH 1/4] integration_azure-managed-instances --- .../conf/01-cpu.yaml | 21 +++++++++++++++++++ .../conf/02-storage-usage.yaml | 21 +++++++++++++++++++ .../conf/readme.yaml | 5 +++++ 3 files changed, 47 insertions(+) create mode 100644 modules/integration_azure-sql-managed-instances/conf/01-cpu.yaml create mode 100644 modules/integration_azure-sql-managed-instances/conf/02-storage-usage.yaml create mode 100644 modules/integration_azure-sql-managed-instances/conf/readme.yaml diff --git a/modules/integration_azure-sql-managed-instances/conf/01-cpu.yaml b/modules/integration_azure-sql-managed-instances/conf/01-cpu.yaml new file mode 100644 index 000000000..bc8efc12f --- /dev/null +++ b/modules/integration_azure-sql-managed-instances/conf/01-cpu.yaml @@ -0,0 +1,21 @@ +--- +module: "Azure SQL Managed Instances" +name: "CPU" +filtering: "filter('resource_type', 'Microsoft.Sql/managedInstances') and filter('primary_aggregation_type', 'true')" +aggregation: ".mean(by=['azure_resource_name', 'azure_resource_group_name', 'azure_region'])" +value_unit: "%" +transformation: true +signals: + signal: + metric: "avg_cpu_percent" +rules: + critical: + threshold: 90 + comparator: ">" + lasting_duration: '15m' + major: + threshold: 80 + comparator: ">" + lasting_duration: '15m' + dependency: critical +... diff --git a/modules/integration_azure-sql-managed-instances/conf/02-storage-usage.yaml b/modules/integration_azure-sql-managed-instances/conf/02-storage-usage.yaml new file mode 100644 index 000000000..adc5b248d --- /dev/null +++ b/modules/integration_azure-sql-managed-instances/conf/02-storage-usage.yaml @@ -0,0 +1,21 @@ +--- +module: "Azure SQL Managed Instances" +name: "storage usage" +filtering: "filter('resource_type', 'Microsoft.Sql/managedInstances') and filter('primary_aggregation_type', 'true')" +aggregation: ".mean(by=['azure_resource_name', 'azure_resource_group_name', 'azure_region'])" +value_unit: "%" +transformation: true +signals: + signal: + metric: "storage_space_used_mb" +rules: + critical: + threshold: 90 + comparator: ">" + lasting_duration: '15m' + major: + threshold: 80 + comparator: ">" + lasting_duration: '15m' + dependency: critical +... diff --git a/modules/integration_azure-sql-managed-instances/conf/readme.yaml b/modules/integration_azure-sql-managed-instances/conf/readme.yaml new file mode 100644 index 000000000..db491a06e --- /dev/null +++ b/modules/integration_azure-sql-managed-instances/conf/readme.yaml @@ -0,0 +1,5 @@ +documentations: + - name: Azure Monitor metrics + url: 'https://learn.microsoft.com/en-us/azure/azure-monitor/reference/supported-metrics/microsoft-sql-managedinstances-metrics' + - name: Splunk Observability metrics + url: 'https://docs.splunk.com/observability/en/gdi/get-data-in/connect/azure/azure-metrics.html#azure-sql-managedinstances-metrics' From a4b5448b603142b4d141f0502757a70aa0fceac5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Chauvet?= Date: Thu, 5 Dec 2024 17:22:58 +0100 Subject: [PATCH 2/4] integration_azure-managed-instances --- docs/severity.md | 9 + .../README.md | 111 +++++++++++ .../conf/02-storage-usage.yaml | 6 +- .../detectors-gen.tf | 92 +++++++++ .../outputs.tf | 10 + .../variables-gen.tf | 178 ++++++++++++++++++ 6 files changed, 401 insertions(+), 5 deletions(-) create mode 100644 modules/integration_azure-sql-managed-instances/README.md create mode 100644 modules/integration_azure-sql-managed-instances/detectors-gen.tf create mode 100644 modules/integration_azure-sql-managed-instances/outputs.tf create mode 100644 modules/integration_azure-sql-managed-instances/variables-gen.tf diff --git a/docs/severity.md b/docs/severity.md index 149003026..6948564d1 100644 --- a/docs/severity.md +++ b/docs/severity.md @@ -59,6 +59,7 @@ - [integration_azure-service-bus](#integration_azure-service-bus) - [integration_azure-sql-database](#integration_azure-sql-database) - [integration_azure-sql-elastic-pool](#integration_azure-sql-elastic-pool) +- [integration_azure-sql-managed-instances](#integration_azure-sql-managed-instances) - [integration_azure-storage-account-blob](#integration_azure-storage-account-blob) - [integration_azure-storage-account-capacity](#integration_azure-storage-account-capacity) - [integration_azure-storage-account](#integration_azure-storage-account) @@ -673,6 +674,14 @@ |Azure SQL Elastic Pool dtu consumption|X|X|-|-|-| +## integration_azure-sql-managed-instances + +|Detector|Critical|Major|Minor|Warning|Info| +|---|---|---|---|---|---| +|Azure SQL Managed Instances cpu|X|X|-|-|-| +|Azure SQL Managed Instances storage usage|X|X|-|-|-| + + ## integration_azure-storage-account-blob |Detector|Critical|Major|Minor|Warning|Info| diff --git a/modules/integration_azure-sql-managed-instances/README.md b/modules/integration_azure-sql-managed-instances/README.md new file mode 100644 index 000000000..d60b750bf --- /dev/null +++ b/modules/integration_azure-sql-managed-instances/README.md @@ -0,0 +1,111 @@ +# AZURE-SQL-MANAGED-INSTANCES SignalFx detectors + + + +:link: **Contents** + +- [How to use this module?](#how-to-use-this-module) +- [What are the available detectors in this module?](#what-are-the-available-detectors-in-this-module) +- [How to collect required metrics?](#how-to-collect-required-metrics) + - [Metrics](#metrics) +- [Related documentation](#related-documentation) + + + +## How to use this module? + +This directory defines a [Terraform](https://www.terraform.io/) +[module](https://www.terraform.io/language/modules/syntax) you can use in your +existing [stack](https://github.com/claranet/terraform-signalfx-detectors/wiki/Getting-started#stack) by adding a +`module` configuration and setting its `source` parameter to URL of this folder: + +```hcl +module "signalfx-detectors-integration-azure-sql-managed-instances" { + source = "github.com/claranet/terraform-signalfx-detectors.git//modules/integration_azure-sql-managed-instances?ref={revision}" + + environment = var.environment + notifications = local.notifications + storage_usage_threshold_critical = 42 + storage_usage_threshold_major = 42 +} +``` + +Note the following parameters: + +* `source`: Use this parameter to specify the URL of the module. The double slash (`//`) is intentional and required. + Terraform uses it to specify subfolders within a Git repo (see [module + sources](https://www.terraform.io/language/modules/sources)). The `ref` parameter specifies a specific Git tag in + this repository. It is recommended to use the latest "pinned" version in place of `{revision}`. Avoid using a branch + like `master` except for testing purpose. Note that every modules in this repository are available on the Terraform + [registry](https://registry.terraform.io/modules/claranet/detectors/signalfx) and we recommend using it as source + instead of `git` which is more flexible but less future-proof. + +* `environment`: Use this parameter to specify the + [environment](https://github.com/claranet/terraform-signalfx-detectors/wiki/Getting-started#environment) used by this + instance of the module. + Its value will be added to the `prefixes` list at the start of the [detector + name](https://github.com/claranet/terraform-signalfx-detectors/wiki/Templating#example). + In general, it will also be used in the `filtering` internal sub-module to [apply + filters](https://github.com/claranet/terraform-signalfx-detectors/wiki/Guidance#filtering) based on our default + [tagging convention](https://github.com/claranet/terraform-signalfx-detectors/wiki/Tagging-convention) by default. + +* `notifications`: Use this parameter to define where alerts should be sent depending on their severity. It consists + of a Terraform [object](https://www.terraform.io/language/expressions/type-constraints#object) where each key represents an available + [detector rule severity](https://docs.splunk.com/observability/alerts-detectors-notifications/create-detectors-for-alerts.html#severity) + and its value is a list of recipients. Every recipients must respect the [detector notification + format](https://registry.terraform.io/providers/splunk-terraform/signalfx/latest/docs/resources/detector#notification-format). + Check the [notification binding](https://github.com/claranet/terraform-signalfx-detectors/wiki/Notifications-binding) + documentation to understand the recommended role of each severity. + +These 3 parameters along with all variables defined in [common-variables.tf](common-variables.tf) are common to all +[modules](../) in this repository. Other variables, specific to this module, are available in +[variables-gen.tf](variables-gen.tf). +In general, the default configuration "works" but all of these Terraform +[variables](https://www.terraform.io/language/values/variables) make it possible to +customize the detectors behavior to better fit your needs. + +Most of them represent usual tips and rules detailed in the +[guidance](https://github.com/claranet/terraform-signalfx-detectors/wiki/Guidance) documentation and listed in the +common [variables](https://github.com/claranet/terraform-signalfx-detectors/wiki/Variables) dedicated documentation. + +Feel free to explore the [wiki](https://github.com/claranet/terraform-signalfx-detectors/wiki) for more information about +general usage of this repository. + +## What are the available detectors in this module? + +This module creates the following SignalFx detectors which could contain one or multiple alerting rules: + +|Detector|Critical|Major|Minor|Warning|Info| +|---|---|---|---|---|---| +|Azure SQL Managed Instances cpu|X|X|-|-|-| +|Azure SQL Managed Instances storage usage|X|X|-|-|-| + +## How to collect required metrics? + +This module deploys detectors using metrics reported by the +[Azure integration](https://docs.splunk.com/Observability/gdi/get-data-in/connect/azure/azure.html) configurable +with [this Terraform module](https://github.com/claranet/terraform-signalfx-integrations/tree/master/cloud/azure). + + +Check the [Related documentation](#related-documentation) section for more detailed and specific information about this module dependencies. + + + +### Metrics + + +Here is the list of required metrics for detectors in this module. + +* `avg_cpu_percent` +* `storage_space_used_mb` + + + + +## Related documentation + +* [Terraform SignalFx provider](https://registry.terraform.io/providers/splunk-terraform/signalfx/latest/docs) +* [Terraform SignalFx detector](https://registry.terraform.io/providers/splunk-terraform/signalfx/latest/docs/resources/detector) +* [Splunk Observability integrations](https://docs.splunk.com/Observability/gdi/get-data-in/integrations.html) +* [Azure Monitor metrics](https://learn.microsoft.com/en-us/azure/azure-monitor/reference/supported-metrics/microsoft-sql-managedinstances-metrics) +* [Splunk Observability metrics](https://docs.splunk.com/observability/en/gdi/get-data-in/connect/azure/azure-metrics.html#azure-sql-managedinstances-metrics) diff --git a/modules/integration_azure-sql-managed-instances/conf/02-storage-usage.yaml b/modules/integration_azure-sql-managed-instances/conf/02-storage-usage.yaml index adc5b248d..6c967afcc 100644 --- a/modules/integration_azure-sql-managed-instances/conf/02-storage-usage.yaml +++ b/modules/integration_azure-sql-managed-instances/conf/02-storage-usage.yaml @@ -3,19 +3,15 @@ module: "Azure SQL Managed Instances" name: "storage usage" filtering: "filter('resource_type', 'Microsoft.Sql/managedInstances') and filter('primary_aggregation_type', 'true')" aggregation: ".mean(by=['azure_resource_name', 'azure_resource_group_name', 'azure_region'])" -value_unit: "%" +value_unit: "Megabyte" transformation: true signals: signal: metric: "storage_space_used_mb" rules: critical: - threshold: 90 comparator: ">" - lasting_duration: '15m' major: - threshold: 80 comparator: ">" - lasting_duration: '15m' dependency: critical ... diff --git a/modules/integration_azure-sql-managed-instances/detectors-gen.tf b/modules/integration_azure-sql-managed-instances/detectors-gen.tf new file mode 100644 index 000000000..3129f7a10 --- /dev/null +++ b/modules/integration_azure-sql-managed-instances/detectors-gen.tf @@ -0,0 +1,92 @@ +resource "signalfx_detector" "cpu" { + name = format("%s %s", local.detector_name_prefix, "Azure SQL Managed Instances cpu") + + authorized_writer_teams = var.authorized_writer_teams + teams = try(coalescelist(var.teams, var.authorized_writer_teams), null) + tags = compact(concat(local.common_tags, local.tags, var.extra_tags)) + + viz_options { + label = "signal" + value_suffix = "%" + } + + program_text = <<-EOF + base_filtering = filter('resource_type', 'Microsoft.Sql/managedInstances') and filter('primary_aggregation_type', 'true') + signal = data('avg_cpu_percent', filter=base_filtering and ${module.filtering.signalflow})${var.cpu_aggregation_function}${var.cpu_transformation_function}.publish('signal') + detect(when(signal > ${var.cpu_threshold_critical}%{if var.cpu_lasting_duration_critical != null}, lasting='${var.cpu_lasting_duration_critical}', at_least=${var.cpu_at_least_percentage_critical}%{endif})).publish('CRIT') + detect(when(signal > ${var.cpu_threshold_major}%{if var.cpu_lasting_duration_major != null}, lasting='${var.cpu_lasting_duration_major}', at_least=${var.cpu_at_least_percentage_major}%{endif}) and (not when(signal > ${var.cpu_threshold_critical}%{if var.cpu_lasting_duration_critical != null}, lasting='${var.cpu_lasting_duration_critical}', at_least=${var.cpu_at_least_percentage_critical}%{endif}))).publish('MAJOR') +EOF + + rule { + description = "is too high > ${var.cpu_threshold_critical}%" + severity = "Critical" + detect_label = "CRIT" + disabled = coalesce(var.cpu_disabled_critical, var.cpu_disabled, var.detectors_disabled) + notifications = try(coalescelist(lookup(var.cpu_notifications, "critical", []), var.notifications.critical), null) + runbook_url = try(coalesce(var.cpu_runbook_url, var.runbook_url), "") + tip = var.cpu_tip + parameterized_subject = var.message_subject == "" ? local.rule_subject : var.message_subject + parameterized_body = var.message_body == "" ? local.rule_body : var.message_body + } + + rule { + description = "is too high > ${var.cpu_threshold_major}%" + severity = "Major" + detect_label = "MAJOR" + disabled = coalesce(var.cpu_disabled_major, var.cpu_disabled, var.detectors_disabled) + notifications = try(coalescelist(lookup(var.cpu_notifications, "major", []), var.notifications.major), null) + runbook_url = try(coalesce(var.cpu_runbook_url, var.runbook_url), "") + tip = var.cpu_tip + parameterized_subject = var.message_subject == "" ? local.rule_subject : var.message_subject + parameterized_body = var.message_body == "" ? local.rule_body : var.message_body + } + + max_delay = var.cpu_max_delay +} + +resource "signalfx_detector" "storage_usage" { + name = format("%s %s", local.detector_name_prefix, "Azure SQL Managed Instances storage usage") + + authorized_writer_teams = var.authorized_writer_teams + teams = try(coalescelist(var.teams, var.authorized_writer_teams), null) + tags = compact(concat(local.common_tags, local.tags, var.extra_tags)) + + viz_options { + label = "signal" + value_suffix = "Megabyte" + } + + program_text = <<-EOF + base_filtering = filter('resource_type', 'Microsoft.Sql/managedInstances') and filter('primary_aggregation_type', 'true') + signal = data('storage_space_used_mb', filter=base_filtering and ${module.filtering.signalflow})${var.storage_usage_aggregation_function}${var.storage_usage_transformation_function}.publish('signal') + detect(when(signal > ${var.storage_usage_threshold_critical}%{if var.storage_usage_lasting_duration_critical != null}, lasting='${var.storage_usage_lasting_duration_critical}', at_least=${var.storage_usage_at_least_percentage_critical}%{endif})).publish('CRIT') + detect(when(signal > ${var.storage_usage_threshold_major}%{if var.storage_usage_lasting_duration_major != null}, lasting='${var.storage_usage_lasting_duration_major}', at_least=${var.storage_usage_at_least_percentage_major}%{endif}) and (not when(signal > ${var.storage_usage_threshold_critical}%{if var.storage_usage_lasting_duration_critical != null}, lasting='${var.storage_usage_lasting_duration_critical}', at_least=${var.storage_usage_at_least_percentage_critical}%{endif}))).publish('MAJOR') +EOF + + rule { + description = "is too high > ${var.storage_usage_threshold_critical}Megabyte" + severity = "Critical" + detect_label = "CRIT" + disabled = coalesce(var.storage_usage_disabled_critical, var.storage_usage_disabled, var.detectors_disabled) + notifications = try(coalescelist(lookup(var.storage_usage_notifications, "critical", []), var.notifications.critical), null) + runbook_url = try(coalesce(var.storage_usage_runbook_url, var.runbook_url), "") + tip = var.storage_usage_tip + parameterized_subject = var.message_subject == "" ? local.rule_subject : var.message_subject + parameterized_body = var.message_body == "" ? local.rule_body : var.message_body + } + + rule { + description = "is too high > ${var.storage_usage_threshold_major}Megabyte" + severity = "Major" + detect_label = "MAJOR" + disabled = coalesce(var.storage_usage_disabled_major, var.storage_usage_disabled, var.detectors_disabled) + notifications = try(coalescelist(lookup(var.storage_usage_notifications, "major", []), var.notifications.major), null) + runbook_url = try(coalesce(var.storage_usage_runbook_url, var.runbook_url), "") + tip = var.storage_usage_tip + parameterized_subject = var.message_subject == "" ? local.rule_subject : var.message_subject + parameterized_body = var.message_body == "" ? local.rule_body : var.message_body + } + + max_delay = var.storage_usage_max_delay +} + diff --git a/modules/integration_azure-sql-managed-instances/outputs.tf b/modules/integration_azure-sql-managed-instances/outputs.tf new file mode 100644 index 000000000..f0f03645f --- /dev/null +++ b/modules/integration_azure-sql-managed-instances/outputs.tf @@ -0,0 +1,10 @@ +output "cpu" { + description = "Detector resource for cpu" + value = signalfx_detector.cpu +} + +output "storage_usage" { + description = "Detector resource for storage_usage" + value = signalfx_detector.storage_usage +} + diff --git a/modules/integration_azure-sql-managed-instances/variables-gen.tf b/modules/integration_azure-sql-managed-instances/variables-gen.tf new file mode 100644 index 000000000..db7e9e6e3 --- /dev/null +++ b/modules/integration_azure-sql-managed-instances/variables-gen.tf @@ -0,0 +1,178 @@ +# cpu detector + +variable "cpu_notifications" { + description = "Notification recipients list per severity overridden for cpu detector" + type = map(list(string)) + default = {} +} + +variable "cpu_aggregation_function" { + description = "Aggregation function and group by for cpu detector (i.e. \".mean(by=['host'])\")" + type = string + default = ".mean(by=['azure_resource_name', 'azure_resource_group_name', 'azure_region'])" +} + +variable "cpu_transformation_function" { + description = "Transformation function for cpu detector (i.e. \".mean(over='5m')\")" + type = string + default = "" +} + +variable "cpu_max_delay" { + description = "Enforce max delay for cpu detector (use \"0\" or \"null\" for \"Auto\")" + type = number + default = null +} + +variable "cpu_tip" { + description = "Suggested first course of action or any note useful for incident handling" + type = string + default = "" +} + +variable "cpu_runbook_url" { + description = "URL like SignalFx dashboard or wiki page which can help to troubleshoot the incident cause" + type = string + default = "" +} + +variable "cpu_disabled" { + description = "Disable all alerting rules for cpu detector" + type = bool + default = null +} + +variable "cpu_disabled_critical" { + description = "Disable critical alerting rule for cpu detector" + type = bool + default = null +} + +variable "cpu_disabled_major" { + description = "Disable major alerting rule for cpu detector" + type = bool + default = null +} + +variable "cpu_threshold_critical" { + description = "Critical threshold for cpu detector in %" + type = number + default = 90 +} + +variable "cpu_lasting_duration_critical" { + description = "Minimum duration that conditions must be true before raising alert" + type = string + default = "15m" +} + +variable "cpu_at_least_percentage_critical" { + description = "Percentage of lasting that conditions must be true before raising alert (>= 0.0 and <= 1.0)" + type = number + default = 1 +} +variable "cpu_threshold_major" { + description = "Major threshold for cpu detector in %" + type = number + default = 80 +} + +variable "cpu_lasting_duration_major" { + description = "Minimum duration that conditions must be true before raising alert" + type = string + default = "15m" +} + +variable "cpu_at_least_percentage_major" { + description = "Percentage of lasting that conditions must be true before raising alert (>= 0.0 and <= 1.0)" + type = number + default = 1 +} +# storage_usage detector + +variable "storage_usage_notifications" { + description = "Notification recipients list per severity overridden for storage_usage detector" + type = map(list(string)) + default = {} +} + +variable "storage_usage_aggregation_function" { + description = "Aggregation function and group by for storage_usage detector (i.e. \".mean(by=['host'])\")" + type = string + default = ".mean(by=['azure_resource_name', 'azure_resource_group_name', 'azure_region'])" +} + +variable "storage_usage_transformation_function" { + description = "Transformation function for storage_usage detector (i.e. \".mean(over='5m')\")" + type = string + default = "" +} + +variable "storage_usage_max_delay" { + description = "Enforce max delay for storage_usage detector (use \"0\" or \"null\" for \"Auto\")" + type = number + default = null +} + +variable "storage_usage_tip" { + description = "Suggested first course of action or any note useful for incident handling" + type = string + default = "" +} + +variable "storage_usage_runbook_url" { + description = "URL like SignalFx dashboard or wiki page which can help to troubleshoot the incident cause" + type = string + default = "" +} + +variable "storage_usage_disabled" { + description = "Disable all alerting rules for storage_usage detector" + type = bool + default = null +} + +variable "storage_usage_disabled_critical" { + description = "Disable critical alerting rule for storage_usage detector" + type = bool + default = null +} + +variable "storage_usage_disabled_major" { + description = "Disable major alerting rule for storage_usage detector" + type = bool + default = null +} + +variable "storage_usage_threshold_critical" { + description = "Critical threshold for storage_usage detector in Megabyte" + type = number +} + +variable "storage_usage_lasting_duration_critical" { + description = "Minimum duration that conditions must be true before raising alert" + type = string + default = null +} + +variable "storage_usage_at_least_percentage_critical" { + description = "Percentage of lasting that conditions must be true before raising alert (>= 0.0 and <= 1.0)" + type = number + default = 1 +} +variable "storage_usage_threshold_major" { + description = "Major threshold for storage_usage detector in Megabyte" + type = number +} + +variable "storage_usage_lasting_duration_major" { + description = "Minimum duration that conditions must be true before raising alert" + type = string + default = null +} + +variable "storage_usage_at_least_percentage_major" { + description = "Percentage of lasting that conditions must be true before raising alert (>= 0.0 and <= 1.0)" + type = number + default = 1 +} From 5fa656b6a4094f656b3838fc94aed13ef4035af4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Chauvet?= Date: Thu, 5 Dec 2024 17:47:16 +0100 Subject: [PATCH 3/4] integration_azure-managed-instances --- .../integration_azure-sql-managed-instances/common-filters.tf | 1 + .../integration_azure-sql-managed-instances/common-locals.tf | 1 + .../integration_azure-sql-managed-instances/common-modules.tf | 1 + .../common-variables.tf | 1 + .../integration_azure-sql-managed-instances/common-versions.tf | 1 + modules/integration_azure-sql-managed-instances/tags.tf | 3 +++ 6 files changed, 8 insertions(+) create mode 120000 modules/integration_azure-sql-managed-instances/common-filters.tf create mode 120000 modules/integration_azure-sql-managed-instances/common-locals.tf create mode 120000 modules/integration_azure-sql-managed-instances/common-modules.tf create mode 120000 modules/integration_azure-sql-managed-instances/common-variables.tf create mode 120000 modules/integration_azure-sql-managed-instances/common-versions.tf create mode 100644 modules/integration_azure-sql-managed-instances/tags.tf diff --git a/modules/integration_azure-sql-managed-instances/common-filters.tf b/modules/integration_azure-sql-managed-instances/common-filters.tf new file mode 120000 index 000000000..9d7fa21ea --- /dev/null +++ b/modules/integration_azure-sql-managed-instances/common-filters.tf @@ -0,0 +1 @@ +../../common/module/filters-integration-azure.tf \ No newline at end of file diff --git a/modules/integration_azure-sql-managed-instances/common-locals.tf b/modules/integration_azure-sql-managed-instances/common-locals.tf new file mode 120000 index 000000000..5672d21ab --- /dev/null +++ b/modules/integration_azure-sql-managed-instances/common-locals.tf @@ -0,0 +1 @@ +../../common/module/locals.tf \ No newline at end of file diff --git a/modules/integration_azure-sql-managed-instances/common-modules.tf b/modules/integration_azure-sql-managed-instances/common-modules.tf new file mode 120000 index 000000000..8c81ef377 --- /dev/null +++ b/modules/integration_azure-sql-managed-instances/common-modules.tf @@ -0,0 +1 @@ +../../common/module/modules.tf \ No newline at end of file diff --git a/modules/integration_azure-sql-managed-instances/common-variables.tf b/modules/integration_azure-sql-managed-instances/common-variables.tf new file mode 120000 index 000000000..f3037a584 --- /dev/null +++ b/modules/integration_azure-sql-managed-instances/common-variables.tf @@ -0,0 +1 @@ +../../common/module/variables.tf \ No newline at end of file diff --git a/modules/integration_azure-sql-managed-instances/common-versions.tf b/modules/integration_azure-sql-managed-instances/common-versions.tf new file mode 120000 index 000000000..fa7f5509f --- /dev/null +++ b/modules/integration_azure-sql-managed-instances/common-versions.tf @@ -0,0 +1 @@ +../../common/module/versions.tf \ No newline at end of file diff --git a/modules/integration_azure-sql-managed-instances/tags.tf b/modules/integration_azure-sql-managed-instances/tags.tf new file mode 100644 index 000000000..be0aa4958 --- /dev/null +++ b/modules/integration_azure-sql-managed-instances/tags.tf @@ -0,0 +1,3 @@ +locals { + tags = ["integration", "azure-sql-managed-instances"] +} From 5dd2933f0ef700969c5a0323a4fb8d8c8d53b2c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Chauvet?= Date: Fri, 6 Dec 2024 18:03:28 +0100 Subject: [PATCH 4/4] integration_azure-managed-instances --- .../integration_azure-sql-managed-instances/conf/01-cpu.yaml | 1 + .../integration_azure-sql-managed-instances/detectors-gen.tf | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/integration_azure-sql-managed-instances/conf/01-cpu.yaml b/modules/integration_azure-sql-managed-instances/conf/01-cpu.yaml index bc8efc12f..9ff0e45d7 100644 --- a/modules/integration_azure-sql-managed-instances/conf/01-cpu.yaml +++ b/modules/integration_azure-sql-managed-instances/conf/01-cpu.yaml @@ -8,6 +8,7 @@ transformation: true signals: signal: metric: "avg_cpu_percent" + rollup: max rules: critical: threshold: 90 diff --git a/modules/integration_azure-sql-managed-instances/detectors-gen.tf b/modules/integration_azure-sql-managed-instances/detectors-gen.tf index 3129f7a10..29fb2719f 100644 --- a/modules/integration_azure-sql-managed-instances/detectors-gen.tf +++ b/modules/integration_azure-sql-managed-instances/detectors-gen.tf @@ -12,7 +12,7 @@ resource "signalfx_detector" "cpu" { program_text = <<-EOF base_filtering = filter('resource_type', 'Microsoft.Sql/managedInstances') and filter('primary_aggregation_type', 'true') - signal = data('avg_cpu_percent', filter=base_filtering and ${module.filtering.signalflow})${var.cpu_aggregation_function}${var.cpu_transformation_function}.publish('signal') + signal = data('avg_cpu_percent', filter=base_filtering and ${module.filtering.signalflow}, rollup='max')${var.cpu_aggregation_function}${var.cpu_transformation_function}.publish('signal') detect(when(signal > ${var.cpu_threshold_critical}%{if var.cpu_lasting_duration_critical != null}, lasting='${var.cpu_lasting_duration_critical}', at_least=${var.cpu_at_least_percentage_critical}%{endif})).publish('CRIT') detect(when(signal > ${var.cpu_threshold_major}%{if var.cpu_lasting_duration_major != null}, lasting='${var.cpu_lasting_duration_major}', at_least=${var.cpu_at_least_percentage_major}%{endif}) and (not when(signal > ${var.cpu_threshold_critical}%{if var.cpu_lasting_duration_critical != null}, lasting='${var.cpu_lasting_duration_critical}', at_least=${var.cpu_at_least_percentage_critical}%{endif}))).publish('MAJOR') EOF