-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
481 additions
and
347 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
modules/integration_azure-virtual-machine-scaleset/conf/00-heartbeat.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
module: "Azure Virtual Machine ScaleSet" | ||
name: heartbeat | ||
|
||
transformation: true | ||
aggregation: ".mean(by=['azure_resource_name', 'azure_resource_group_name', 'azure_region'])" | ||
|
||
filtering: "filter('resource_type', 'Microsoft.Compute/virtualMachineScaleSets') and filter('primary_aggregation_type', 'true')" | ||
|
||
signals: | ||
signal: | ||
metric: "Percentage CPU" | ||
rules: | ||
critical: | ||
... |
2 changes: 1 addition & 1 deletion
2
modules/integration_azure-virtual-machine-scaleset/conf/readme.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
modules/integration_azure-virtual-machine/conf/00-heartbeat.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
module: "Azure Virtual Machine" | ||
name: heartbeat | ||
|
||
transformation: true | ||
aggregation: ".mean(by=['azure_resource_name', 'azure_resource_group_name', 'azure_region'])" | ||
|
||
filtering: "filter('resource_type', 'Microsoft.Compute/virtualMachines') and filter('primary_aggregation_type', 'true') and (not filter('azure_power_state', 'PowerState/stopping', 'PowerState/stopped', 'PowerState/deallocating', 'PowerState/deallocated'))" | ||
|
||
signals: | ||
signal: | ||
metric: "Percentage CPU" | ||
rules: | ||
critical: | ||
... |
21 changes: 21 additions & 0 deletions
21
modules/integration_azure-virtual-machine/conf/01-cpu.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
module: "Azure Virtual Machine" | ||
name: "CPU" | ||
filtering: "filter('resource_type', 'Microsoft.Compute/virtualMachines') and filter('primary_aggregation_type', 'true') and (not filter('azure_power_state', 'PowerState/stopping', 'PowerState/stopped', 'PowerState/deallocating', 'PowerState/deallocated'))" | ||
aggregation: ".mean(by=['azure_resource_name', 'azure_resource_group_name', 'azure_region'])" | ||
value_unit: "%" | ||
transformation: true | ||
signals: | ||
signal: | ||
metric: "cpu_percent" | ||
rules: | ||
critical: | ||
threshold: 90 | ||
comparator: ">" | ||
lasting_duration: '15m' | ||
major: | ||
threshold: 80 | ||
comparator: ">" | ||
lasting_duration: '15m' | ||
dependency: critical | ||
... |
25 changes: 25 additions & 0 deletions
25
modules/integration_azure-virtual-machine/conf/02-cpu-credit.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
module: "Azure Virtual Machine" | ||
name: "remaining CPU credit" | ||
filtering: "filter('resource_type', 'Microsoft.Compute/virtualMachines') and filter('primary_aggregation_type', 'true') and (not filter('azure_power_state', 'PowerState/stopping', 'PowerState/stopped', 'PowerState/deallocating', 'PowerState/deallocated'))" | ||
aggregation: ".mean(by=['azure_resource_name', 'azure_resource_group_name', 'azure_region'])" | ||
value_unit: "%" | ||
transformation: true | ||
signals: | ||
remaining: | ||
metric: "CPU Credits Remaining" | ||
consumed: | ||
metric: "CPU Credits Consumed" | ||
signal: | ||
formula: (remaining/(remaining+consumed)).scale(100).fill(100) | ||
rules: | ||
critical: | ||
threshold: 15 | ||
comparator: "<" | ||
lasting_duration: '5m' | ||
major: | ||
threshold: 30 | ||
comparator: "<" | ||
lasting_duration: '5m' | ||
dependency: critical | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
documentations: | ||
- name: Azure Monitor metrics | ||
url: 'https://docs.microsoft.com/en-us/azure/azure-monitor/essentials/metrics-supported#microsoftcomputevirtualmachines' | ||
url: 'https://learn.microsoft.com/en-us/azure/azure-monitor/reference/supported-metrics/microsoft-compute-virtualmachines-metrics' |
123 changes: 123 additions & 0 deletions
123
modules/integration_azure-virtual-machine/detectors-gen.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
resource "signalfx_detector" "heartbeat" { | ||
name = format("%s %s", local.detector_name_prefix, "Azure Virtual Machine heartbeat") | ||
|
||
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)) | ||
|
||
program_text = <<-EOF | ||
from signalfx.detectors.not_reporting import not_reporting | ||
base_filtering = filter('resource_type', 'Microsoft.Compute/virtualMachines') and filter('primary_aggregation_type', 'true') and (not filter('azure_power_state', 'PowerState/stopping', 'PowerState/stopped', 'PowerState/deallocating', 'PowerState/deallocated')) | ||
signal = data('Percentage CPU', filter=base_filtering and ${module.filtering.signalflow})${var.heartbeat_aggregation_function}${var.heartbeat_transformation_function}.publish('signal') | ||
not_reporting.detector(stream=signal, resource_identifier=None, duration='${var.heartbeat_timeframe}', auto_resolve_after='${local.heartbeat_auto_resolve_after}').publish('CRIT') | ||
EOF | ||
|
||
rule { | ||
description = "has not reported in ${var.heartbeat_timeframe}" | ||
severity = "Critical" | ||
detect_label = "CRIT" | ||
disabled = coalesce(var.heartbeat_disabled, var.detectors_disabled) | ||
notifications = try(coalescelist(lookup(var.heartbeat_notifications, "critical", []), var.notifications.critical), null) | ||
runbook_url = try(coalesce(var.heartbeat_runbook_url, var.runbook_url), "") | ||
tip = var.heartbeat_tip | ||
parameterized_subject = var.message_subject == "" ? local.rule_subject_novalue : var.message_subject | ||
parameterized_body = var.message_body == "" ? local.rule_body : var.message_body | ||
} | ||
|
||
max_delay = var.heartbeat_max_delay | ||
} | ||
|
||
resource "signalfx_detector" "cpu" { | ||
name = format("%s %s", local.detector_name_prefix, "Azure Virtual Machine 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.Compute/virtualMachines') and filter('primary_aggregation_type', 'true') and (not filter('azure_power_state', 'PowerState/stopping', 'PowerState/stopped', 'PowerState/deallocating', 'PowerState/deallocated')) | ||
signal = data('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}, lasting=%{if var.cpu_lasting_duration_critical == null}None%{else}'${var.cpu_lasting_duration_critical}'%{endif}, at_least=${var.cpu_at_least_percentage_critical})).publish('CRIT') | ||
detect(when(signal > ${var.cpu_threshold_major}, lasting=%{if var.cpu_lasting_duration_major == null}None%{else}'${var.cpu_lasting_duration_major}'%{endif}, at_least=${var.cpu_at_least_percentage_major}) and (not when(signal > ${var.cpu_threshold_critical}, lasting=%{if var.cpu_lasting_duration_critical == null}None%{else}'${var.cpu_lasting_duration_critical}'%{endif}, at_least=${var.cpu_at_least_percentage_critical}))).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" "remaining_cpu_credit" { | ||
name = format("%s %s", local.detector_name_prefix, "Azure Virtual Machine remaining cpu credit") | ||
|
||
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.Compute/virtualMachines') and filter('primary_aggregation_type', 'true') and (not filter('azure_power_state', 'PowerState/stopping', 'PowerState/stopped', 'PowerState/deallocating', 'PowerState/deallocated')) | ||
remaining = data('CPU Credits Remaining', filter=base_filtering and ${module.filtering.signalflow})${var.remaining_cpu_credit_aggregation_function}${var.remaining_cpu_credit_transformation_function} | ||
consumed = data('CPU Credits Consumed', filter=base_filtering and ${module.filtering.signalflow})${var.remaining_cpu_credit_aggregation_function}${var.remaining_cpu_credit_transformation_function} | ||
signal = (remaining/(remaining+consumed)).scale(100).fill(100).publish('signal') | ||
detect(when(signal < ${var.remaining_cpu_credit_threshold_critical}, lasting=%{if var.remaining_cpu_credit_lasting_duration_critical == null}None%{else}'${var.remaining_cpu_credit_lasting_duration_critical}'%{endif}, at_least=${var.remaining_cpu_credit_at_least_percentage_critical})).publish('CRIT') | ||
detect(when(signal < ${var.remaining_cpu_credit_threshold_major}, lasting=%{if var.remaining_cpu_credit_lasting_duration_major == null}None%{else}'${var.remaining_cpu_credit_lasting_duration_major}'%{endif}, at_least=${var.remaining_cpu_credit_at_least_percentage_major}) and (not when(signal < ${var.remaining_cpu_credit_threshold_critical}, lasting=%{if var.remaining_cpu_credit_lasting_duration_critical == null}None%{else}'${var.remaining_cpu_credit_lasting_duration_critical}'%{endif}, at_least=${var.remaining_cpu_credit_at_least_percentage_critical}))).publish('MAJOR') | ||
EOF | ||
|
||
rule { | ||
description = "is too low < ${var.remaining_cpu_credit_threshold_critical}%" | ||
severity = "Critical" | ||
detect_label = "CRIT" | ||
disabled = coalesce(var.remaining_cpu_credit_disabled_critical, var.remaining_cpu_credit_disabled, var.detectors_disabled) | ||
notifications = try(coalescelist(lookup(var.remaining_cpu_credit_notifications, "critical", []), var.notifications.critical), null) | ||
runbook_url = try(coalesce(var.remaining_cpu_credit_runbook_url, var.runbook_url), "") | ||
tip = var.remaining_cpu_credit_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 low < ${var.remaining_cpu_credit_threshold_major}%" | ||
severity = "Major" | ||
detect_label = "MAJOR" | ||
disabled = coalesce(var.remaining_cpu_credit_disabled_major, var.remaining_cpu_credit_disabled, var.detectors_disabled) | ||
notifications = try(coalescelist(lookup(var.remaining_cpu_credit_notifications, "major", []), var.notifications.major), null) | ||
runbook_url = try(coalesce(var.remaining_cpu_credit_runbook_url, var.runbook_url), "") | ||
tip = var.remaining_cpu_credit_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.remaining_cpu_credit_max_delay | ||
} | ||
|
Oops, something went wrong.