Skip to content

Commit

Permalink
Merge branch 'master' into integration_gcp-firebase
Browse files Browse the repository at this point in the history
  • Loading branch information
ndo77 authored Dec 16, 2024
2 parents 6b0305c + eca7084 commit 0d61cfe
Show file tree
Hide file tree
Showing 30 changed files with 802 additions and 5 deletions.
12 changes: 12 additions & 0 deletions docs/severity.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- [integration_aws-apigateway](#integration_aws-apigateway)
- [integration_aws-backup](#integration_aws-backup)
- [integration_aws-beanstalk](#integration_aws-beanstalk)
- [integration_aws-direct-connect](#integration_aws-direct-connect)
- [integration_aws-ecs-cluster](#integration_aws-ecs-cluster)
- [integration_aws-ecs-service](#integration_aws-ecs-service)
- [integration_aws-efs](#integration_aws-efs)
Expand Down Expand Up @@ -177,6 +178,7 @@
|---|---|---|---|---|---|
|Azure VPN heartbeat|X|-|-|-|-|
|Azure VPN total flow count|X|-|-|-|-|
|Azure VPN ipsec tunnel status|X|X|-|-|-|


## integration_aws-alb
Expand Down Expand Up @@ -235,6 +237,15 @@
|AWS Beanstalk instance root filesystem usage|X|X|-|-|-|


## integration_aws-direct-connect

|Detector|Critical|Major|Minor|Warning|Info|
|---|---|---|---|---|---|
|AWS Direct Connect heartbeat|X|-|-|-|-|
|AWS Direct Connect connection state|X|-|-|-|-|
|AWS Direct Connect virtual interface traffic|X|-|-|-|-|


## integration_aws-ecs-cluster

|Detector|Critical|Major|Minor|Warning|Info|
Expand Down Expand Up @@ -592,6 +603,7 @@
|Detector|Critical|Major|Minor|Warning|Info|
|---|---|---|---|---|---|
|Azure Load Balancer heartbeat|X|-|-|-|-|
|Azure Load Balancer backend unhealthy host ratio|X|X|-|-|-|


## integration_azure-mariadb
Expand Down
2 changes: 2 additions & 0 deletions modules/fame_azure-vpn/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ This module creates the following SignalFx detectors which could contain one or
|---|---|---|---|---|---|
|Azure VPN heartbeat|X|-|-|-|-|
|Azure VPN total flow count|X|-|-|-|-|
|Azure VPN ipsec tunnel status|X|X|-|-|-|

## How to collect required metrics?

Expand All @@ -97,6 +98,7 @@ Check the [Related documentation](#related-documentation) section for more detai
Here is the list of required metrics for detectors in this module.

* `fame.azure.virtual_network_gateway.total_flow_count`
* `fame.azure.virtual_network_gateway.tunnel_status`



Expand Down
2 changes: 1 addition & 1 deletion modules/fame_azure-vpn/conf/00-heartbeat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ aggregation: true

signals:
signal:
metric: fame.azure.virtual_network_gateway.total_flow_count
metric: fame.azure.virtual_network_gateway.tunnel_status

rules:
critical:
2 changes: 2 additions & 0 deletions modules/fame_azure-vpn/conf/01-total-flow-count.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ signals:
signal:
metric: fame.azure.virtual_network_gateway.total_flow_count

disabled: true

rules:
critical:
threshold: 0
Expand Down
21 changes: 21 additions & 0 deletions modules/fame_azure-vpn/conf/02-tunnel-status.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module: Azure VPN
name: IPSEC Tunnel Status
id: tunnel_status

transformation: true
aggregation: ".mean(by=['azure_resource_group', 'azure_resource_name', 'remote_ip'])"

signals:
signal:
metric: fame.azure.virtual_network_gateway.tunnel_status

rules:
critical:
threshold: 0
comparator: "=="
lasting_duration: '20m'
major:
threshold: 0
comparator: "=="
lasting_duration: '10m'
dependency: critical
42 changes: 41 additions & 1 deletion modules/fame_azure-vpn/detectors-gen.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ resource "signalfx_detector" "heartbeat" {

program_text = <<-EOF
from signalfx.detectors.not_reporting import not_reporting
signal = data('fame.azure.virtual_network_gateway.total_flow_count', filter=${module.filtering.signalflow})${var.heartbeat_aggregation_function}${var.heartbeat_transformation_function}.publish('signal')
signal = data('fame.azure.virtual_network_gateway.tunnel_status', filter=${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

Expand Down Expand Up @@ -53,3 +53,43 @@ EOF
max_delay = var.totalflowcount_max_delay
}

resource "signalfx_detector" "tunnel_status" {
name = format("%s %s", local.detector_name_prefix, "Azure VPN ipsec tunnel status")

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
signal = data('fame.azure.virtual_network_gateway.tunnel_status', filter=${module.filtering.signalflow})${var.tunnel_status_aggregation_function}${var.tunnel_status_transformation_function}.publish('signal')
detect(when(signal == ${var.tunnel_status_threshold_critical}%{if var.tunnel_status_lasting_duration_critical != null}, lasting='${var.tunnel_status_lasting_duration_critical}', at_least=${var.tunnel_status_at_least_percentage_critical}%{endif})).publish('CRIT')
detect(when(signal == ${var.tunnel_status_threshold_major}%{if var.tunnel_status_lasting_duration_major != null}, lasting='${var.tunnel_status_lasting_duration_major}', at_least=${var.tunnel_status_at_least_percentage_major}%{endif}) and (not when(signal == ${var.tunnel_status_threshold_critical}%{if var.tunnel_status_lasting_duration_critical != null}, lasting='${var.tunnel_status_lasting_duration_critical}', at_least=${var.tunnel_status_at_least_percentage_critical}%{endif}))).publish('MAJOR')
EOF

rule {
description = "is == ${var.tunnel_status_threshold_critical}"
severity = "Critical"
detect_label = "CRIT"
disabled = coalesce(var.tunnel_status_disabled_critical, var.tunnel_status_disabled, var.detectors_disabled)
notifications = try(coalescelist(lookup(var.tunnel_status_notifications, "critical", []), var.notifications.critical), null)
runbook_url = try(coalesce(var.tunnel_status_runbook_url, var.runbook_url), "")
tip = var.tunnel_status_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 == ${var.tunnel_status_threshold_major}"
severity = "Major"
detect_label = "MAJOR"
disabled = coalesce(var.tunnel_status_disabled_major, var.tunnel_status_disabled, var.detectors_disabled)
notifications = try(coalescelist(lookup(var.tunnel_status_notifications, "major", []), var.notifications.major), null)
runbook_url = try(coalesce(var.tunnel_status_runbook_url, var.runbook_url), "")
tip = var.tunnel_status_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.tunnel_status_max_delay
}

5 changes: 5 additions & 0 deletions modules/fame_azure-vpn/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@ output "totalflowcount" {
value = signalfx_detector.totalflowcount
}

output "tunnel_status" {
description = "Detector resource for tunnel_status"
value = signalfx_detector.tunnel_status
}

92 changes: 91 additions & 1 deletion modules/fame_azure-vpn/variables-gen.tf
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ variable "totalflowcount_runbook_url" {
variable "totalflowcount_disabled" {
description = "Disable all alerting rules for totalflowcount detector"
type = bool
default = null
default = true
}

variable "totalflowcount_threshold_critical" {
Expand All @@ -109,3 +109,93 @@ variable "totalflowcount_at_least_percentage_critical" {
type = number
default = 1
}
# tunnel_status detector

variable "tunnel_status_notifications" {
description = "Notification recipients list per severity overridden for tunnel_status detector"
type = map(list(string))
default = {}
}

variable "tunnel_status_aggregation_function" {
description = "Aggregation function and group by for tunnel_status detector (i.e. \".mean(by=['host'])\")"
type = string
default = ".mean(by=['azure_resource_group', 'azure_resource_name', 'remote_ip'])"
}

variable "tunnel_status_transformation_function" {
description = "Transformation function for tunnel_status detector (i.e. \".mean(over='5m')\")"
type = string
default = ""
}

variable "tunnel_status_max_delay" {
description = "Enforce max delay for tunnel_status detector (use \"0\" or \"null\" for \"Auto\")"
type = number
default = null
}

variable "tunnel_status_tip" {
description = "Suggested first course of action or any note useful for incident handling"
type = string
default = ""
}

variable "tunnel_status_runbook_url" {
description = "URL like SignalFx dashboard or wiki page which can help to troubleshoot the incident cause"
type = string
default = ""
}

variable "tunnel_status_disabled" {
description = "Disable all alerting rules for tunnel_status detector"
type = bool
default = null
}

variable "tunnel_status_disabled_critical" {
description = "Disable critical alerting rule for tunnel_status detector"
type = bool
default = null
}

variable "tunnel_status_disabled_major" {
description = "Disable major alerting rule for tunnel_status detector"
type = bool
default = null
}

variable "tunnel_status_threshold_critical" {
description = "Critical threshold for tunnel_status detector"
type = number
default = 0
}

variable "tunnel_status_lasting_duration_critical" {
description = "Minimum duration that conditions must be true before raising alert"
type = string
default = "20m"
}

variable "tunnel_status_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 "tunnel_status_threshold_major" {
description = "Major threshold for tunnel_status detector"
type = number
default = 0
}

variable "tunnel_status_lasting_duration_major" {
description = "Minimum duration that conditions must be true before raising alert"
type = string
default = "10m"
}

variable "tunnel_status_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
}
108 changes: 108 additions & 0 deletions modules/integration_aws-direct-connect/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# AWS-DIRECT-CONNECT SignalFx detectors

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
: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)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

## 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-aws-direct-connect" {
source = "github.com/claranet/terraform-signalfx-detectors.git//modules/integration_aws-direct-connect?ref={revision}"
environment = var.environment
notifications = local.notifications
}
```

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|
|---|---|---|---|---|---|
|AWS Direct Connect heartbeat|X|-|-|-|-|
|AWS Direct Connect connection state|X|-|-|-|-|
|AWS Direct Connect virtual interface traffic|X|-|-|-|-|

## How to collect required metrics?

This module deploys detectors using metrics reported by the
[AWS integration](https://docs.splunk.com/Observability/gdi/get-data-in/connect/aws/aws.html) configurable
with [this Terraform module](https://github.com/claranet/terraform-signalfx-integrations/tree/master/cloud/aws).


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.

* `ConnectionState`
* `VirtualInterfaceBpsEgress`




## 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)
1 change: 1 addition & 0 deletions modules/integration_aws-direct-connect/common-filters.tf
1 change: 1 addition & 0 deletions modules/integration_aws-direct-connect/common-locals.tf
1 change: 1 addition & 0 deletions modules/integration_aws-direct-connect/common-modules.tf
1 change: 1 addition & 0 deletions modules/integration_aws-direct-connect/common-variables.tf
1 change: 1 addition & 0 deletions modules/integration_aws-direct-connect/common-versions.tf
8 changes: 8 additions & 0 deletions modules/integration_aws-direct-connect/conf/00-heartbeat.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module: AWS Direct Connect
name: heartbeat

signals:
signal:
metric: "ConnectionState"
rules:
critical:
Loading

0 comments on commit 0d61cfe

Please sign in to comment.