11<!-- BEGIN_TF_DOCS -->
22# monitor
33
4- This module manages the hashicorp/azurerm monitor resources.
5- For more information see https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs > monitor
4+ This module manages the azurerm monitor resources, see https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs .
5+
6+ For more information about the module structure see https://telekom-mms.github.io/terraform-template .
67
78_ <-- This file is autogenerated, please do not change. -->_
89
910## Requirements
1011
1112| Name | Version |
1213| ------| ---------|
13- | terraform | >=1.5 |
14- | azurerm | >=4.0, <5.0 |
14+ | terraform | >= 1.5 |
15+ | azurerm | >= 4.0, < 5.0 |
1516
1617## Providers
1718
1819| Name | Version |
1920| ------| ---------|
20- | azurerm | >=4.0, <5.0 |
21+ | azurerm | >= 4.0, < 5.0 |
2122
2223## Resources
2324
2425| Name | Type |
2526| ------| ------|
26- | azurerm_monitor_action_group.monitor_action_group | resource |
27- | azurerm_monitor_activity_log_alert.monitor_activity_log_alert | resource |
28- | azurerm_monitor_diagnostic_setting.monitor_diagnostic_setting | resource |
29- | azurerm_monitor_scheduled_query_rules_alert.monitor_scheduled_query_rules_alert | resource |
27+ | [ azurerm_monitor_action_group.monitor_action_group] ( https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_action_group ) | resource |
28+ | [ azurerm_monitor_activity_log_alert.monitor_activity_log_alert] ( https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_activity_log_alert ) | resource |
29+ | [ azurerm_monitor_diagnostic_setting.monitor_diagnostic_setting] ( https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_diagnostic_setting ) | resource |
30+ | [ azurerm_monitor_scheduled_query_rules_alert.monitor_scheduled_query_rules_alert] ( https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_scheduled_query_rules_alert ) | resource |
3031
3132## Inputs
3233
@@ -52,13 +53,70 @@ _<-- This file is autogenerated, please do not change. -->_
5253Minimal configuration to install the desired resources with the module
5354
5455``` hcl
56+ data "azurerm_subscription" "current" {}
57+
58+ module "key_vault" {
59+ source = "registry.terraform.io/telekom-mms/key-vault/azurerm"
60+ key_vault = {
61+ kv-mms-github = {
62+ resource_group_name = "rg-mms-github"
63+ location = "westeurope"
64+ tenant_id = data.azurerm_subscription.current.tenant_id
65+ sku_name = "standard"
66+ }
67+ }
68+ }
69+
70+ module "log_analytics_workspace" {
71+ source = "registry.terraform.io/telekom-mms/log-analytics-workspace/azurerm"
72+ log_analytics_workspace = {
73+ law-mms-github = {
74+ resource_group_name = "rg-mms-github"
75+ location = "westeurope"
76+ }
77+ }
78+ }
79+
5580module "monitor" {
5681 source = "registry.terraform.io/telekom-mms/monitor/azurerm"
5782
5883 monitor_action_group = {
59- example = {
84+ ag-mms-github = {
85+ resource_group_name = "rg-mms-github"
86+ short_name = "agmmsgithub"
87+ }
88+ }
89+
90+ monitor_diagnostic_setting = {
91+ diag-mms-github = {
92+ target_resource_id = module.key_vault.key_vault["kv-mms-github"].id
93+ }
94+ }
95+
96+ monitor_activity_log_alert = {
97+ ala-mms-github = {
6098 resource_group_name = "rg-mms-github"
61- short_name = "example"
99+ location = "westeurope"
100+ scopes = [data.azurerm_subscription.current.id]
101+ criteria = {
102+ category = "Recommendation"
103+ }
104+ }
105+ }
106+
107+ monitor_scheduled_query_rules_alert = {
108+ sqra-mms-github = {
109+ resource_group_name = "rg-mms-github"
110+ location = "westeurope"
111+ data_source_id = module.log_analytics_workspace.log_analytics_workspace["law-mms-github"].id
112+ query = "Perf | where ObjectName == \"Processor\" and CounterName == \"% Processor Time\" | summarize AggregatedValue = avg(CounterValue) by bin(TimeGenerated, 5m), Computer"
113+ trigger = {
114+ operator = "GreaterThan"
115+ threshold = 3
116+ }
117+ action = {
118+ action_group = []
119+ }
62120 }
63121 }
64122}
@@ -67,13 +125,38 @@ module "monitor" {
67125Advanced configuration to install the desired resources with the module
68126
69127``` hcl
128+ data "azurerm_subscription" "current" {}
129+
130+ module "key_vault" {
131+ source = "registry.terraform.io/telekom-mms/key-vault/azurerm"
132+ key_vault = {
133+ kv-mms-github = {
134+ resource_group_name = "rg-mms-github"
135+ location = "westeurope"
136+ tenant_id = data.azurerm_subscription.current.tenant_id
137+ sku_name = "standard"
138+ }
139+ }
140+ }
141+
142+ module "log_analytics_workspace" {
143+ source = "registry.terraform.io/telekom-mms/log-analytics-workspace/azurerm"
144+ log_analytics_workspace = {
145+ law-mms-github = {
146+ resource_group_name = "rg-mms-github"
147+ location = "westeurope"
148+ }
149+ }
150+ }
151+
152+
70153module "monitor" {
71154 source = "registry.terraform.io/telekom-mms/monitor/azurerm"
72155
73156 monitor_action_group = {
74- example-full = {
157+ ag-mms-github = {
75158 resource_group_name = "rg-mms-github"
76- short_name = "example-full "
159+ short_name = "agmmsgithub "
77160 enabled = true
78161 email_receiver = {
79162 sendtoadmin = {
@@ -89,6 +172,79 @@ module "monitor" {
89172 }
90173 }
91174 }
175+
176+ monitor_diagnostic_setting = {
177+ diag-mms-github = {
178+ target_resource_id = module.key_vault.key_vault["kv-mms-github"].id
179+ log_analytics_workspace_id = module.log_analytics_workspace.log_analytics_workspace["law-mms-github"].id
180+ enabled_log = {
181+ category = "AuditEvent"
182+ }
183+ enabled_metric = {
184+ category = "AllMetrics"
185+ }
186+ }
187+ }
188+
189+ monitor_activity_log_alert = {
190+ ala-mms-github = {
191+ resource_group_name = "rg-mms-github"
192+ location = "westeurope"
193+ scopes = [data.azurerm_subscription.current.id]
194+ description = "Alert for Service Health Recommendations"
195+ enabled = true
196+ criteria = {
197+ category = "Recommendation"
198+ level = "Informational"
199+ }
200+ action = {
201+ webhook_properties = {
202+ from = "terraform"
203+ }
204+ }
205+ tags = {
206+ project = "mms-github"
207+ environment = "dev"
208+ managed-by = "terraform"
209+ }
210+ }
211+ }
212+
213+ monitor_scheduled_query_rules_alert = {
214+ sqra-mms-github = {
215+ resource_group_name = "rg-mms-github"
216+ location = "westeurope"
217+ data_source_id = module.log_analytics_workspace.log_analytics_workspace["law-mms-github"].id
218+ query = "Perf | where ObjectName == \"Processor\" and CounterName == \"% Processor Time\" | summarize AggregatedValue = avg(CounterValue) by bin(TimeGenerated, 5m), Computer"
219+ description = "Alert for High CPU Usage"
220+ enabled = true
221+ severity = 2
222+ throttling = 5
223+ frequency = 5
224+ time_window = 5
225+ auto_mitigation_enabled = true
226+ trigger = {
227+ operator = "GreaterThan"
228+ threshold = 80
229+ metric_trigger = {
230+ metric_column = "Computer"
231+ metric_trigger_type = "Consecutive"
232+ operator = "GreaterThan"
233+ threshold = 1
234+ }
235+ }
236+ action = {
237+ action_group = []
238+ email_subject = "High CPU Alert"
239+ custom_webhook_payload = "{ \"alert\": \"#alertrulename\", \"metric\": \"#metricvalue\" }"
240+ }
241+ tags = {
242+ project = "mms-github"
243+ environment = "dev"
244+ managed-by = "terraform"
245+ }
246+ }
247+ }
92248}
93249```
94250<!-- END_TF_DOCS -->
0 commit comments