Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating monitors with FGP #66

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 46 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,18 @@ provider "sumologic" {
environment = "<SUMOLOGIC DEPLOYMENT>"
}
```

#### Required Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_access_id"></a> [access\_id](#input\_access\_id) | Sumo Logic Access ID. Visit https://help.sumologic.com/Manage/Security/Access-Keys#Create_an_access_key | `string` | n/a | yes |
| <a name="input_access_key"></a> [access\_key](#input\_access\_key) | Sumo Logic Access Key. | `string` | n/a | yes |
| <a name="input_environment"></a> [environment](#input\_environment) | Please update with your deployment, refer: https://help.sumologic.com/APIs/General-API-Information/Sumo-Logic-Endpoints-and-Firewall-Security | `string` | n/a | yes |
| <a name="input_sumologic_organization_id"></a> [sumologic\_organization\_id](#input\_sumologic\_organization\_id) | You can find your org on the Preferences page in the Sumo Logic UI.<br> For more details, visit https://help.sumologic.com/01Start-Here/05Customize-Your-Sumo-Logic-Experience/Preferences-Page | `string` | n/a | yes |

You can also define these values in `terraform.tfvars`.

#### Optional Prerequisites

Sumo Logic monitors can be configured in a folder.
Expand Down Expand Up @@ -76,7 +87,7 @@ module "sumologic-logs-monitor" {
triggers = [
{
threshold_type = "GreaterThanOrEqual",
threshold = 0,
threshold = 5,
time_range = "5m",
occurrence_type = "ResultCount", # Options: ResultCount and MissingData for logs
trigger_source = "AllResults", # Options: AllResults for logs.
Expand All @@ -85,7 +96,7 @@ module "sumologic-logs-monitor" {
},
{
threshold_type = "LessThan",
threshold = 0,
threshold = 5,
time_range = "5m",
occurrence_type = "ResultCount", # Options: ResultCount and MissingData for logs
trigger_source = "AllResults", # Options: AllResults for logs.
Expand Down Expand Up @@ -218,3 +229,36 @@ module "sumologic-metrics-monitor" {
- [Oracle](./monitor_packages/Oracle)
- [Squid Proxy](https://github.com/SumoLogic/terraform-sumologic-sumo-logic-monitor/tree/main/monitor_packages/SquidProxy)
- [Couchbase](https://github.com/SumoLogic/terraform-sumologic-sumo-logic-monitor/tree/main/monitor_packages/Couchbase)

## Resources

| Name | Type |
|------|------|
| [sumologic_monitor.tf_monitor](https://registry.terraform.io/providers/SumoLogic/sumologic/latest/docs/resources/monitor) | resource |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_connection_notifications"></a> [connection\_notifications](#input\_connection\_notifications) | Connection Notifications to be sent by the alert. | <pre>list(object(<br> {<br> connection_type = string,<br> connection_id = string,<br> payload_override = string,<br> run_for_trigger_types = list(string)<br> }<br> ))</pre> | n/a | yes |
| <a name="input_email_notifications"></a> [email\_notifications](#input\_email\_notifications) | Email Notifications to be sent by the alert. | <pre>list(object(<br> {<br> connection_type = string,<br> recipients = list(string),<br> subject = string,<br> time_zone = string,<br> message_body = string,<br> run_for_trigger_types = list(string)<br> }<br> ))</pre> | n/a | yes |
| <a name="input_group_notifications"></a> [group\_notifications](#input\_group\_notifications) | Whether or not to group notifications for individual items that meet the trigger condition. Defaults to true. | `bool` | `true` | no |
| <a name="input_monitor_description"></a> [monitor\_description](#input\_monitor\_description) | The description of the monitor. | `string` | `""` | no |
| <a name="input_monitor_evaluation_delay"></a> [monitor\_evaluation\_delay](#input\_monitor\_evaluation\_delay) | Evaluation Delay. | `string` | `"0m"` | no |
| <a name="input_monitor_is_disabled"></a> [monitor\_is\_disabled](#input\_monitor\_is\_disabled) | Whether or not the monitor is disabled. Default false. | `bool` | `false` | no |
| <a name="input_monitor_monitor_type"></a> [monitor\_monitor\_type](#input\_monitor\_monitor\_type) | The type of monitor, Logs or Metrics. Default Logs | `string` | `"Logs"` | no |
| <a name="input_monitor_name"></a> [monitor\_name](#input\_monitor\_name) | Monitor Name | `string` | n/a | yes |
| <a name="input_monitor_parent_id"></a> [monitor\_parent\_id](#input\_monitor\_parent\_id) | The ID of the Monitor Folder that contains this monitor. | `string` | `null` | no |
| <a name="input_monitor_permission"></a> [monitor\_permission](#input\_monitor\_permission) | An monitor\_permission is used to control permissions Explicitly associated with a Monitor | <pre>list(object(<br> {<br> subject_type = string,<br> subject_id = string,<br> permissions = list(string)<br> }<br> ))</pre> | `[]` | no |
| <a name="input_monitor_slo_id"></a> [monitor\_slo\_id](#input\_monitor\_slo\_id) | Slo Id. Required if Monitor Type is Slo. | `string` | `null` | no |
| <a name="input_monitor_slo_type"></a> [monitor\_slo\_type](#input\_monitor\_slo\_type) | The type of Slo, Sli or BurnRate. Required if Monitor Type is Slo. | `string` | `null` | no |
| <a name="input_queries"></a> [queries](#input\_queries) | All queries for the monitor. | `map` | `null` | no |
| <a name="input_slo_burnrate_triggers"></a> [slo\_burnrate\_triggers](#input\_slo\_burnrate\_triggers) | Triggers for SLO Burn Rate alerting. | <pre>list(object(<br> {<br> threshold = number,<br> time_range = string,<br> trigger_type = string,<br> }<br> ))</pre> | `null` | no |
| <a name="input_slo_sli_triggers"></a> [slo\_sli\_triggers](#input\_slo\_sli\_triggers) | Triggers for SLO Sli alerting. | <pre>list(object(<br> {<br> threshold = number,<br> trigger_type = string,<br> }<br> ))</pre> | `null` | no |
| <a name="input_triggers"></a> [triggers](#input\_triggers) | Triggers for alerting. | <pre>list(object(<br> {<br> threshold_type = string,<br> threshold = number,<br> time_range = string,<br> occurrence_type = string,<br> trigger_source = string,<br> trigger_type = string,<br> detection_method = string<br> }<br> ))</pre> | `null` | no |

## Outputs

| Name | Description |
|------|-------------|
| <a name="output_sumologic_monitor"></a> [sumologic\_monitor](#output\_sumologic\_monitor) | This output contains details of the Sumo Logic monitor. |
2 changes: 2 additions & 0 deletions monitor_packages/ActiveMQ/activemq.auto.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ access_id = "<YOUR SUMO ACCESS ID>"
access_key = "<YOUR SUMO ACCESS KEY>"
# Please update with your deployment, refer: https://help.sumologic.com/APIs/General-API-Information/Sumo-Logic-Endpoints-and-Firewall-Security
environment = "<DEPLOYMENT>"
# Please replace <YOUR SUMO ORGANIZATION ID> (including brackets) with your Sumo Organization ID.
sumologic_organization_id ="<YOUR SUMO ORGANIZATION ID>"
# This flag determines whether to enable all monitors or not.
monitors_disabled = true
# The Sumo Logic monitors will be installed in a folder specified by this value.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@ provider "sumologic" {
resource "sumologic_monitor_folder" "tf_monitor_folder" {
name = var.folder
description = "Folder for ActiveMQ Monitors"
obj_permission {
subject_type = "org"
subject_id = var.sumologic_organization_id
permissions = ["Create", "Read", "Update", "Delete", "Manage"]
}
}
10 changes: 10 additions & 0 deletions monitor_packages/ActiveMQ/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ variable "environment" {
error_message = "Argument \"environment\" must be one of \"us1\",\"us2\",\"au\",\"ca\",\"de\",\"eu\",\"fed\",\"jp\",\"in\"."
}
}
variable "sumologic_organization_id" {
type = string
description = <<EOT
You can find your org on the Preferences page in the Sumo Logic UI. For more information, see the Preferences Page topic. For more details, visit https://help.sumologic.com/01Start-Here/05Customize-Your-Sumo-Logic-Experience/Preferences-Page
EOT
validation {
condition = can(regex("\\w+", var.sumologic_organization_id))
error_message = "The organization ID must contain valid characters."
}
}
variable "folder" {
type = string
description = "Folder where monitors will be created."
Expand Down
10 changes: 6 additions & 4 deletions monitor_packages/ApacheTomcat/ApacheTomcat.auto.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ access_id = "<YOUR SUMO ACCESS ID>"
access_key = "<YOUR SUMO ACCESS KEY>"
# Please update with your deployment, refer: https://help.sumologic.com/APIs/General-API-Information/Sumo-Logic-Endpoints-and-Firewall-Security
environment = "<DEPLOYMENT>"
# Please replace <YOUR SUMO ORGANIZATION ID> (including brackets) with your Sumo Organization ID.
sumologic_organization_id ="<YOUR SUMO ORGANIZATION ID>"
# This flag determines whether to enable all monitors or not.
monitors_disabled = true
# The Sumo Logic monitors will be installed in a folder specified by this value.
folder = "ApacheTomcat"
# Sumo Logic Apache Tomcat Farm Filter. For eg: webserver_farm=tomcat.prod.01
monitors_disabled = true
# The Sumo Logic monitors will be installed in a folder specified by this value.
folder = "ApacheTomcat"
# Sumo Logic Apache Tomcat Farm Filter. For eg: webserver_farm=tomcat.prod.01
apachetomcat_data_source = ""
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@ provider "sumologic" {
environment = var.environment
}

#Sumo Logic Monitor Folder
resource "sumologic_monitor_folder" "tf_monitor_folder_1" {
name = var.folder
description = "Folder for Apache Tomcat Monitors"
#Sumo Logic Monitor Folder
resource "sumologic_monitor_folder" "tf_monitor_folder_1" {
name = var.folder
description = "Folder for Apache Tomcat Monitors"
obj_permission {
subject_type = "org"
subject_id = var.sumologic_organization_id
permissions = ["Create", "Read", "Update", "Delete", "Manage"]
}
}
18 changes: 14 additions & 4 deletions monitor_packages/ApacheTomcat/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ variable "environment" {
error_message = "Argument \"environment\" must be one of \"us1\",\"us2\",\"au\",\"ca\",\"de\",\"eu\",\"fed\",\"jp\",\"in\"."
}
}
variable "sumologic_organization_id" {
type = string
description = <<EOT
You can find your org on the Preferences page in the Sumo Logic UI. For more information, see the Preferences Page topic. For more details, visit https://help.sumologic.com/01Start-Here/05Customize-Your-Sumo-Logic-Experience/Preferences-Page
EOT
validation {
condition = can(regex("\\w+", var.sumologic_organization_id))
error_message = "The organization ID must contain valid characters."
}
}
variable "folder" {
type = string
description = "Folder where monitors will be created."
Expand Down Expand Up @@ -66,8 +76,8 @@ variable "group_notifications" {
type = bool
description = "Whether or not to group notifications for individual items that meet the trigger condition. Defaults to true."
default = true
}
variable "apachetomcat_data_source" {
type = string
description = "Sumo Logic Apache Tomcat Farm Filter. For eg: webserver_farm=tomcat.prod.01"
}
variable "apachetomcat_data_source" {
type = string
description = "Sumo Logic Apache Tomcat Farm Filter. For eg: webserver_farm=tomcat.prod.01"
}
10 changes: 6 additions & 4 deletions monitor_packages/Cassandra/Cassandra.auto.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ access_id = "<YOUR SUMO ACCESS ID>"
access_key = "<YOUR SUMO ACCESS KEY>"
# Please update with your deployment, refer: https://help.sumologic.com/APIs/General-API-Information/Sumo-Logic-Endpoints-and-Firewall-Security
environment = "<DEPLOYMENT>"
# Please replace <YOUR SUMO ORGANIZATION ID> (including brackets) with your Sumo Organization ID.
sumologic_organization_id ="<YOUR SUMO ORGANIZATION ID>"
# This flag determines whether to enable all monitors or not.
monitors_disabled = true
# The Sumo Logic monitors will be installed in a folder specified by this value.
folder = "Cassandra"
# Sumo Logic Cassandra cluster Filter. For eg: db_cluster=cassandra.prod.01
monitors_disabled = true
# The Sumo Logic monitors will be installed in a folder specified by this value.
folder = "Cassandra"
# Sumo Logic Cassandra cluster Filter. For eg: db_cluster=cassandra.prod.01
cassandra_data_source = ""
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@ provider "sumologic" {
environment = var.environment
}

#Sumo Logic Monitor Folder
resource "sumologic_monitor_folder" "tf_monitor_folder_1" {
name = var.folder
description = "Folder for Cassandra Monitors"
#Sumo Logic Monitor Folder
resource "sumologic_monitor_folder" "tf_monitor_folder_1" {
name = var.folder
description = "Folder for Cassandra Monitors"
obj_permission {
subject_type = "org"
subject_id = var.sumologic_organization_id
permissions = ["Create", "Read", "Update", "Delete", "Manage"]
}
}
10 changes: 10 additions & 0 deletions monitor_packages/Cassandra/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ variable "environment" {
error_message = "Argument \"environment\" must be one of \"us1\",\"us2\",\"au\",\"ca\",\"de\",\"eu\",\"fed\",\"jp\",\"in\"."
}
}
variable "sumologic_organization_id" {
type = string
description = <<EOT
You can find your org on the Preferences page in the Sumo Logic UI. For more information, see the Preferences Page topic. For more details, visit https://help.sumologic.com/01Start-Here/05Customize-Your-Sumo-Logic-Experience/Preferences-Page
EOT
validation {
condition = can(regex("\\w+", var.sumologic_organization_id))
error_message = "The organization ID must contain valid characters."
}
}
variable "folder" {
type = string
description = "Folder where monitors will be created."
Expand Down
2 changes: 2 additions & 0 deletions monitor_packages/Couchbase/couchbase.auto.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ access_id = "<YOUR SUMO ACCESS ID>"
access_key = "<YOUR SUMO ACCESS KEY>"
# Please update with your deployment, refer: https://help.sumologic.com/APIs/General-API-Information/Sumo-Logic-Endpoints-and-Firewall-Security
environment = "<DEPLOYMENT>"
# Please replace <YOUR SUMO ORGANIZATION ID> (including brackets) with your Sumo Organization ID.
sumologic_organization_id ="<YOUR SUMO ORGANIZATION ID>"
# This flag determines whether to enable all monitors or not.
monitors_disabled = true
# The Sumo Logic monitors will be installed in a folder specified by this value.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@ provider "sumologic" {
resource "sumologic_monitor_folder" "tf_monitor_folder_1" {
name = var.folder
description = "Folder for Couchbase Monitors"
obj_permission {
subject_type = "org"
subject_id = var.sumologic_organization_id
permissions = ["Create", "Read", "Update", "Delete", "Manage"]
}
}
24 changes: 10 additions & 14 deletions monitor_packages/Couchbase/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ variable "environment" {
error_message = "Argument \"environment\" must be one of \"us1\",\"us2\",\"au\",\"ca\",\"de\",\"eu\",\"fed\",\"jp\",\"in\"."
}
}
variable "sumologic_organization_id" {
type = string
description = <<EOT
You can find your org on the Preferences page in the Sumo Logic UI. For more information, see the Preferences Page topic. For more details, visit https://help.sumologic.com/01Start-Here/05Customize-Your-Sumo-Logic-Experience/Preferences-Page
EOT
validation {
condition = can(regex("\\w+", var.sumologic_organization_id))
error_message = "The organization ID must contain valid characters."
}
}
variable "folder" {
type = string
description = "Folder where monitors will be created."
Expand Down Expand Up @@ -86,20 +96,6 @@ variable "email_notifications_critical" {
description = "Email Notifications to be sent by the critical alert."
}

variable "email_notifications_critical" {
type = list(object(
{
connection_type = string,
recipients = list(string),
subject = string,
time_zone = string,
message_body = string,
run_for_trigger_types = list(string)
}
))
description = "Email Notifications to be sent by the critical alert."
}

variable "email_notifications_warning" {
type = list(object(
{
Expand Down
10 changes: 6 additions & 4 deletions monitor_packages/Elasticsearch/Elasticsearch.auto.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ access_id = "<YOUR SUMO ACCESS ID>"
access_key = "<YOUR SUMO ACCESS KEY>"
# Please update with your deployment, refer: https://help.sumologic.com/APIs/General-API-Information/Sumo-Logic-Endpoints-and-Firewall-Security
environment = "<DEPLOYMENT>"
# Please replace <YOUR SUMO ORGANIZATION ID> (including brackets) with your Sumo Organization ID.
sumologic_organization_id ="<YOUR SUMO ORGANIZATION ID>"
# This flag determines whether to enable all monitors or not.
monitors_disabled = true
# The Sumo Logic monitors will be installed in a folder specified by this value.
folder = "Elasticsearch"
# Sumo Logic Elasticsearch cluster Filter. For eg: db_cluster=elasticsearch.prod.01
monitors_disabled = true
# The Sumo Logic monitors will be installed in a folder specified by this value.
folder = "Elasticsearch"
# Sumo Logic Elasticsearch cluster Filter. For eg: db_cluster=elasticsearch.prod.01
elasticsearch_data_source = ""
4 changes: 2 additions & 2 deletions monitor_packages/Elasticsearch/Elasticsearch.tf
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ module "Elasticsearch-TooManySlowQuery" {
},
{
threshold_type = "GreaterThanOrEqual",
threshold = 0,
threshold = 200,
time_range = "5m",
occurrence_type = "ResultCount"
trigger_source = "AllResults"
Expand All @@ -485,7 +485,7 @@ module "Elasticsearch-TooManySlowQuery" {
},
{
threshold_type = "LessThan",
threshold = 0,
threshold = 200,
time_range = "5m",
occurrence_type = "ResultCount"
trigger_source = "AllResults"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@ provider "sumologic" {
environment = var.environment
}

#Sumo Logic Monitor Folder
resource "sumologic_monitor_folder" "tf_monitor_folder_1" {
name = var.folder
description = "Folder for Elasticsearch Monitors"
#Sumo Logic Monitor Folder
resource "sumologic_monitor_folder" "tf_monitor_folder_1" {
name = var.folder
description = "Folder for Elasticsearch Monitors"
obj_permission {
subject_type = "org"
subject_id = var.sumologic_organization_id
permissions = ["Create", "Read", "Update", "Delete", "Manage"]
}
}
Loading