-
Notifications
You must be signed in to change notification settings - Fork 62
coder_monitoring module #362
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| --- | ||
| display_name: Monitoring | ||
| description: Monitoring of workspace resources | ||
| maintainer_github: coder | ||
| verified: true | ||
| tags: [monitoring] | ||
| --- | ||
|
|
||
| # Monitoring | ||
|
|
||
| This module adds monitoring of workspace resources. | ||
|
|
||
| ```tf | ||
| module "monitoring" { | ||
| source = "registry.coder.com/modules/monitoring/coder" | ||
| version = "1.0.0" | ||
| agent_id = coder_agent.dev.id | ||
| } | ||
| ``` | ||
|
|
||
| ## Examples | ||
|
|
||
| ```tf | ||
| module "monitoring" { | ||
| source = "registry.coder.com/modules/monitoring/coder" | ||
| version = "1.0.0" | ||
| agent_id = coder_agent.dev.id | ||
| } | ||
| ``` | ||
|
|
||
| ### Enable/Disable | ||
|
|
||
| You can customize the monitoring by setting the `enabled`, `memory_enabled`, and `disk_enabled` variables. | ||
|
|
||
| ```tf | ||
| module "monitoring" { | ||
| source = "registry.coder.com/modules/monitoring/coder" | ||
| version = "1.0.0" | ||
| agent_id = coder_agent.dev.id | ||
| enabled = false | ||
| memory_enabled = true | ||
| disk_enabled = false | ||
| } | ||
| ``` | ||
|
|
||
| ### Customize Thresholds | ||
|
|
||
| You can customize the thresholds by setting the `threshold`, `memory_threshold`, and `disk_threshold` variables. | ||
|
|
||
| ```tf | ||
| module "monitoring" { | ||
| source = "registry.coder.com/modules/monitoring/coder" | ||
| version = "1.0.0" | ||
| agent_id = coder_agent.dev.id | ||
| threshold = 90 | ||
| memory_threshold = 95 | ||
| disk_threshold = 90 | ||
| } | ||
| ``` | ||
|
|
||
| ### Customize Disks | ||
|
|
||
| You can customize the disks by setting the `disks` variable. | ||
|
|
||
| ```tf | ||
| module "monitoring" { | ||
| source = "registry.coder.com/modules/monitoring/coder" | ||
| version = "1.0.0" | ||
| agent_id = coder_agent.dev.id | ||
| disks = ["/"] | ||
| } | ||
| ``` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| terraform { | ||
| required_version = ">= 1.0" | ||
|
|
||
| required_providers { | ||
| coder = { | ||
| source = "coder/coder" | ||
| version = ">= 0.11" | ||
|
||
| } | ||
| } | ||
| } | ||
|
|
||
| variable "description" { | ||
| default = "Monitoring of workspace resources" | ||
| description = "Monitoring of workspace resources" | ||
| } | ||
|
|
||
| variable "threshold" { | ||
| type = number | ||
| description = "The threshold for the monitoring, used for all resources unless overridden by *_threshold." | ||
| default = 90 | ||
| } | ||
|
|
||
| variable "memory_threshold" { | ||
| type = number | ||
| description = "The threshold for the memory monitoring." | ||
| default = 90 | ||
defelmnq marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| variable "disk_threshold" { | ||
| type = number | ||
| description = "The threshold for the disk monitoring." | ||
defelmnq marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| default = 90 | ||
| } | ||
|
|
||
| variable "disks" { | ||
| type = list(string) | ||
| description = "The disks to monitor." | ||
defelmnq marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| default = ["/"] | ||
| } | ||
|
|
||
| variable "enabled" { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we have a variable for this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I imagined we can use this enabled parameter to let users keep the block but just change the enabled variable if they want, for some specific cases, disable it quickly without loosing their configuration, does it make sense ? Otherwise I can delete it and indeed rely on the terraform count (I need to read about it.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's the same purpose the |
||
| type = bool | ||
| description = "Whether the monitoring is enabled." | ||
| default = true | ||
| } | ||
|
|
||
| variable "memory_enabled" { | ||
| type = bool | ||
| description = "Whether the memory monitoring is enabled." | ||
| default = false | ||
defelmnq marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| variable "disk_enabled" { | ||
| type = bool | ||
| description = "Whether the disk monitoring is enabled." | ||
| default = true | ||
| } | ||
|
|
||
| variable "agent_id" { | ||
| type = string | ||
| description = "The ID of the agent to monitor." | ||
| } | ||
|
|
||
| data "coder_monitoring" "monitoring" { | ||
| name = "monitoring" | ||
| description = var.description | ||
| threshold = var.threshold | ||
| memory_threshold = var.memory_threshold | ||
| disk_threshold = var.disk_threshold | ||
| disks = var.disks | ||
| enabled = var.enabled | ||
defelmnq marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| memory_enabled = var.memory_enabled | ||
| disk_enabled = var.disk_enabled | ||
| agent_id = var.agent_id | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The versioning of modules right now follows the whole repo I believe, so it'd be
v1.0.25.