-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathREADME.yaml
178 lines (159 loc) · 5.44 KB
/
README.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
---
#
# This is the canonical configuration for the `README.md`
# Run `make readme` to rebuild the `README.md`
#
# Name of this project
name: Terraform AWS Cloudwatch Alarms
# License of this project
license: "APACHE"
# Canonical GitHub repo
github_repo: clouddrove/terraform-aws-cloudwatch-alarms
# Badges to display
badges:
- name: "Latest Release"
image: "https://img.shields.io/github/release/clouddrove/terraform-aws-cloudwatch-alarms.svg"
url: "https://github.com/clouddrove/terraform-aws-cloudwatch-alarms/releases/latest"
- name: "tfsec"
image: "https://github.com/clouddrove/terraform-aws-cloudwatch-alarms/actions/workflows/tfsec.yml/badge.svg"
url: "https://github.com/clouddrove/terraform-aws-cloudwatch-alarms/actions/workflows/tfsec.yml"
- name: "Licence"
image: "https://img.shields.io/badge/License-APACHE-blue.svg"
url: "LICENSE.md"
- name: "Changelog"
image: "https://img.shields.io/badge/Changelog-blue"
url: "CHANGELOG.md"
prerequesties:
- name: Terraform
url: https://learn.hashicorp.com/terraform/getting-started/install.html
version: ">= 1.6.6"
providers:
- name: aws
url: https://aws.amazon.com/
version: ">= 5.29.0"
module_dependencies:
- name: Labels Module
url: https://github.com/clouddrove/terraform-aws-labels
description: Provides resource tagging.
# description of this project
description: |-
Terraform module creates Cloudwatch Alarm on AWS for monitoriing AWS services.
# How to use this project
# yamllint disable rule:line-length
usage: |-
Here are some examples of how you can use this module in your inventory structure:
### Basic Example
```hcl
module "alarm" {
source = "clouddrove/cloudwatch-alarms/aws"
version = "2.0.0"
name = "alarm"
environment = "test"
label_order = ["name", "environment"]
alarm_name = "cpu-alarm"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = 2
metric_name = "CPUUtilization"
namespace = "AWS/EC2"
period = 60
statistic = "Average"
threshold = 40
alarm_description = "This metric monitors ec2 cpu utilization"
alarm_actions = []
actions_enabled = true
insufficient_data_actions = []
ok_actions = []
treat_missing_data = "ignore"
datapoints_to_alarm = 2
dimensions = {
instance_id = module.ec2.instance_id[0]
}
}
```
### Anomaly Example
```hcl
module "alarm" {
source = "clouddrove/cloudwatch-alarms/aws"
version = "2.0.0"
name = "alarm"
environment = "test"
label_order = ["name", "environment"]
alarm_name = "cpu-alarm"
comparison_operator = "GreaterThanUpperThreshold"
evaluation_periods = 2
threshold_metric_id = "e1"
query_expressions = [{
id = "e1"
expression = "ANOMALY_DETECTION_BAND(m1)"
label = "CPUUtilization (Expected)"
return_data = "true"
}]
query_metrics = [{
id = "m1"
return_data = "true"
metric_name = "CPUUtilization"
namespace = "AWS/EC2"
period = "120"
stat = "Average"
unit = "Count"
dimensions = {
InstanceId = module.ec2.instance_id[0]
}
}]
alarm_description = "This metric monitors ec2 cpu utilization"
alarm_actions = []
actions_enabled = true
insufficient_data_actions = []
ok_actions = []
}
```
### Epression Example
```hcl
module "alarm" {
source = "clouddrove/cloudwatch-alarms/aws"
version = "2.0.0"
name = "alarm"
environment = "test"
label_order = ["name", "environment"]
expression_enabled = true
alarm_name = "cpu-alarm"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = 2
threshold = 40
query_expressions = [{
id = "e1"
expression = "m2/m1*100"
label = "Error Rate"
return_data = "true"
}]
query_metrics = [
{
id = "m1"
metric_name = "RequestCount"
namespace = "AWS/ApplicationELB"
period = "120"
stat = "Sum"
unit = "Count"
return_data = null
dimensions = {
LoadBalancer = "app/web"
}
}, {
id = "m2"
metric_name = "HTTPCode_ELB_5XX_Count"
namespace = "AWS/ApplicationELB"
period = "120"
stat = "Sum"
unit = "Count"
return_data = null
dimensions = {
LoadBalancer = "app/web"
}
}]
alarm_description = "This metric monitors ec2 cpu utilization"
alarm_actions = []
actions_enabled = true
insufficient_data_actions = []
ok_actions = []
}
```