Compare commits
5 Commits
v1.0.26
...
coder-moni
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
66aa7bf80a | ||
|
|
1a101ecc10 | ||
|
|
9c049bd555 | ||
|
|
84bf63705f | ||
|
|
e4af2a9887 |
@@ -14,7 +14,7 @@ Automatically install [code-server](https://github.com/coder/code-server) in a w
|
||||
```tf
|
||||
module "code-server" {
|
||||
source = "registry.coder.com/modules/code-server/coder"
|
||||
version = "1.0.26"
|
||||
version = "1.0.18"
|
||||
agent_id = coder_agent.example.id
|
||||
}
|
||||
```
|
||||
@@ -28,7 +28,7 @@ module "code-server" {
|
||||
```tf
|
||||
module "code-server" {
|
||||
source = "registry.coder.com/modules/code-server/coder"
|
||||
version = "1.0.26"
|
||||
version = "1.0.18"
|
||||
agent_id = coder_agent.example.id
|
||||
install_version = "4.8.3"
|
||||
}
|
||||
@@ -41,7 +41,7 @@ Install the Dracula theme from [OpenVSX](https://open-vsx.org/):
|
||||
```tf
|
||||
module "code-server" {
|
||||
source = "registry.coder.com/modules/code-server/coder"
|
||||
version = "1.0.26"
|
||||
version = "1.0.18"
|
||||
agent_id = coder_agent.example.id
|
||||
extensions = [
|
||||
"dracula-theme.theme-dracula"
|
||||
@@ -58,7 +58,7 @@ Configure VS Code's [settings.json](https://code.visualstudio.com/docs/getstarte
|
||||
```tf
|
||||
module "code-server" {
|
||||
source = "registry.coder.com/modules/code-server/coder"
|
||||
version = "1.0.26"
|
||||
version = "1.0.18"
|
||||
agent_id = coder_agent.example.id
|
||||
extensions = ["dracula-theme.theme-dracula"]
|
||||
settings = {
|
||||
@@ -74,7 +74,7 @@ Just run code-server in the background, don't fetch it from GitHub:
|
||||
```tf
|
||||
module "code-server" {
|
||||
source = "registry.coder.com/modules/code-server/coder"
|
||||
version = "1.0.26"
|
||||
version = "1.0.18"
|
||||
agent_id = coder_agent.example.id
|
||||
extensions = ["dracula-theme.theme-dracula", "ms-azuretools.vscode-docker"]
|
||||
}
|
||||
@@ -89,7 +89,7 @@ Run an existing copy of code-server if found, otherwise download from GitHub:
|
||||
```tf
|
||||
module "code-server" {
|
||||
source = "registry.coder.com/modules/code-server/coder"
|
||||
version = "1.0.26"
|
||||
version = "1.0.18"
|
||||
agent_id = coder_agent.example.id
|
||||
use_cached = true
|
||||
extensions = ["dracula-theme.theme-dracula", "ms-azuretools.vscode-docker"]
|
||||
@@ -101,7 +101,7 @@ Just run code-server in the background, don't fetch it from GitHub:
|
||||
```tf
|
||||
module "code-server" {
|
||||
source = "registry.coder.com/modules/code-server/coder"
|
||||
version = "1.0.26"
|
||||
version = "1.0.18"
|
||||
agent_id = coder_agent.example.id
|
||||
offline = true
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ variable "slug" {
|
||||
}
|
||||
|
||||
variable "settings" {
|
||||
type = any
|
||||
type = map(string)
|
||||
description = "A map of settings to apply to code-server."
|
||||
default = {}
|
||||
}
|
||||
|
||||
72
monitoring/README.md
Normal file
72
monitoring/README.md
Normal file
@@ -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 = ["/"]
|
||||
}
|
||||
```
|
||||
92
monitoring/main.tf
Normal file
92
monitoring/main.tf
Normal file
@@ -0,0 +1,92 @@
|
||||
terraform {
|
||||
required_version = ">= 1.0.25"
|
||||
|
||||
required_providers {
|
||||
coder = {
|
||||
source = "coder/coder"
|
||||
version = ">= 2.0.2"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
variable "threshold" {
|
||||
type = number
|
||||
description = "The threshold for the monitoring, used for all resources unless overridden by *_threshold - expressed as a percentage."
|
||||
default = 90
|
||||
validation {
|
||||
condition = var.threshold >= 0 && var.threshold <= 100
|
||||
error_message = "The threshold must be between 0 and 100."
|
||||
}
|
||||
}
|
||||
|
||||
variable "memory_threshold" {
|
||||
type = number
|
||||
description = "The threshold for the memory monitoring - expressed as a percentage."
|
||||
default = 90
|
||||
validation {
|
||||
condition = var.memory_threshold >= 0 && var.memory_threshold <= 100
|
||||
error_message = "The memory_threshold must be between 0 and 100."
|
||||
}
|
||||
}
|
||||
|
||||
variable "disk_threshold" {
|
||||
type = number
|
||||
description = "The threshold for the disk monitoring - expressed as a percentage."
|
||||
default = 90
|
||||
validation {
|
||||
condition = var.disk_threshold >= 0 && var.disk_threshold <= 100
|
||||
error_message = "The disk_threshold must be between 0 and 100."
|
||||
}
|
||||
}
|
||||
|
||||
variable "disks" {
|
||||
type = list(string)
|
||||
description = "The disks to monitor. e.g. ['/', '/home']"
|
||||
default = ["/"]
|
||||
}
|
||||
|
||||
variable "enabled" {
|
||||
type = bool
|
||||
description = "Whether the monitoring is enabled."
|
||||
default = true
|
||||
validation {
|
||||
condition = var.enabled == true || var.enabled == false
|
||||
error_message = "The enabled must be true or false."
|
||||
}
|
||||
}
|
||||
|
||||
variable "memory_enabled" {
|
||||
type = bool
|
||||
description = "Whether the memory monitoring is enabled."
|
||||
default = true
|
||||
validation {
|
||||
condition = var.memory_enabled == true || var.memory_enabled == false
|
||||
error_message = "The memory_enabled must be true or false."
|
||||
}
|
||||
}
|
||||
|
||||
variable "disk_enabled" {
|
||||
type = bool
|
||||
description = "Whether the disk monitoring is enabled."
|
||||
default = true
|
||||
validation {
|
||||
condition = var.disk_enabled == true || var.disk_enabled == false
|
||||
error_message = "The disk_enabled must be true or false."
|
||||
}
|
||||
}
|
||||
|
||||
variable "agent_id" {
|
||||
type = string
|
||||
description = "The ID of the agent to monitor."
|
||||
}
|
||||
|
||||
data "coder_monitoring" "monitoring" {
|
||||
threshold = var.threshold
|
||||
memory_threshold = var.memory_threshold
|
||||
disk_threshold = var.disk_threshold
|
||||
disks = var.disks
|
||||
enabled = var.enabled
|
||||
memory_enabled = var.memory_enabled
|
||||
disk_enabled = var.disk_enabled
|
||||
agent_id = var.agent_id
|
||||
}
|
||||
@@ -14,7 +14,7 @@ Automatically install [Visual Studio Code Server](https://code.visualstudio.com/
|
||||
```tf
|
||||
module "vscode-web" {
|
||||
source = "registry.coder.com/modules/vscode-web/coder"
|
||||
version = "1.0.26"
|
||||
version = "1.0.22"
|
||||
agent_id = coder_agent.example.id
|
||||
accept_license = true
|
||||
}
|
||||
@@ -29,7 +29,7 @@ module "vscode-web" {
|
||||
```tf
|
||||
module "vscode-web" {
|
||||
source = "registry.coder.com/modules/vscode-web/coder"
|
||||
version = "1.0.26"
|
||||
version = "1.0.22"
|
||||
agent_id = coder_agent.example.id
|
||||
install_prefix = "/home/coder/.vscode-web"
|
||||
folder = "/home/coder"
|
||||
@@ -42,7 +42,7 @@ module "vscode-web" {
|
||||
```tf
|
||||
module "vscode-web" {
|
||||
source = "registry.coder.com/modules/vscode-web/coder"
|
||||
version = "1.0.26"
|
||||
version = "1.0.22"
|
||||
agent_id = coder_agent.example.id
|
||||
extensions = ["github.copilot", "ms-python.python", "ms-toolsai.jupyter"]
|
||||
accept_license = true
|
||||
@@ -56,7 +56,7 @@ Configure VS Code's [settings.json](https://code.visualstudio.com/docs/getstarte
|
||||
```tf
|
||||
module "vscode-web" {
|
||||
source = "registry.coder.com/modules/vscode-web/coder"
|
||||
version = "1.0.26"
|
||||
version = "1.0.22"
|
||||
agent_id = coder_agent.example.id
|
||||
extensions = ["dracula-theme.theme-dracula"]
|
||||
settings = {
|
||||
|
||||
@@ -92,7 +92,7 @@ variable "order" {
|
||||
}
|
||||
|
||||
variable "settings" {
|
||||
type = any
|
||||
type = map(string)
|
||||
description = "A map of settings to apply to VS Code web."
|
||||
default = {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user