-
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.
feat : convert module integration_aws-elasticsearch to gen format
feat : convert module integration_aws-elasticache-common to gen format feat : support for multiple signal in rules feat : support for multiple time the same severity in rules
- Loading branch information
Showing
35 changed files
with
1,716 additions
and
871 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 was deleted.
Oops, something went wrong.
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,4 @@ | ||
locals { | ||
filters = "filter('aws_tag_env', '${var.environment}') and filter('aws_tag_sfx_monitored', 'true')" | ||
} | ||
|
This file was deleted.
Oops, something went wrong.
44 changes: 44 additions & 0 deletions
44
modules/integration_aws-elasticache-common/common-locals.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,44 @@ | ||
locals { | ||
heartbeat_auto_resolve_after = "1s" | ||
not_running_vm_filters_gcp = "(not filter('gcp_status', '{Code=3, Name=STOPPING}', '{Code=4, Name=TERMINATED}'))" | ||
not_running_vm_filters_aws = "(not filter('aws_state', '{Code: 32,Name: shutting-down}', '{Code: 48,Name: terminated}', '{Code: 64,Name: stopping}', '{Code: 80,Name: stopped}'))" | ||
not_running_vm_filters_azure = "(not filter('azure_power_state', 'PowerState/stopping', 'PowerState/stopped', 'PowerState/deallocating', 'PowerState/deallocated'))" | ||
not_running_vm_filters = format( | ||
"%s and %s and %s", | ||
local.not_running_vm_filters_aws, | ||
local.not_running_vm_filters_gcp, | ||
local.not_running_vm_filters_azure | ||
) | ||
detector_name_prefix = "${join("", formatlist("[%s]", var.prefixes))}[${var.environment}]" | ||
common_tags = concat(["terraform", var.environment], var.teams) | ||
rule_subject_prefix = "[{{ruleSeverity}}]{{{detectorName}}} {{{readableRule}}}" | ||
rule_subject_suffix = "on {{{dimensions}}}" | ||
rule_subject = format("%s ({{inputs.signal.value}}) %s", local.rule_subject_prefix, local.rule_subject_suffix) | ||
rule_subject_novalue = format("%s %s", local.rule_subject_prefix, local.rule_subject_suffix) | ||
rule_body = <<-EOF | ||
**Alert**: | ||
*[{{ruleSeverity}}]{{{detectorName}}} {{{readableRule}}} ({{inputs.signal.value}})* | ||
{{#if anomalous}} | ||
**Triggered at**: | ||
*{{timestamp}}* | ||
{{else}} | ||
**Cleared at**: | ||
*{{timestamp}}* | ||
{{/if}} | ||
{{#notEmpty dimensions}} | ||
**Dimensions**: | ||
*{{{dimensions}}}* | ||
{{/notEmpty}} | ||
{{#if anomalous}} | ||
{{#if runbookUrl}}**Runbook**: | ||
Go to [this page]({{{runbookUrl}}}) for help and analysis. | ||
{{/if}} | ||
{{#if tip}}**Tip**: | ||
{{{tip}}} | ||
{{/if}} | ||
{{/if}} | ||
EOF | ||
} |
This file was deleted.
Oops, something went wrong.
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,8 @@ | ||
module "filtering" { | ||
source = "../internal_filtering" | ||
|
||
filtering_default = local.filters | ||
filtering_custom = var.filtering_custom | ||
append_mode = var.filtering_append | ||
} | ||
|
This file was deleted.
Oops, something went wrong.
78 changes: 78 additions & 0 deletions
78
modules/integration_aws-elasticache-common/common-variables.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,78 @@ | ||
# Global | ||
|
||
variable "environment" { | ||
description = "Infrastructure environment" | ||
type = string | ||
} | ||
|
||
variable "notifications" { | ||
description = "Default notification recipients list per severity" | ||
type = object({ | ||
critical = list(string) | ||
major = list(string) | ||
minor = list(string) | ||
warning = list(string) | ||
info = list(string) | ||
}) | ||
} | ||
|
||
variable "prefixes" { | ||
description = "Prefixes list to prepend between brackets on every monitors names before environment" | ||
type = list(string) | ||
default = [] | ||
} | ||
|
||
variable "filtering_custom" { | ||
description = "Filters as SignalFlow string to either replace or append to default filtering convention which is the only one used if not defined" | ||
type = string | ||
default = null | ||
} | ||
|
||
variable "filtering_append" { | ||
description = "If true, the `filtering_custom` string will be appended to the default filtering convention instead of fully replace it" | ||
type = bool | ||
default = false | ||
} | ||
|
||
variable "detectors_disabled" { | ||
description = "Disable all detectors in this module" | ||
type = bool | ||
default = false | ||
} | ||
|
||
variable "runbook_url" { | ||
description = "Default runbook URL to apply to all detectors (if not overridden at detector level)" | ||
type = string | ||
default = "" | ||
} | ||
|
||
variable "authorized_writer_teams" { | ||
description = "List of teams IDs authorized (with admins) to edit the detector. If defined, it requires an user token to work" | ||
type = list(string) | ||
default = null | ||
} | ||
|
||
variable "teams" { | ||
description = "List of teams IDs to associate the detector to" | ||
type = list(string) | ||
default = [] | ||
} | ||
|
||
variable "message_subject" { | ||
description = "The subject to use in alerting rules messages which overrides the default template" | ||
type = string | ||
default = "" | ||
} | ||
|
||
variable "message_body" { | ||
description = "The body to use in alerting rules messages which overrides the default template" | ||
type = string | ||
default = "" | ||
} | ||
|
||
variable "extra_tags" { | ||
description = "List of tags to add to the detectors resources, useful to find detectors " | ||
type = list(string) | ||
default = [] | ||
} | ||
|
This file was deleted.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
modules/integration_aws-elasticache-common/common-versions.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,9 @@ | ||
terraform { | ||
required_providers { | ||
signalfx = { | ||
source = "splunk-terraform/signalfx" | ||
version = ">= 7.0.0" | ||
} | ||
} | ||
required_version = ">= 0.12.26" | ||
} |
12 changes: 12 additions & 0 deletions
12
modules/integration_aws-elasticache-common/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,12 @@ | ||
module: AWS ElastiCache | ||
name: heartbeat | ||
|
||
transformation: false | ||
aggregation: ".mean(by=['CacheClusterId'])" | ||
filtering: "filter('stat', 'mean') and filter('namespace', 'AWS/ElastiCache')" | ||
|
||
signals: | ||
signal: | ||
metric: CPUUtilization | ||
rules: | ||
critical: |
21 changes: 21 additions & 0 deletions
21
modules/integration_aws-elasticache-common/conf/01-evictions.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: AWS ElastiCache | ||
name: "Evictions" | ||
|
||
transformation: ".sum(over='15m')" | ||
aggregation: true | ||
|
||
filtering: "filter('namespace', 'AWS/ElastiCache')" | ||
|
||
signals: | ||
signal: | ||
metric: "Evictions" | ||
filter: "filter('stat', 'mean') and filter('CacheNodeId', '*')" | ||
|
||
rules: | ||
major: | ||
threshold: 0 | ||
comparator: ">" | ||
dependency: critical | ||
critical: | ||
threshold: 30 | ||
comparator: ">" |
17 changes: 17 additions & 0 deletions
17
modules/integration_aws-elasticache-common/conf/02-max-connection.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,17 @@ | ||
module: AWS ElastiCache | ||
name: "Max connection" | ||
|
||
transformation: ".max(over='5m')" | ||
aggregation: true | ||
|
||
filtering: "filter('namespace', 'AWS/ElastiCache')" | ||
|
||
signals: | ||
signal: | ||
metric: "CurrConnections" | ||
filter: "filter('stat', 'upper') and filter('CacheNodeId', '*')" | ||
|
||
rules: | ||
critical: | ||
threshold: 64999 | ||
comparator: ">" |
17 changes: 17 additions & 0 deletions
17
modules/integration_aws-elasticache-common/conf/03-current-connection.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,17 @@ | ||
module: AWS ElastiCache | ||
name: "No connection" | ||
|
||
transformation: ".min(over='5m')" | ||
aggregation: true | ||
|
||
filtering: "filter('namespace', 'AWS/ElastiCache')" | ||
|
||
signals: | ||
signal: | ||
metric: "CurrConnections" | ||
filter: "filter('stat', 'lower') and filter('CacheNodeId', '*')" | ||
|
||
rules: | ||
critical: | ||
threshold: 0 | ||
comparator: "<=" |
21 changes: 21 additions & 0 deletions
21
modules/integration_aws-elasticache-common/conf/04-swap.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: AWS ElastiCache | ||
name: "Swap" | ||
|
||
transformation: ".min(over='5m')" | ||
aggregation: true | ||
|
||
filtering: "filter('namespace', 'AWS/ElastiCache')" | ||
|
||
signals: | ||
signal: | ||
metric: "SwapUsage" | ||
filter: "filter('stat', 'upper') and filter('CacheNodeId', '*')" | ||
|
||
rules: | ||
major: | ||
threshold: 0 | ||
comparator: ">" | ||
dependency: critical | ||
critical: | ||
threshold: 50000000 | ||
comparator: ">" |
21 changes: 21 additions & 0 deletions
21
modules/integration_aws-elasticache-common/conf/05-free-memory.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: AWS ElastiCache | ||
name: "Free memory" | ||
|
||
transformation: ".rateofchange().mean(over='15m')" | ||
aggregation: true | ||
|
||
filtering: "filter('namespace', 'AWS/ElastiCache')" | ||
|
||
signals: | ||
signal: | ||
metric: "FreeableMemory" | ||
filter: "filter('stat', 'lower') and filter('CacheNodeId', '*')" | ||
|
||
rules: | ||
minor: | ||
threshold: -50 | ||
comparator: "<" | ||
dependency: major | ||
major: | ||
threshold: -70 | ||
comparator: "<" |
21 changes: 21 additions & 0 deletions
21
modules/integration_aws-elasticache-common/conf/06-evictions-growing.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: AWS ElastiCache | ||
name: "Evictions growing" | ||
|
||
transformation: ".mean(over='5m').rateofchange().scale(100)" | ||
aggregation: true | ||
|
||
filtering: "filter('namespace', 'AWS/ElastiCache')" | ||
|
||
signals: | ||
signal: | ||
metric: "Evictions" | ||
filter: "filter('stat', 'mean') and filter('CacheNodeId', '*')" | ||
|
||
rules: | ||
major: | ||
threshold: 10 | ||
comparator: ">" | ||
dependency: critical | ||
critical: | ||
threshold: 30 | ||
comparator: ">" |
Oops, something went wrong.