From 1d9f508bf40227464bad468f1d673433f62e43df Mon Sep 17 00:00:00 2001 From: viktoryathegreat Date: Fri, 22 Nov 2024 11:19:59 +0400 Subject: [PATCH] feat(DMVP-6116): Implemented redis block --- modules/dashboard/README.md | 18 ++ modules/dashboard/locals.tf | 20 ++ .../dashboard/modules/blocks/redis/README.md | 34 +++ .../dashboard/modules/blocks/redis/output.tf | 36 +++ .../modules/blocks/redis/variables.tf | 21 ++ .../dashboard/modules/widgets/base/README.md | 2 + .../dashboard/modules/widgets/base/main.tf | 2 + .../widgets/base/platforms/grafana/README.md | 2 + .../base/platforms/grafana/variables.tf | 30 +++ .../widgets/base/platforms/grafana/widget.tf | 19 +- .../modules/widgets/base/variables.tf | 30 +++ .../modules/widgets/pod/restarts/README.md | 42 ++++ .../modules/widgets/pod/restarts/base.tf | 24 ++ .../modules/widgets/pod/restarts/output.tf | 3 + .../modules/widgets/pod/restarts/variables.tf | 58 +++++ .../modules/widgets/redis/clients/README.md | 42 ++++ .../modules/widgets/redis/clients/base.tf | 17 ++ .../modules/widgets/redis/clients/output.tf | 3 + .../widgets/redis/clients/variables.tf | 59 +++++ .../widgets/redis/connections/README.md | 42 ++++ .../modules/widgets/redis/connections/base.tf | 16 ++ .../widgets/redis/connections/output.tf | 3 + .../widgets/redis/connections/variables.tf | 59 +++++ .../modules/widgets/redis/cpu/README.md | 42 ++++ .../modules/widgets/redis/cpu/base.tf | 16 ++ .../modules/widgets/redis/cpu/output.tf | 3 + .../modules/widgets/redis/cpu/variables.tf | 59 +++++ .../modules/widgets/redis/errors/README.md | 42 ++++ .../modules/widgets/redis/errors/base.tf | 16 ++ .../modules/widgets/redis/errors/output.tf | 3 + .../modules/widgets/redis/errors/variables.tf | 59 +++++ .../redis/expired-evicted-keys/README.md | 42 ++++ .../redis/expired-evicted-keys/base.tf | 16 ++ .../redis/expired-evicted-keys/output.tf | 3 + .../redis/expired-evicted-keys/variables.tf | 59 +++++ .../redis/expiring-notexpiring-keys/README.md | 42 ++++ .../redis/expiring-notexpiring-keys/base.tf | 16 ++ .../redis/expiring-notexpiring-keys/output.tf | 3 + .../expiring-notexpiring-keys/variables.tf | 59 +++++ .../widgets/redis/hits-misses/README.md | 42 ++++ .../modules/widgets/redis/hits-misses/base.tf | 16 ++ .../widgets/redis/hits-misses/output.tf | 3 + .../widgets/redis/hits-misses/variables.tf | 59 +++++ .../modules/widgets/redis/keys/README.md | 42 ++++ .../modules/widgets/redis/keys/base.tf | 15 ++ .../modules/widgets/redis/keys/output.tf | 3 + .../modules/widgets/redis/keys/variables.tf | 59 +++++ .../modules/widgets/redis/latency/README.md | 42 ++++ .../modules/widgets/redis/latency/base.tf | 16 ++ .../modules/widgets/redis/latency/output.tf | 3 + .../widgets/redis/latency/variables.tf | 59 +++++ .../widgets/redis/max-uptime/README.md | 42 ++++ .../modules/widgets/redis/max-uptime/base.tf | 18 ++ .../widgets/redis/max-uptime/output.tf | 3 + .../widgets/redis/max-uptime/variables.tf | 59 +++++ .../modules/widgets/redis/memory/README.md | 42 ++++ .../modules/widgets/redis/memory/base.tf | 37 +++ .../modules/widgets/redis/memory/output.tf | 3 + .../modules/widgets/redis/memory/variables.tf | 59 +++++ .../modules/widgets/redis/network/README.md | 42 ++++ .../modules/widgets/redis/network/base.tf | 16 ++ .../modules/widgets/redis/network/output.tf | 3 + .../widgets/redis/network/variables.tf | 59 +++++ .../modules/widgets/redis/replicas/README.md | 42 ++++ .../modules/widgets/redis/replicas/base.tf | 15 ++ .../modules/widgets/redis/replicas/output.tf | 3 + .../widgets/redis/replicas/variables.tf | 59 +++++ .../modules/widgets/redis/restarts/README.md | 43 ++++ .../modules/widgets/redis/restarts/base.tf | 24 ++ .../modules/widgets/redis/restarts/output.tf | 3 + .../widgets/redis/restarts/variables.tf | 63 +++++ .../widgets/redis/total-commands/README.md | 42 ++++ .../widgets/redis/total-commands/base.tf | 15 ++ .../widgets/redis/total-commands/output.tf | 3 + .../widgets/redis/total-commands/variables.tf | 59 +++++ .../widgets/redis/total-memory/README.md | 42 ++++ .../widgets/redis/total-memory/base.tf | 18 ++ .../widgets/redis/total-memory/output.tf | 3 + .../widgets/redis/total-memory/variables.tf | 59 +++++ modules/dashboard/widgets-pod.tf | 20 ++ modules/dashboard/widgets-redis.tf | 224 ++++++++++++++++++ modules/dashboard/widgets_blocks.tf | 11 + 82 files changed, 2540 insertions(+), 12 deletions(-) create mode 100644 modules/dashboard/modules/blocks/redis/README.md create mode 100644 modules/dashboard/modules/blocks/redis/output.tf create mode 100644 modules/dashboard/modules/blocks/redis/variables.tf create mode 100644 modules/dashboard/modules/widgets/pod/restarts/README.md create mode 100644 modules/dashboard/modules/widgets/pod/restarts/base.tf create mode 100644 modules/dashboard/modules/widgets/pod/restarts/output.tf create mode 100644 modules/dashboard/modules/widgets/pod/restarts/variables.tf create mode 100644 modules/dashboard/modules/widgets/redis/clients/README.md create mode 100644 modules/dashboard/modules/widgets/redis/clients/base.tf create mode 100644 modules/dashboard/modules/widgets/redis/clients/output.tf create mode 100644 modules/dashboard/modules/widgets/redis/clients/variables.tf create mode 100644 modules/dashboard/modules/widgets/redis/connections/README.md create mode 100644 modules/dashboard/modules/widgets/redis/connections/base.tf create mode 100644 modules/dashboard/modules/widgets/redis/connections/output.tf create mode 100644 modules/dashboard/modules/widgets/redis/connections/variables.tf create mode 100644 modules/dashboard/modules/widgets/redis/cpu/README.md create mode 100644 modules/dashboard/modules/widgets/redis/cpu/base.tf create mode 100644 modules/dashboard/modules/widgets/redis/cpu/output.tf create mode 100644 modules/dashboard/modules/widgets/redis/cpu/variables.tf create mode 100644 modules/dashboard/modules/widgets/redis/errors/README.md create mode 100644 modules/dashboard/modules/widgets/redis/errors/base.tf create mode 100644 modules/dashboard/modules/widgets/redis/errors/output.tf create mode 100644 modules/dashboard/modules/widgets/redis/errors/variables.tf create mode 100644 modules/dashboard/modules/widgets/redis/expired-evicted-keys/README.md create mode 100644 modules/dashboard/modules/widgets/redis/expired-evicted-keys/base.tf create mode 100644 modules/dashboard/modules/widgets/redis/expired-evicted-keys/output.tf create mode 100644 modules/dashboard/modules/widgets/redis/expired-evicted-keys/variables.tf create mode 100644 modules/dashboard/modules/widgets/redis/expiring-notexpiring-keys/README.md create mode 100644 modules/dashboard/modules/widgets/redis/expiring-notexpiring-keys/base.tf create mode 100644 modules/dashboard/modules/widgets/redis/expiring-notexpiring-keys/output.tf create mode 100644 modules/dashboard/modules/widgets/redis/expiring-notexpiring-keys/variables.tf create mode 100644 modules/dashboard/modules/widgets/redis/hits-misses/README.md create mode 100644 modules/dashboard/modules/widgets/redis/hits-misses/base.tf create mode 100644 modules/dashboard/modules/widgets/redis/hits-misses/output.tf create mode 100644 modules/dashboard/modules/widgets/redis/hits-misses/variables.tf create mode 100644 modules/dashboard/modules/widgets/redis/keys/README.md create mode 100644 modules/dashboard/modules/widgets/redis/keys/base.tf create mode 100644 modules/dashboard/modules/widgets/redis/keys/output.tf create mode 100644 modules/dashboard/modules/widgets/redis/keys/variables.tf create mode 100644 modules/dashboard/modules/widgets/redis/latency/README.md create mode 100644 modules/dashboard/modules/widgets/redis/latency/base.tf create mode 100644 modules/dashboard/modules/widgets/redis/latency/output.tf create mode 100644 modules/dashboard/modules/widgets/redis/latency/variables.tf create mode 100644 modules/dashboard/modules/widgets/redis/max-uptime/README.md create mode 100644 modules/dashboard/modules/widgets/redis/max-uptime/base.tf create mode 100644 modules/dashboard/modules/widgets/redis/max-uptime/output.tf create mode 100644 modules/dashboard/modules/widgets/redis/max-uptime/variables.tf create mode 100644 modules/dashboard/modules/widgets/redis/memory/README.md create mode 100644 modules/dashboard/modules/widgets/redis/memory/base.tf create mode 100644 modules/dashboard/modules/widgets/redis/memory/output.tf create mode 100644 modules/dashboard/modules/widgets/redis/memory/variables.tf create mode 100644 modules/dashboard/modules/widgets/redis/network/README.md create mode 100644 modules/dashboard/modules/widgets/redis/network/base.tf create mode 100644 modules/dashboard/modules/widgets/redis/network/output.tf create mode 100644 modules/dashboard/modules/widgets/redis/network/variables.tf create mode 100644 modules/dashboard/modules/widgets/redis/replicas/README.md create mode 100644 modules/dashboard/modules/widgets/redis/replicas/base.tf create mode 100644 modules/dashboard/modules/widgets/redis/replicas/output.tf create mode 100644 modules/dashboard/modules/widgets/redis/replicas/variables.tf create mode 100644 modules/dashboard/modules/widgets/redis/restarts/README.md create mode 100644 modules/dashboard/modules/widgets/redis/restarts/base.tf create mode 100644 modules/dashboard/modules/widgets/redis/restarts/output.tf create mode 100644 modules/dashboard/modules/widgets/redis/restarts/variables.tf create mode 100644 modules/dashboard/modules/widgets/redis/total-commands/README.md create mode 100644 modules/dashboard/modules/widgets/redis/total-commands/base.tf create mode 100644 modules/dashboard/modules/widgets/redis/total-commands/output.tf create mode 100644 modules/dashboard/modules/widgets/redis/total-commands/variables.tf create mode 100644 modules/dashboard/modules/widgets/redis/total-memory/README.md create mode 100644 modules/dashboard/modules/widgets/redis/total-memory/base.tf create mode 100644 modules/dashboard/modules/widgets/redis/total-memory/output.tf create mode 100644 modules/dashboard/modules/widgets/redis/total-memory/variables.tf create mode 100644 modules/dashboard/widgets-redis.tf diff --git a/modules/dashboard/README.md b/modules/dashboard/README.md index c0ef7d8..90cf28e 100644 --- a/modules/dashboard/README.md +++ b/modules/dashboard/README.md @@ -73,6 +73,7 @@ module "this" { | Name | Source | Version | |------|--------|---------| | [block\_ingress](#module\_block\_ingress) | ./modules/blocks/ingress | n/a | +| [block\_redis](#module\_block\_redis) | ./modules/blocks/redis | n/a | | [block\_service](#module\_block\_service) | ./modules/blocks/service | n/a | | [block\_sla](#module\_block\_sla) | ./modules/blocks/sla | n/a | | [container\_cpu\_widget](#module\_container\_cpu\_widget) | ./modules/widgets/container/cpu | n/a | @@ -94,6 +95,23 @@ module "this" { | [logs\_error\_rate\_widget](#module\_logs\_error\_rate\_widget) | ./modules/widgets/logs/error-rate | n/a | | [logs\_warning\_rate\_widget](#module\_logs\_warning\_rate\_widget) | ./modules/widgets/logs/warning-rate | n/a | | [pod\_cpu\_widget](#module\_pod\_cpu\_widget) | ./modules/widgets/pod/cpu | n/a | +| [pod\_restarts\_widget](#module\_pod\_restarts\_widget) | ./modules/widgets/pod/restarts | n/a | +| [redis\_clients\_widget](#module\_redis\_clients\_widget) | ./modules/widgets/redis/clients | n/a | +| [redis\_connections\_widget](#module\_redis\_connections\_widget) | ./modules/widgets/redis/connections | n/a | +| [redis\_cpu\_widget](#module\_redis\_cpu\_widget) | ./modules/widgets/redis/cpu | n/a | +| [redis\_errors\_widget](#module\_redis\_errors\_widget) | ./modules/widgets/redis/errors | n/a | +| [redis\_expired\_evicted\_keys\_widget](#module\_redis\_expired\_evicted\_keys\_widget) | ./modules/widgets/redis/expired-evicted-keys | n/a | +| [redis\_expiring\_notexpiring\_keys\_widget](#module\_redis\_expiring\_notexpiring\_keys\_widget) | ./modules/widgets/redis/expiring-notexpiring-keys | n/a | +| [redis\_hits\_misses\_widget](#module\_redis\_hits\_misses\_widget) | ./modules/widgets/redis/hits-misses | n/a | +| [redis\_keys\_widget](#module\_redis\_keys\_widget) | ./modules/widgets/redis/keys | n/a | +| [redis\_latency\_widget](#module\_redis\_latency\_widget) | ./modules/widgets/redis/latency | n/a | +| [redis\_max\_uptime\_widget](#module\_redis\_max\_uptime\_widget) | ./modules/widgets/redis/max-uptime | n/a | +| [redis\_memory\_widget](#module\_redis\_memory\_widget) | ./modules/widgets/redis/memory | n/a | +| [redis\_network\_widget](#module\_redis\_network\_widget) | ./modules/widgets/redis/network | n/a | +| [redis\_replicas\_widget](#module\_redis\_replicas\_widget) | ./modules/widgets/redis/replicas | n/a | +| [redis\_restarts\_widget](#module\_redis\_restarts\_widget) | ./modules/widgets/redis/restarts | n/a | +| [redis\_total\_commands\_widget](#module\_redis\_total\_commands\_widget) | ./modules/widgets/redis/total-commands | n/a | +| [redis\_total\_memory\_widget](#module\_redis\_total\_memory\_widget) | ./modules/widgets/redis/total-memory | n/a | | [text\_title](#module\_text\_title) | ./modules/widgets/text/title | n/a | | [text\_title\_with\_collapse](#module\_text\_title\_with\_collapse) | ./modules/widgets/text/title-with-collapse | n/a | | [text\_title\_with\_link](#module\_text\_title\_with\_link) | ./modules/widgets/text/title-with-link | n/a | diff --git a/modules/dashboard/locals.tf b/modules/dashboard/locals.tf index 0ca36d8..427f567 100644 --- a/modules/dashboard/locals.tf +++ b/modules/dashboard/locals.tf @@ -31,6 +31,7 @@ locals { ingress = values(module.block_ingress).*.result service = values(module.block_service).*.result sla = values(module.block_sla).*.result + redis = values(module.block_redis).*.result } blocks_by_type_results = concat([], [ @@ -117,6 +118,7 @@ locals { # Pod widgets values(module.pod_cpu_widget).*.data, + values(module.pod_restarts_widget).*.data, # Ingress widgets values(module.ingress_connections_widget).*.data, @@ -142,5 +144,23 @@ locals { values(module.logs_count_widget).*.data, values(module.logs_error_rate_widget).*.data, values(module.logs_warning_rate_widget).*.data, + + # Redis widgets + values(module.redis_max_uptime_widget).*.data, + values(module.redis_memory_widget).*.data, + values(module.redis_total_memory_widget).*.data, + values(module.redis_cpu_widget).*.data, + values(module.redis_hits_misses_widget).*.data, + values(module.redis_restarts_widget).*.data, + values(module.redis_errors_widget).*.data, + values(module.redis_clients_widget).*.data, + values(module.redis_connections_widget).*.data, + values(module.redis_latency_widget).*.data, + values(module.redis_network_widget).*.data, + values(module.redis_replicas_widget).*.data, + values(module.redis_total_commands_widget).*.data, + values(module.redis_keys_widget).*.data, + values(module.redis_expired_evicted_keys_widget).*.data, + values(module.redis_expiring_notexpiring_keys_widget).*.data, ) } diff --git a/modules/dashboard/modules/blocks/redis/README.md b/modules/dashboard/modules/blocks/redis/README.md new file mode 100644 index 0000000..a2549ad --- /dev/null +++ b/modules/dashboard/modules/blocks/redis/README.md @@ -0,0 +1,34 @@ +# ingress + + +## Requirements + +No requirements. + +## Providers + +No providers. + +## Modules + +No modules. + +## Resources + +No resources. + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [namespace](#input\_namespace) | k8s namespace name | `string` | n/a | yes | +| [redis\_name](#input\_redis\_name) | Redis name | `string` | `"redis"` | no | +| [redis\_namespace](#input\_redis\_namespace) | k8s redis namespace name | `string` | n/a | yes | +| [redis\_pod](#input\_redis\_pod) | Redis pod name, which may be the same with redis\_name | `string` | `"redis"` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| [result](#output\_result) | description | + diff --git a/modules/dashboard/modules/blocks/redis/output.tf b/modules/dashboard/modules/blocks/redis/output.tf new file mode 100644 index 0000000..23590b4 --- /dev/null +++ b/modules/dashboard/modules/blocks/redis/output.tf @@ -0,0 +1,36 @@ +output "result" { + description = "description" + value = [ + [ + { type : "text/title-with-collapse", text : var.redis_name } + ], + [ + { type : "redis/max-uptime", redis_name = var.redis_name, namespace = var.namespace, width : 4 }, //width : 2 + { type : "redis/memory", redis_name = var.redis_name, namespace = var.namespace, width : 4 }, //width : 2 + { type : "redis/total-memory", redis_name : var.redis_name, namespace = var.namespace, width : 4 }, //width : 4 + { type : "redis/cpu", redis_name : var.redis_name, namespace = var.namespace, width : 4 }, + { type : "redis/replicas", redis_name = var.redis_name, namespace = var.namespace, width : 4 }, + { type : "redis/restarts", redis_pod : var.redis_pod, redis_namespace : var.redis_namespace, width : 4 }, + ], + [ + { type : "redis/errors", redis_name : var.redis_name, namespace : var.namespace, width : 4 }, + { type : "redis/clients", redis_name = var.redis_name, namespace = var.namespace, width : 4 }, + { type : "redis/connections", redis_name = var.redis_name, namespace = var.namespace, width : 4 }, + { type : "redis/latency", redis_name = var.redis_name, namespace = var.namespace, width : 4 }, + { type : "redis/network", redis_name = var.redis_name, namespace = var.namespace, width : 4 }, + { type : "container/network-transmit", pod : var.redis_pod, width : 4 }, + ], + [ + { type : "redis/total-commands", redis_name = var.redis_name, namespace = var.namespace, width : 4 }, + { type : "redis/keys", redis_name : var.redis_name, namespace = var.namespace, width : 4 }, + { type : "redis/expired-evicted-keys", redis_name : var.redis_name, namespace = var.namespace, width : 4 }, + { type : "redis/expiring-notexpiring-keys", redis_name : var.redis_name, namespace = var.namespace, width : 4 }, + { type : "redis/hits-misses", redis_name : var.redis_name, namespace = var.namespace, width : 4 }, + ], + # [ + # { type : "logs/count", aggregated_metric : "redis", width : 4}, + # { type : "logs/error-rate", aggregated_metric : "redis", width : 4}, + # { type : "logs/warning-rate", aggregated_metric : "redis", width : 4}, + # ] + ] +} diff --git a/modules/dashboard/modules/blocks/redis/variables.tf b/modules/dashboard/modules/blocks/redis/variables.tf new file mode 100644 index 0000000..12de8d0 --- /dev/null +++ b/modules/dashboard/modules/blocks/redis/variables.tf @@ -0,0 +1,21 @@ +variable "namespace" { + type = string + description = "k8s namespace name" +} + +variable "redis_namespace" { + type = string + description = "k8s redis namespace name" +} + +variable "redis_name" { + type = string + description = "Redis name" + default = "redis" +} + +variable "redis_pod" { + type = string + description = "Redis pod name, which may be the same with redis_name" + default = "redis" +} diff --git a/modules/dashboard/modules/widgets/base/README.md b/modules/dashboard/modules/widgets/base/README.md index f1afe53..fb1f875 100644 --- a/modules/dashboard/modules/widgets/base/README.md +++ b/modules/dashboard/modules/widgets/base/README.md @@ -27,6 +27,7 @@ No resources. | [annotations](#input\_annotations) | The annotations option for alarm widgets | `any` | `null` | no | | [anomaly\_detection](#input\_anomaly\_detection) | Allow to enable anomaly detection on widget metrics | `bool` | `false` | no | | [anomaly\_deviation](#input\_anomaly\_deviation) | Deviation of the anomaly band | `number` | `6` | no | +| [color\_mode](#input\_color\_mode) | Color mode used for a widget | `string` | `"palette-classic"` | no | | [coordinates](#input\_coordinates) | n/a |
object({
x : number
y : number
width : number
height : number
})
| n/a | yes | | [data\_source](#input\_data\_source) | The custom datasource for widget item |
object({
uid = optional(string, null)
type = optional(string, "prometheus")
})
| n/a | yes | | [decimals](#input\_decimals) | The decimals to enable on numbers | `number` | `0` | no | @@ -49,6 +50,7 @@ No resources. | [stacked](#input\_stacked) | The stacked option for log insights and alarm widgets | `bool` | `null` | no | | [start](#input\_start) | start of widget | `string` | `null` | no | | [stat](#input\_stat) | n/a | `string` | `"Average"` | no | +| [thresholds](#input\_thresholds) | Thresholds defined for a widget |
object({
mode = string
steps = list(object({
color = string
value = number
}))
})
|
{
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
| no | | [trend](#input\_trend) | trend of widget | `bool` | `null` | no | | [type](#input\_type) | The type of widget to be prepared | `string` | `"metric"` | no | | [unit](#input\_unit) | Unit used for widget metric | `string` | `""` | no | diff --git a/modules/dashboard/modules/widgets/base/main.tf b/modules/dashboard/modules/widgets/base/main.tf index 976a9a4..c34a458 100644 --- a/modules/dashboard/modules/widgets/base/main.tf +++ b/modules/dashboard/modules/widgets/base/main.tf @@ -15,6 +15,8 @@ module "base_grafana" { query = var.query sources = var.sources view = var.view + thresholds = var.thresholds + color_mode = var.color_mode stacked = var.stacked annotations = var.annotations alarms = var.alarms diff --git a/modules/dashboard/modules/widgets/base/platforms/grafana/README.md b/modules/dashboard/modules/widgets/base/platforms/grafana/README.md index 8083586..099a8ea 100644 --- a/modules/dashboard/modules/widgets/base/platforms/grafana/README.md +++ b/modules/dashboard/modules/widgets/base/platforms/grafana/README.md @@ -25,6 +25,7 @@ No resources. | [annotations](#input\_annotations) | The annotations option for alarm widgets | `any` | `null` | no | | [anomaly\_detection](#input\_anomaly\_detection) | Allow to enable anomaly detection on widget metrics | `bool` | `false` | no | | [anomaly\_deviation](#input\_anomaly\_deviation) | Height of anomaly band | `number` | `4` | no | +| [color\_mode](#input\_color\_mode) | Color mode used for a widget | `string` | `"palette-classic"` | no | | [coordinates](#input\_coordinates) | n/a |
object({
x : number
y : number
width : number
height : number
})
| n/a | yes | | [data\_source](#input\_data\_source) | The custom datasource for widget item |
object({
uid = optional(string, null)
type = optional(string, "prometheus")
})
| n/a | yes | | [decimals](#input\_decimals) | The decimals to enable on numbers | `number` | `0` | no | @@ -40,6 +41,7 @@ No resources. | [sources](#input\_sources) | Log groups list for Logs Insights query | `list(string)` | `[]` | no | | [stacked](#input\_stacked) | The stacked option for log insights and alarm widgets | `bool` | `null` | no | | [stat](#input\_stat) | n/a | `string` | `"Average"` | no | +| [thresholds](#input\_thresholds) | Thresholds defined for a widget |
object({
mode = string
steps = list(object({
color = string
value = number
}))
})
|
{
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
| no | | [type](#input\_type) | The type of widget to be prepared | `string` | `"metric"` | no | | [unit](#input\_unit) | Unit used for widget metric | `string` | `""` | no | | [view](#input\_view) | The view for log insights and alarm widgets | `string` | `null` | no | diff --git a/modules/dashboard/modules/widgets/base/platforms/grafana/variables.tf b/modules/dashboard/modules/widgets/base/platforms/grafana/variables.tf index 446e387..2d8aef7 100644 --- a/modules/dashboard/modules/widgets/base/platforms/grafana/variables.tf +++ b/modules/dashboard/modules/widgets/base/platforms/grafana/variables.tf @@ -157,3 +157,33 @@ variable "description" { description = "Description for the widget" default = "" } + +variable "thresholds" { + type = object({ + mode = string + steps = list(object({ + color = string + value = number + })) + }) + description = "Thresholds defined for a widget" + default = { + mode = "absolute" + steps = [ + { + color = "green" + value = null + }, + { + color = "red" + value = 80 + }, + ] + } +} + +variable "color_mode" { + type = string + description = "Color mode used for a widget" + default = "palette-classic" +} diff --git a/modules/dashboard/modules/widgets/base/platforms/grafana/widget.tf b/modules/dashboard/modules/widgets/base/platforms/grafana/widget.tf index b5c251c..de23871 100644 --- a/modules/dashboard/modules/widgets/base/platforms/grafana/widget.tf +++ b/modules/dashboard/modules/widgets/base/platforms/grafana/widget.tf @@ -1,7 +1,7 @@ locals { field_config_defaults = { "color" : { - "mode" : "palette-classic" + "mode" : try(var.color_mode, "palette-classic") }, decimals : var.decimals, "custom" : { @@ -33,19 +33,13 @@ locals { } }, mappings = [] - thresholds = { - mode = "absolute" + thresholds = try(var.thresholds, { + mode = "absolute", steps = [ - { - color = "green" - value = null - }, - { - color = "red" - value = 80 - }, + { color = "green", value = null }, + { color = "red", value = 80 } ] - } + }) unit = var.unit } @@ -82,6 +76,7 @@ locals { timeSeries = "timeseries" gauge = "gauge" histogram = "histogram" + stat = "stat" } # create query and metric based targets diff --git a/modules/dashboard/modules/widgets/base/variables.tf b/modules/dashboard/modules/widgets/base/variables.tf index e6ee6af..c223eca 100644 --- a/modules/dashboard/modules/widgets/base/variables.tf +++ b/modules/dashboard/modules/widgets/base/variables.tf @@ -214,3 +214,33 @@ variable "description" { description = "Description for the widget" default = "" } + +variable "thresholds" { + type = object({ + mode = string + steps = list(object({ + color = string + value = number + })) + }) + description = "Thresholds defined for a widget" + default = { + mode = "absolute" + steps = [ + { + color = "green" + value = null + }, + { + color = "red" + value = 80 + }, + ] + } +} + +variable "color_mode" { + type = string + description = "Color mode used for a widget" + default = "palette-classic" +} diff --git a/modules/dashboard/modules/widgets/pod/restarts/README.md b/modules/dashboard/modules/widgets/pod/restarts/README.md new file mode 100644 index 0000000..5cc0456 --- /dev/null +++ b/modules/dashboard/modules/widgets/pod/restarts/README.md @@ -0,0 +1,42 @@ +# restarts + + +## Requirements + +No requirements. + +## Providers + +No providers. + +## Modules + +| Name | Source | Version | +|------|--------|---------| +| [base](#module\_base) | ../../base | n/a | + +## Resources + +No resources. + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [account\_id](#input\_account\_id) | n/a | `string` | `null` | no | +| [anomaly\_detection](#input\_anomaly\_detection) | Allow to enable anomaly detection on widget metrics | `bool` | `false` | no | +| [anomaly\_deviation](#input\_anomaly\_deviation) | Deviation of the anomaly band | `number` | `6` | no | +| [cluster](#input\_cluster) | n/a | `string` | n/a | yes | +| [coordinates](#input\_coordinates) | position |
object({
x : number
y : number
width : number
height : number
})
| n/a | yes | +| [data\_source](#input\_data\_source) | The custom datasource for widget item |
object({
uid = optional(string, null)
type = optional(string, "prometheus")
})
| n/a | yes | +| [namespace](#input\_namespace) | n/a | `string` | `"default"` | no | +| [period](#input\_period) | stats | `number` | `3` | no | +| [pod](#input\_pod) | n/a | `string` | n/a | yes | +| [region](#input\_region) | n/a | `string` | `""` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| [data](#output\_data) | n/a | + diff --git a/modules/dashboard/modules/widgets/pod/restarts/base.tf b/modules/dashboard/modules/widgets/pod/restarts/base.tf new file mode 100644 index 0000000..0ecb53d --- /dev/null +++ b/modules/dashboard/modules/widgets/pod/restarts/base.tf @@ -0,0 +1,24 @@ +module "base" { + source = "../../base" + + name = "Restarts [${var.period}m]" + data_source = var.data_source + coordinates = var.coordinates + stat = "Maximum" + period = var.period + region = var.region + anomaly_detection = var.anomaly_detection + anomaly_deviation = var.anomaly_deviation + + defaults = { + MetricNamespace = "ContainerInsights" + ClusterName = var.cluster + Namespace = var.namespace + PodName = var.pod + accountId = var.account_id + } + + metrics = [ + { label = "Restarts", color = "d62728", expression = "sum(rate(kube_pod_container_status_restarts_total{pod=~\"${var.pod}-[^-]+-[^-]+$\", namespace=\"${var.namespace}\"}[${var.period}m]))" }, + ] +} diff --git a/modules/dashboard/modules/widgets/pod/restarts/output.tf b/modules/dashboard/modules/widgets/pod/restarts/output.tf new file mode 100644 index 0000000..37309dc --- /dev/null +++ b/modules/dashboard/modules/widgets/pod/restarts/output.tf @@ -0,0 +1,3 @@ +output "data" { + value = module.base.data +} diff --git a/modules/dashboard/modules/widgets/pod/restarts/variables.tf b/modules/dashboard/modules/widgets/pod/restarts/variables.tf new file mode 100644 index 0000000..760924f --- /dev/null +++ b/modules/dashboard/modules/widgets/pod/restarts/variables.tf @@ -0,0 +1,58 @@ +variable "data_source" { + type = object({ + uid = optional(string, null) + type = optional(string, "prometheus") + }) + description = "The custom datasource for widget item" +} + +variable "pod" { + type = string +} + +variable "cluster" { + type = string +} + +variable "namespace" { + type = string + default = "default" +} + +variable "account_id" { + type = string + default = null +} + +variable "region" { + type = string + default = "" +} + +# position +variable "coordinates" { + type = object({ + x : number + y : number + width : number + height : number + }) +} + +# stats +variable "period" { + type = number + default = 3 +} + +variable "anomaly_detection" { + type = bool + default = false + description = "Allow to enable anomaly detection on widget metrics" +} + +variable "anomaly_deviation" { + type = number + default = 6 + description = "Deviation of the anomaly band" +} diff --git a/modules/dashboard/modules/widgets/redis/clients/README.md b/modules/dashboard/modules/widgets/redis/clients/README.md new file mode 100644 index 0000000..2fcbbcf --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/clients/README.md @@ -0,0 +1,42 @@ +# cpu + + +## Requirements + +No requirements. + +## Providers + +No providers. + +## Modules + +| Name | Source | Version | +|------|--------|---------| +| [base](#module\_base) | ../../base | n/a | + +## Resources + +No resources. + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [anomaly\_detection](#input\_anomaly\_detection) | Allow to enable anomaly detection on widget metrics | `bool` | `false` | no | +| [anomaly\_deviation](#input\_anomaly\_deviation) | Deviation of the anomaly band | `number` | `6` | no | +| [by\_pod](#input\_by\_pod) | n/a | `bool` | `false` | no | +| [cluster](#input\_cluster) | n/a | `string` | n/a | yes | +| [coordinates](#input\_coordinates) | position |
object({
x : number
y : number
width : number
height : number
})
| n/a | yes | +| [data\_source](#input\_data\_source) | The custom datasource for widget item |
object({
uid = optional(string, null)
type = optional(string, "prometheus")
})
| n/a | yes | +| [namespace](#input\_namespace) | n/a | `string` | `null` | no | +| [period](#input\_period) | stats | `number` | `60` | no | +| [redis\_name](#input\_redis\_name) | Redis service name | `string` | n/a | yes | +| [region](#input\_region) | n/a | `string` | `""` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| [data](#output\_data) | n/a | + diff --git a/modules/dashboard/modules/widgets/redis/clients/base.tf b/modules/dashboard/modules/widgets/redis/clients/base.tf new file mode 100644 index 0000000..87aec84 --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/clients/base.tf @@ -0,0 +1,17 @@ +module "base" { + source = "../../base" + + name = "Clients" + data_source = var.data_source + coordinates = var.coordinates + period = var.period + region = var.region + anomaly_detection = var.anomaly_detection + anomaly_deviation = var.anomaly_deviation + + view = "stat" + + metrics = [ + { label = "Clients", color : "808080", expression = "sum(redis_connected_clients{service=\"${var.redis_name}\", namespace=\"${var.namespace}\"})" } + ] +} diff --git a/modules/dashboard/modules/widgets/redis/clients/output.tf b/modules/dashboard/modules/widgets/redis/clients/output.tf new file mode 100644 index 0000000..37309dc --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/clients/output.tf @@ -0,0 +1,3 @@ +output "data" { + value = module.base.data +} diff --git a/modules/dashboard/modules/widgets/redis/clients/variables.tf b/modules/dashboard/modules/widgets/redis/clients/variables.tf new file mode 100644 index 0000000..9c16495 --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/clients/variables.tf @@ -0,0 +1,59 @@ +variable "data_source" { + type = object({ + uid = optional(string, null) + type = optional(string, "prometheus") + }) + description = "The custom datasource for widget item" +} + +variable "redis_name" { + type = string + description = "Redis service name" +} + +variable "cluster" { + type = string +} + +variable "namespace" { + type = string + default = null +} + +variable "region" { + type = string + default = "" +} + +# position +variable "coordinates" { + type = object({ + x : number + y : number + width : number + height : number + }) +} + +# stats +variable "period" { + type = number + default = 60 +} + +variable "by_pod" { + type = bool + default = false +} + +variable "anomaly_detection" { + type = bool + default = false + description = "Allow to enable anomaly detection on widget metrics" +} + +variable "anomaly_deviation" { + type = number + default = 6 + description = "Deviation of the anomaly band" +} diff --git a/modules/dashboard/modules/widgets/redis/connections/README.md b/modules/dashboard/modules/widgets/redis/connections/README.md new file mode 100644 index 0000000..2fcbbcf --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/connections/README.md @@ -0,0 +1,42 @@ +# cpu + + +## Requirements + +No requirements. + +## Providers + +No providers. + +## Modules + +| Name | Source | Version | +|------|--------|---------| +| [base](#module\_base) | ../../base | n/a | + +## Resources + +No resources. + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [anomaly\_detection](#input\_anomaly\_detection) | Allow to enable anomaly detection on widget metrics | `bool` | `false` | no | +| [anomaly\_deviation](#input\_anomaly\_deviation) | Deviation of the anomaly band | `number` | `6` | no | +| [by\_pod](#input\_by\_pod) | n/a | `bool` | `false` | no | +| [cluster](#input\_cluster) | n/a | `string` | n/a | yes | +| [coordinates](#input\_coordinates) | position |
object({
x : number
y : number
width : number
height : number
})
| n/a | yes | +| [data\_source](#input\_data\_source) | The custom datasource for widget item |
object({
uid = optional(string, null)
type = optional(string, "prometheus")
})
| n/a | yes | +| [namespace](#input\_namespace) | n/a | `string` | `null` | no | +| [period](#input\_period) | stats | `number` | `60` | no | +| [redis\_name](#input\_redis\_name) | Redis service name | `string` | n/a | yes | +| [region](#input\_region) | n/a | `string` | `""` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| [data](#output\_data) | n/a | + diff --git a/modules/dashboard/modules/widgets/redis/connections/base.tf b/modules/dashboard/modules/widgets/redis/connections/base.tf new file mode 100644 index 0000000..b93425b --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/connections/base.tf @@ -0,0 +1,16 @@ +module "base" { + source = "../../base" + + name = "Connections" + data_source = var.data_source + coordinates = var.coordinates + period = var.period + region = var.region + anomaly_detection = var.anomaly_detection + anomaly_deviation = var.anomaly_deviation + + metrics = [ + { label = "Connected", color : "3ece76", expression = "sum(redis_connected_clients{service=\"${var.redis_name}\", namespace=\"${var.namespace}\"})" }, + { label = "Blocked", color : "ff0f3c", expression = "sum(redis_blocked_clients{service=\"${var.redis_name}\", namespace=\"${var.namespace}\"})" } + ] +} diff --git a/modules/dashboard/modules/widgets/redis/connections/output.tf b/modules/dashboard/modules/widgets/redis/connections/output.tf new file mode 100644 index 0000000..37309dc --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/connections/output.tf @@ -0,0 +1,3 @@ +output "data" { + value = module.base.data +} diff --git a/modules/dashboard/modules/widgets/redis/connections/variables.tf b/modules/dashboard/modules/widgets/redis/connections/variables.tf new file mode 100644 index 0000000..9c16495 --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/connections/variables.tf @@ -0,0 +1,59 @@ +variable "data_source" { + type = object({ + uid = optional(string, null) + type = optional(string, "prometheus") + }) + description = "The custom datasource for widget item" +} + +variable "redis_name" { + type = string + description = "Redis service name" +} + +variable "cluster" { + type = string +} + +variable "namespace" { + type = string + default = null +} + +variable "region" { + type = string + default = "" +} + +# position +variable "coordinates" { + type = object({ + x : number + y : number + width : number + height : number + }) +} + +# stats +variable "period" { + type = number + default = 60 +} + +variable "by_pod" { + type = bool + default = false +} + +variable "anomaly_detection" { + type = bool + default = false + description = "Allow to enable anomaly detection on widget metrics" +} + +variable "anomaly_deviation" { + type = number + default = 6 + description = "Deviation of the anomaly band" +} diff --git a/modules/dashboard/modules/widgets/redis/cpu/README.md b/modules/dashboard/modules/widgets/redis/cpu/README.md new file mode 100644 index 0000000..2fcbbcf --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/cpu/README.md @@ -0,0 +1,42 @@ +# cpu + + +## Requirements + +No requirements. + +## Providers + +No providers. + +## Modules + +| Name | Source | Version | +|------|--------|---------| +| [base](#module\_base) | ../../base | n/a | + +## Resources + +No resources. + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [anomaly\_detection](#input\_anomaly\_detection) | Allow to enable anomaly detection on widget metrics | `bool` | `false` | no | +| [anomaly\_deviation](#input\_anomaly\_deviation) | Deviation of the anomaly band | `number` | `6` | no | +| [by\_pod](#input\_by\_pod) | n/a | `bool` | `false` | no | +| [cluster](#input\_cluster) | n/a | `string` | n/a | yes | +| [coordinates](#input\_coordinates) | position |
object({
x : number
y : number
width : number
height : number
})
| n/a | yes | +| [data\_source](#input\_data\_source) | The custom datasource for widget item |
object({
uid = optional(string, null)
type = optional(string, "prometheus")
})
| n/a | yes | +| [namespace](#input\_namespace) | n/a | `string` | `null` | no | +| [period](#input\_period) | stats | `number` | `60` | no | +| [redis\_name](#input\_redis\_name) | Redis service name | `string` | n/a | yes | +| [region](#input\_region) | n/a | `string` | `""` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| [data](#output\_data) | n/a | + diff --git a/modules/dashboard/modules/widgets/redis/cpu/base.tf b/modules/dashboard/modules/widgets/redis/cpu/base.tf new file mode 100644 index 0000000..9f9c8d2 --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/cpu/base.tf @@ -0,0 +1,16 @@ +module "base" { + source = "../../base" + + name = "CPU [${var.period}m]" + data_source = var.data_source + coordinates = var.coordinates + period = var.period + region = var.region + anomaly_detection = var.anomaly_detection + anomaly_deviation = var.anomaly_deviation + + metrics = [ + { label = "User", color = "e377c2", expression = "sum(rate(redis_cpu_user_seconds_total{service=\"${var.redis_name}\", namespace=\"${var.namespace}\"}[${var.period}m]))" }, + { label = "System", color = "17becf", expression = "sum(rate(redis_cpu_sys_seconds_total{service=\"${var.redis_name}\", namespace=\"${var.namespace}\"}[${var.period}m]))" } + ] +} diff --git a/modules/dashboard/modules/widgets/redis/cpu/output.tf b/modules/dashboard/modules/widgets/redis/cpu/output.tf new file mode 100644 index 0000000..37309dc --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/cpu/output.tf @@ -0,0 +1,3 @@ +output "data" { + value = module.base.data +} diff --git a/modules/dashboard/modules/widgets/redis/cpu/variables.tf b/modules/dashboard/modules/widgets/redis/cpu/variables.tf new file mode 100644 index 0000000..9c16495 --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/cpu/variables.tf @@ -0,0 +1,59 @@ +variable "data_source" { + type = object({ + uid = optional(string, null) + type = optional(string, "prometheus") + }) + description = "The custom datasource for widget item" +} + +variable "redis_name" { + type = string + description = "Redis service name" +} + +variable "cluster" { + type = string +} + +variable "namespace" { + type = string + default = null +} + +variable "region" { + type = string + default = "" +} + +# position +variable "coordinates" { + type = object({ + x : number + y : number + width : number + height : number + }) +} + +# stats +variable "period" { + type = number + default = 60 +} + +variable "by_pod" { + type = bool + default = false +} + +variable "anomaly_detection" { + type = bool + default = false + description = "Allow to enable anomaly detection on widget metrics" +} + +variable "anomaly_deviation" { + type = number + default = 6 + description = "Deviation of the anomaly band" +} diff --git a/modules/dashboard/modules/widgets/redis/errors/README.md b/modules/dashboard/modules/widgets/redis/errors/README.md new file mode 100644 index 0000000..2fcbbcf --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/errors/README.md @@ -0,0 +1,42 @@ +# cpu + + +## Requirements + +No requirements. + +## Providers + +No providers. + +## Modules + +| Name | Source | Version | +|------|--------|---------| +| [base](#module\_base) | ../../base | n/a | + +## Resources + +No resources. + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [anomaly\_detection](#input\_anomaly\_detection) | Allow to enable anomaly detection on widget metrics | `bool` | `false` | no | +| [anomaly\_deviation](#input\_anomaly\_deviation) | Deviation of the anomaly band | `number` | `6` | no | +| [by\_pod](#input\_by\_pod) | n/a | `bool` | `false` | no | +| [cluster](#input\_cluster) | n/a | `string` | n/a | yes | +| [coordinates](#input\_coordinates) | position |
object({
x : number
y : number
width : number
height : number
})
| n/a | yes | +| [data\_source](#input\_data\_source) | The custom datasource for widget item |
object({
uid = optional(string, null)
type = optional(string, "prometheus")
})
| n/a | yes | +| [namespace](#input\_namespace) | n/a | `string` | `null` | no | +| [period](#input\_period) | stats | `number` | `60` | no | +| [redis\_name](#input\_redis\_name) | Redis service name | `string` | n/a | yes | +| [region](#input\_region) | n/a | `string` | `""` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| [data](#output\_data) | n/a | + diff --git a/modules/dashboard/modules/widgets/redis/errors/base.tf b/modules/dashboard/modules/widgets/redis/errors/base.tf new file mode 100644 index 0000000..75ac612 --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/errors/base.tf @@ -0,0 +1,16 @@ +module "base" { + source = "../../base" + + name = "Errors [${var.period}m]" + data_source = var.data_source + coordinates = var.coordinates + period = var.period + region = var.region + anomaly_detection = var.anomaly_detection + anomaly_deviation = var.anomaly_deviation + + metrics = [ + { label = "__auto", expression = "sum(rate(redis_errors_total{service=\"${var.redis_name}\", namespace=\"${var.namespace}\"}[${var.period}m])) by (err)" }, + { label = "__auto", expression = "sum(rate(redis_errors_total{service=\"${var.redis_name}\", namespace=\"${var.namespace}\"}[${var.period}m]))" } + ] +} diff --git a/modules/dashboard/modules/widgets/redis/errors/output.tf b/modules/dashboard/modules/widgets/redis/errors/output.tf new file mode 100644 index 0000000..37309dc --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/errors/output.tf @@ -0,0 +1,3 @@ +output "data" { + value = module.base.data +} diff --git a/modules/dashboard/modules/widgets/redis/errors/variables.tf b/modules/dashboard/modules/widgets/redis/errors/variables.tf new file mode 100644 index 0000000..9c16495 --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/errors/variables.tf @@ -0,0 +1,59 @@ +variable "data_source" { + type = object({ + uid = optional(string, null) + type = optional(string, "prometheus") + }) + description = "The custom datasource for widget item" +} + +variable "redis_name" { + type = string + description = "Redis service name" +} + +variable "cluster" { + type = string +} + +variable "namespace" { + type = string + default = null +} + +variable "region" { + type = string + default = "" +} + +# position +variable "coordinates" { + type = object({ + x : number + y : number + width : number + height : number + }) +} + +# stats +variable "period" { + type = number + default = 60 +} + +variable "by_pod" { + type = bool + default = false +} + +variable "anomaly_detection" { + type = bool + default = false + description = "Allow to enable anomaly detection on widget metrics" +} + +variable "anomaly_deviation" { + type = number + default = 6 + description = "Deviation of the anomaly band" +} diff --git a/modules/dashboard/modules/widgets/redis/expired-evicted-keys/README.md b/modules/dashboard/modules/widgets/redis/expired-evicted-keys/README.md new file mode 100644 index 0000000..2fcbbcf --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/expired-evicted-keys/README.md @@ -0,0 +1,42 @@ +# cpu + + +## Requirements + +No requirements. + +## Providers + +No providers. + +## Modules + +| Name | Source | Version | +|------|--------|---------| +| [base](#module\_base) | ../../base | n/a | + +## Resources + +No resources. + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [anomaly\_detection](#input\_anomaly\_detection) | Allow to enable anomaly detection on widget metrics | `bool` | `false` | no | +| [anomaly\_deviation](#input\_anomaly\_deviation) | Deviation of the anomaly band | `number` | `6` | no | +| [by\_pod](#input\_by\_pod) | n/a | `bool` | `false` | no | +| [cluster](#input\_cluster) | n/a | `string` | n/a | yes | +| [coordinates](#input\_coordinates) | position |
object({
x : number
y : number
width : number
height : number
})
| n/a | yes | +| [data\_source](#input\_data\_source) | The custom datasource for widget item |
object({
uid = optional(string, null)
type = optional(string, "prometheus")
})
| n/a | yes | +| [namespace](#input\_namespace) | n/a | `string` | `null` | no | +| [period](#input\_period) | stats | `number` | `60` | no | +| [redis\_name](#input\_redis\_name) | Redis service name | `string` | n/a | yes | +| [region](#input\_region) | n/a | `string` | `""` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| [data](#output\_data) | n/a | + diff --git a/modules/dashboard/modules/widgets/redis/expired-evicted-keys/base.tf b/modules/dashboard/modules/widgets/redis/expired-evicted-keys/base.tf new file mode 100644 index 0000000..39b754d --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/expired-evicted-keys/base.tf @@ -0,0 +1,16 @@ +module "base" { + source = "../../base" + + name = "Expired / Evicted Keys [${var.period}m]" + data_source = var.data_source + coordinates = var.coordinates + period = var.period + region = var.region + anomaly_detection = var.anomaly_detection + anomaly_deviation = var.anomaly_deviation + + metrics = [ + { label = "Expired", color : "ffc300", expression = "sum(rate(redis_expired_keys_total{service=\"${var.redis_name}\", namespace=\"${var.namespace}\"}[${var.period}m])) by (service)" }, + { label = "Evicted", color : "ff0f3c", expression = "sum(rate(redis_evicted_keys_total{service=\"${var.redis_name}\", namespace=\"${var.namespace}\"}[${var.period}m])) by (service)" }, + ] +} diff --git a/modules/dashboard/modules/widgets/redis/expired-evicted-keys/output.tf b/modules/dashboard/modules/widgets/redis/expired-evicted-keys/output.tf new file mode 100644 index 0000000..37309dc --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/expired-evicted-keys/output.tf @@ -0,0 +1,3 @@ +output "data" { + value = module.base.data +} diff --git a/modules/dashboard/modules/widgets/redis/expired-evicted-keys/variables.tf b/modules/dashboard/modules/widgets/redis/expired-evicted-keys/variables.tf new file mode 100644 index 0000000..9c16495 --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/expired-evicted-keys/variables.tf @@ -0,0 +1,59 @@ +variable "data_source" { + type = object({ + uid = optional(string, null) + type = optional(string, "prometheus") + }) + description = "The custom datasource for widget item" +} + +variable "redis_name" { + type = string + description = "Redis service name" +} + +variable "cluster" { + type = string +} + +variable "namespace" { + type = string + default = null +} + +variable "region" { + type = string + default = "" +} + +# position +variable "coordinates" { + type = object({ + x : number + y : number + width : number + height : number + }) +} + +# stats +variable "period" { + type = number + default = 60 +} + +variable "by_pod" { + type = bool + default = false +} + +variable "anomaly_detection" { + type = bool + default = false + description = "Allow to enable anomaly detection on widget metrics" +} + +variable "anomaly_deviation" { + type = number + default = 6 + description = "Deviation of the anomaly band" +} diff --git a/modules/dashboard/modules/widgets/redis/expiring-notexpiring-keys/README.md b/modules/dashboard/modules/widgets/redis/expiring-notexpiring-keys/README.md new file mode 100644 index 0000000..2fcbbcf --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/expiring-notexpiring-keys/README.md @@ -0,0 +1,42 @@ +# cpu + + +## Requirements + +No requirements. + +## Providers + +No providers. + +## Modules + +| Name | Source | Version | +|------|--------|---------| +| [base](#module\_base) | ../../base | n/a | + +## Resources + +No resources. + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [anomaly\_detection](#input\_anomaly\_detection) | Allow to enable anomaly detection on widget metrics | `bool` | `false` | no | +| [anomaly\_deviation](#input\_anomaly\_deviation) | Deviation of the anomaly band | `number` | `6` | no | +| [by\_pod](#input\_by\_pod) | n/a | `bool` | `false` | no | +| [cluster](#input\_cluster) | n/a | `string` | n/a | yes | +| [coordinates](#input\_coordinates) | position |
object({
x : number
y : number
width : number
height : number
})
| n/a | yes | +| [data\_source](#input\_data\_source) | The custom datasource for widget item |
object({
uid = optional(string, null)
type = optional(string, "prometheus")
})
| n/a | yes | +| [namespace](#input\_namespace) | n/a | `string` | `null` | no | +| [period](#input\_period) | stats | `number` | `60` | no | +| [redis\_name](#input\_redis\_name) | Redis service name | `string` | n/a | yes | +| [region](#input\_region) | n/a | `string` | `""` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| [data](#output\_data) | n/a | + diff --git a/modules/dashboard/modules/widgets/redis/expiring-notexpiring-keys/base.tf b/modules/dashboard/modules/widgets/redis/expiring-notexpiring-keys/base.tf new file mode 100644 index 0000000..c945cec --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/expiring-notexpiring-keys/base.tf @@ -0,0 +1,16 @@ +module "base" { + source = "../../base" + + name = "Expiring / Not-Expiring Keys" + data_source = var.data_source + coordinates = var.coordinates + period = var.period + region = var.region + anomaly_detection = var.anomaly_detection + anomaly_deviation = var.anomaly_deviation + + metrics = [ + { label = "Not Expiring", color : "3ece76", expression = "sum (redis_db_keys{service=\"${var.redis_name}\", namespace=\"${var.namespace}\"}) by (instance) - sum (redis_db_keys_expiring{service=\"${var.redis_name}\", namespace=\"${var.namespace}\"}) by (instance)" }, + { label = "Expiring", color : "ff0f3c", expression = "sum (redis_db_keys_expiring{service=\"${var.redis_name}\", namespace=\"${var.namespace}\"}) by (instance)" }, + ] +} diff --git a/modules/dashboard/modules/widgets/redis/expiring-notexpiring-keys/output.tf b/modules/dashboard/modules/widgets/redis/expiring-notexpiring-keys/output.tf new file mode 100644 index 0000000..37309dc --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/expiring-notexpiring-keys/output.tf @@ -0,0 +1,3 @@ +output "data" { + value = module.base.data +} diff --git a/modules/dashboard/modules/widgets/redis/expiring-notexpiring-keys/variables.tf b/modules/dashboard/modules/widgets/redis/expiring-notexpiring-keys/variables.tf new file mode 100644 index 0000000..9c16495 --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/expiring-notexpiring-keys/variables.tf @@ -0,0 +1,59 @@ +variable "data_source" { + type = object({ + uid = optional(string, null) + type = optional(string, "prometheus") + }) + description = "The custom datasource for widget item" +} + +variable "redis_name" { + type = string + description = "Redis service name" +} + +variable "cluster" { + type = string +} + +variable "namespace" { + type = string + default = null +} + +variable "region" { + type = string + default = "" +} + +# position +variable "coordinates" { + type = object({ + x : number + y : number + width : number + height : number + }) +} + +# stats +variable "period" { + type = number + default = 60 +} + +variable "by_pod" { + type = bool + default = false +} + +variable "anomaly_detection" { + type = bool + default = false + description = "Allow to enable anomaly detection on widget metrics" +} + +variable "anomaly_deviation" { + type = number + default = 6 + description = "Deviation of the anomaly band" +} diff --git a/modules/dashboard/modules/widgets/redis/hits-misses/README.md b/modules/dashboard/modules/widgets/redis/hits-misses/README.md new file mode 100644 index 0000000..2fcbbcf --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/hits-misses/README.md @@ -0,0 +1,42 @@ +# cpu + + +## Requirements + +No requirements. + +## Providers + +No providers. + +## Modules + +| Name | Source | Version | +|------|--------|---------| +| [base](#module\_base) | ../../base | n/a | + +## Resources + +No resources. + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [anomaly\_detection](#input\_anomaly\_detection) | Allow to enable anomaly detection on widget metrics | `bool` | `false` | no | +| [anomaly\_deviation](#input\_anomaly\_deviation) | Deviation of the anomaly band | `number` | `6` | no | +| [by\_pod](#input\_by\_pod) | n/a | `bool` | `false` | no | +| [cluster](#input\_cluster) | n/a | `string` | n/a | yes | +| [coordinates](#input\_coordinates) | position |
object({
x : number
y : number
width : number
height : number
})
| n/a | yes | +| [data\_source](#input\_data\_source) | The custom datasource for widget item |
object({
uid = optional(string, null)
type = optional(string, "prometheus")
})
| n/a | yes | +| [namespace](#input\_namespace) | n/a | `string` | `null` | no | +| [period](#input\_period) | stats | `number` | `60` | no | +| [redis\_name](#input\_redis\_name) | Redis service name | `string` | n/a | yes | +| [region](#input\_region) | n/a | `string` | `""` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| [data](#output\_data) | n/a | + diff --git a/modules/dashboard/modules/widgets/redis/hits-misses/base.tf b/modules/dashboard/modules/widgets/redis/hits-misses/base.tf new file mode 100644 index 0000000..f11bfdc --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/hits-misses/base.tf @@ -0,0 +1,16 @@ +module "base" { + source = "../../base" + + name = "Hits / Misses per Sec [${var.period}m]" + data_source = var.data_source + coordinates = var.coordinates + period = var.period + region = var.region + anomaly_detection = var.anomaly_detection + anomaly_deviation = var.anomaly_deviation + + metrics = [ + { label = "Hits", color : "007cef", expression = "irate(redis_keyspace_hits_total{service=\"${var.redis_name}\", namespace=\"${var.namespace}\"}[${var.period}m])" }, + { label = "Misses", color : "d400bf", expression = "irate(redis_keyspace_misses_total{service=\"${var.redis_name}\", namespace=\"${var.namespace}\"}[${var.period}m])" } + ] +} diff --git a/modules/dashboard/modules/widgets/redis/hits-misses/output.tf b/modules/dashboard/modules/widgets/redis/hits-misses/output.tf new file mode 100644 index 0000000..37309dc --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/hits-misses/output.tf @@ -0,0 +1,3 @@ +output "data" { + value = module.base.data +} diff --git a/modules/dashboard/modules/widgets/redis/hits-misses/variables.tf b/modules/dashboard/modules/widgets/redis/hits-misses/variables.tf new file mode 100644 index 0000000..9c16495 --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/hits-misses/variables.tf @@ -0,0 +1,59 @@ +variable "data_source" { + type = object({ + uid = optional(string, null) + type = optional(string, "prometheus") + }) + description = "The custom datasource for widget item" +} + +variable "redis_name" { + type = string + description = "Redis service name" +} + +variable "cluster" { + type = string +} + +variable "namespace" { + type = string + default = null +} + +variable "region" { + type = string + default = "" +} + +# position +variable "coordinates" { + type = object({ + x : number + y : number + width : number + height : number + }) +} + +# stats +variable "period" { + type = number + default = 60 +} + +variable "by_pod" { + type = bool + default = false +} + +variable "anomaly_detection" { + type = bool + default = false + description = "Allow to enable anomaly detection on widget metrics" +} + +variable "anomaly_deviation" { + type = number + default = 6 + description = "Deviation of the anomaly band" +} diff --git a/modules/dashboard/modules/widgets/redis/keys/README.md b/modules/dashboard/modules/widgets/redis/keys/README.md new file mode 100644 index 0000000..2fcbbcf --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/keys/README.md @@ -0,0 +1,42 @@ +# cpu + + +## Requirements + +No requirements. + +## Providers + +No providers. + +## Modules + +| Name | Source | Version | +|------|--------|---------| +| [base](#module\_base) | ../../base | n/a | + +## Resources + +No resources. + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [anomaly\_detection](#input\_anomaly\_detection) | Allow to enable anomaly detection on widget metrics | `bool` | `false` | no | +| [anomaly\_deviation](#input\_anomaly\_deviation) | Deviation of the anomaly band | `number` | `6` | no | +| [by\_pod](#input\_by\_pod) | n/a | `bool` | `false` | no | +| [cluster](#input\_cluster) | n/a | `string` | n/a | yes | +| [coordinates](#input\_coordinates) | position |
object({
x : number
y : number
width : number
height : number
})
| n/a | yes | +| [data\_source](#input\_data\_source) | The custom datasource for widget item |
object({
uid = optional(string, null)
type = optional(string, "prometheus")
})
| n/a | yes | +| [namespace](#input\_namespace) | n/a | `string` | `null` | no | +| [period](#input\_period) | stats | `number` | `60` | no | +| [redis\_name](#input\_redis\_name) | Redis service name | `string` | n/a | yes | +| [region](#input\_region) | n/a | `string` | `""` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| [data](#output\_data) | n/a | + diff --git a/modules/dashboard/modules/widgets/redis/keys/base.tf b/modules/dashboard/modules/widgets/redis/keys/base.tf new file mode 100644 index 0000000..e08219d --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/keys/base.tf @@ -0,0 +1,15 @@ +module "base" { + source = "../../base" + + name = "Keys by DB (k)" + data_source = var.data_source + coordinates = var.coordinates + period = var.period + region = var.region + anomaly_detection = var.anomaly_detection + anomaly_deviation = var.anomaly_deviation + + metrics = [ + { label = "__auto", expression = "sum(redis_db_keys{service=\"${var.redis_name}\", namespace=\"${var.namespace}\"}) by (db) / 1000" }, + ] +} diff --git a/modules/dashboard/modules/widgets/redis/keys/output.tf b/modules/dashboard/modules/widgets/redis/keys/output.tf new file mode 100644 index 0000000..37309dc --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/keys/output.tf @@ -0,0 +1,3 @@ +output "data" { + value = module.base.data +} diff --git a/modules/dashboard/modules/widgets/redis/keys/variables.tf b/modules/dashboard/modules/widgets/redis/keys/variables.tf new file mode 100644 index 0000000..9c16495 --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/keys/variables.tf @@ -0,0 +1,59 @@ +variable "data_source" { + type = object({ + uid = optional(string, null) + type = optional(string, "prometheus") + }) + description = "The custom datasource for widget item" +} + +variable "redis_name" { + type = string + description = "Redis service name" +} + +variable "cluster" { + type = string +} + +variable "namespace" { + type = string + default = null +} + +variable "region" { + type = string + default = "" +} + +# position +variable "coordinates" { + type = object({ + x : number + y : number + width : number + height : number + }) +} + +# stats +variable "period" { + type = number + default = 60 +} + +variable "by_pod" { + type = bool + default = false +} + +variable "anomaly_detection" { + type = bool + default = false + description = "Allow to enable anomaly detection on widget metrics" +} + +variable "anomaly_deviation" { + type = number + default = 6 + description = "Deviation of the anomaly band" +} diff --git a/modules/dashboard/modules/widgets/redis/latency/README.md b/modules/dashboard/modules/widgets/redis/latency/README.md new file mode 100644 index 0000000..2fcbbcf --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/latency/README.md @@ -0,0 +1,42 @@ +# cpu + + +## Requirements + +No requirements. + +## Providers + +No providers. + +## Modules + +| Name | Source | Version | +|------|--------|---------| +| [base](#module\_base) | ../../base | n/a | + +## Resources + +No resources. + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [anomaly\_detection](#input\_anomaly\_detection) | Allow to enable anomaly detection on widget metrics | `bool` | `false` | no | +| [anomaly\_deviation](#input\_anomaly\_deviation) | Deviation of the anomaly band | `number` | `6` | no | +| [by\_pod](#input\_by\_pod) | n/a | `bool` | `false` | no | +| [cluster](#input\_cluster) | n/a | `string` | n/a | yes | +| [coordinates](#input\_coordinates) | position |
object({
x : number
y : number
width : number
height : number
})
| n/a | yes | +| [data\_source](#input\_data\_source) | The custom datasource for widget item |
object({
uid = optional(string, null)
type = optional(string, "prometheus")
})
| n/a | yes | +| [namespace](#input\_namespace) | n/a | `string` | `null` | no | +| [period](#input\_period) | stats | `number` | `60` | no | +| [redis\_name](#input\_redis\_name) | Redis service name | `string` | n/a | yes | +| [region](#input\_region) | n/a | `string` | `""` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| [data](#output\_data) | n/a | + diff --git a/modules/dashboard/modules/widgets/redis/latency/base.tf b/modules/dashboard/modules/widgets/redis/latency/base.tf new file mode 100644 index 0000000..6681c1b --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/latency/base.tf @@ -0,0 +1,16 @@ +module "base" { + source = "../../base" + + name = "Latency [${var.period}m]" + data_source = var.data_source + coordinates = var.coordinates + period = var.period + region = var.region + anomaly_detection = var.anomaly_detection + anomaly_deviation = var.anomaly_deviation + + metrics = [ + { label = "Percentile", color : "3ece76", expression = "sum(rate(redis_latency_percentiles_usec_sum{service=\"${var.redis_name}\", namespace=\"${var.namespace}\"}[${var.period}m])) / 60 / 60 / 60" }, + { label = "Command Duration", color : "d400bf", expression = "sum(rate(redis_commands_duration_seconds_total{service=\"${var.redis_name}\", namespace=\"${var.namespace}\"}[${var.period}m]))" } + ] +} diff --git a/modules/dashboard/modules/widgets/redis/latency/output.tf b/modules/dashboard/modules/widgets/redis/latency/output.tf new file mode 100644 index 0000000..37309dc --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/latency/output.tf @@ -0,0 +1,3 @@ +output "data" { + value = module.base.data +} diff --git a/modules/dashboard/modules/widgets/redis/latency/variables.tf b/modules/dashboard/modules/widgets/redis/latency/variables.tf new file mode 100644 index 0000000..9c16495 --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/latency/variables.tf @@ -0,0 +1,59 @@ +variable "data_source" { + type = object({ + uid = optional(string, null) + type = optional(string, "prometheus") + }) + description = "The custom datasource for widget item" +} + +variable "redis_name" { + type = string + description = "Redis service name" +} + +variable "cluster" { + type = string +} + +variable "namespace" { + type = string + default = null +} + +variable "region" { + type = string + default = "" +} + +# position +variable "coordinates" { + type = object({ + x : number + y : number + width : number + height : number + }) +} + +# stats +variable "period" { + type = number + default = 60 +} + +variable "by_pod" { + type = bool + default = false +} + +variable "anomaly_detection" { + type = bool + default = false + description = "Allow to enable anomaly detection on widget metrics" +} + +variable "anomaly_deviation" { + type = number + default = 6 + description = "Deviation of the anomaly band" +} diff --git a/modules/dashboard/modules/widgets/redis/max-uptime/README.md b/modules/dashboard/modules/widgets/redis/max-uptime/README.md new file mode 100644 index 0000000..2fcbbcf --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/max-uptime/README.md @@ -0,0 +1,42 @@ +# cpu + + +## Requirements + +No requirements. + +## Providers + +No providers. + +## Modules + +| Name | Source | Version | +|------|--------|---------| +| [base](#module\_base) | ../../base | n/a | + +## Resources + +No resources. + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [anomaly\_detection](#input\_anomaly\_detection) | Allow to enable anomaly detection on widget metrics | `bool` | `false` | no | +| [anomaly\_deviation](#input\_anomaly\_deviation) | Deviation of the anomaly band | `number` | `6` | no | +| [by\_pod](#input\_by\_pod) | n/a | `bool` | `false` | no | +| [cluster](#input\_cluster) | n/a | `string` | n/a | yes | +| [coordinates](#input\_coordinates) | position |
object({
x : number
y : number
width : number
height : number
})
| n/a | yes | +| [data\_source](#input\_data\_source) | The custom datasource for widget item |
object({
uid = optional(string, null)
type = optional(string, "prometheus")
})
| n/a | yes | +| [namespace](#input\_namespace) | n/a | `string` | `null` | no | +| [period](#input\_period) | stats | `number` | `60` | no | +| [redis\_name](#input\_redis\_name) | Redis service name | `string` | n/a | yes | +| [region](#input\_region) | n/a | `string` | `""` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| [data](#output\_data) | n/a | + diff --git a/modules/dashboard/modules/widgets/redis/max-uptime/base.tf b/modules/dashboard/modules/widgets/redis/max-uptime/base.tf new file mode 100644 index 0000000..1e89376 --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/max-uptime/base.tf @@ -0,0 +1,18 @@ +module "base" { + source = "../../base" + + name = "Max Uptime [${var.period}m]" + data_source = var.data_source + coordinates = var.coordinates + period = var.period + region = var.region + anomaly_detection = var.anomaly_detection + anomaly_deviation = var.anomaly_deviation + + unit = "s" + view = "stat" + + metrics = [ + { label = "Uptime", color : "808080", expression = "max(max_over_time(redis_uptime_in_seconds{service=\"${var.redis_name}\", namespace=\"${var.namespace}\"}[${var.period}m]))" } + ] +} diff --git a/modules/dashboard/modules/widgets/redis/max-uptime/output.tf b/modules/dashboard/modules/widgets/redis/max-uptime/output.tf new file mode 100644 index 0000000..37309dc --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/max-uptime/output.tf @@ -0,0 +1,3 @@ +output "data" { + value = module.base.data +} diff --git a/modules/dashboard/modules/widgets/redis/max-uptime/variables.tf b/modules/dashboard/modules/widgets/redis/max-uptime/variables.tf new file mode 100644 index 0000000..9c16495 --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/max-uptime/variables.tf @@ -0,0 +1,59 @@ +variable "data_source" { + type = object({ + uid = optional(string, null) + type = optional(string, "prometheus") + }) + description = "The custom datasource for widget item" +} + +variable "redis_name" { + type = string + description = "Redis service name" +} + +variable "cluster" { + type = string +} + +variable "namespace" { + type = string + default = null +} + +variable "region" { + type = string + default = "" +} + +# position +variable "coordinates" { + type = object({ + x : number + y : number + width : number + height : number + }) +} + +# stats +variable "period" { + type = number + default = 60 +} + +variable "by_pod" { + type = bool + default = false +} + +variable "anomaly_detection" { + type = bool + default = false + description = "Allow to enable anomaly detection on widget metrics" +} + +variable "anomaly_deviation" { + type = number + default = 6 + description = "Deviation of the anomaly band" +} diff --git a/modules/dashboard/modules/widgets/redis/memory/README.md b/modules/dashboard/modules/widgets/redis/memory/README.md new file mode 100644 index 0000000..2fcbbcf --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/memory/README.md @@ -0,0 +1,42 @@ +# cpu + + +## Requirements + +No requirements. + +## Providers + +No providers. + +## Modules + +| Name | Source | Version | +|------|--------|---------| +| [base](#module\_base) | ../../base | n/a | + +## Resources + +No resources. + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [anomaly\_detection](#input\_anomaly\_detection) | Allow to enable anomaly detection on widget metrics | `bool` | `false` | no | +| [anomaly\_deviation](#input\_anomaly\_deviation) | Deviation of the anomaly band | `number` | `6` | no | +| [by\_pod](#input\_by\_pod) | n/a | `bool` | `false` | no | +| [cluster](#input\_cluster) | n/a | `string` | n/a | yes | +| [coordinates](#input\_coordinates) | position |
object({
x : number
y : number
width : number
height : number
})
| n/a | yes | +| [data\_source](#input\_data\_source) | The custom datasource for widget item |
object({
uid = optional(string, null)
type = optional(string, "prometheus")
})
| n/a | yes | +| [namespace](#input\_namespace) | n/a | `string` | `null` | no | +| [period](#input\_period) | stats | `number` | `60` | no | +| [redis\_name](#input\_redis\_name) | Redis service name | `string` | n/a | yes | +| [region](#input\_region) | n/a | `string` | `""` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| [data](#output\_data) | n/a | + diff --git a/modules/dashboard/modules/widgets/redis/memory/base.tf b/modules/dashboard/modules/widgets/redis/memory/base.tf new file mode 100644 index 0000000..f0bba25 --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/memory/base.tf @@ -0,0 +1,37 @@ +module "base" { + source = "../../base" + + name = "Memory Usage [${var.period}m]" + data_source = var.data_source + coordinates = var.coordinates + period = var.period + region = var.region + anomaly_detection = var.anomaly_detection + anomaly_deviation = var.anomaly_deviation + + view = "gauge" + + thresholds = { + "mode" : "absolute", + "steps" : [ + { + "color" : "green", + "value" : null + }, + { + "color" : "red", + "value" : 80 + }, + { + "color" : "#EAB839", + "value" : 95 + } + ] + } + + color_mode = "thresholds" + + metrics = [ + { label = "__auto", expression = "sum(100 * (redis_memory_used_bytes{service=\"${var.redis_name}\", namespace=\"${var.namespace}\"} / redis_memory_max_bytes{service=\"${var.redis_name}\", namespace=\"${var.namespace}\"}))" } + ] +} diff --git a/modules/dashboard/modules/widgets/redis/memory/output.tf b/modules/dashboard/modules/widgets/redis/memory/output.tf new file mode 100644 index 0000000..37309dc --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/memory/output.tf @@ -0,0 +1,3 @@ +output "data" { + value = module.base.data +} diff --git a/modules/dashboard/modules/widgets/redis/memory/variables.tf b/modules/dashboard/modules/widgets/redis/memory/variables.tf new file mode 100644 index 0000000..9c16495 --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/memory/variables.tf @@ -0,0 +1,59 @@ +variable "data_source" { + type = object({ + uid = optional(string, null) + type = optional(string, "prometheus") + }) + description = "The custom datasource for widget item" +} + +variable "redis_name" { + type = string + description = "Redis service name" +} + +variable "cluster" { + type = string +} + +variable "namespace" { + type = string + default = null +} + +variable "region" { + type = string + default = "" +} + +# position +variable "coordinates" { + type = object({ + x : number + y : number + width : number + height : number + }) +} + +# stats +variable "period" { + type = number + default = 60 +} + +variable "by_pod" { + type = bool + default = false +} + +variable "anomaly_detection" { + type = bool + default = false + description = "Allow to enable anomaly detection on widget metrics" +} + +variable "anomaly_deviation" { + type = number + default = 6 + description = "Deviation of the anomaly band" +} diff --git a/modules/dashboard/modules/widgets/redis/network/README.md b/modules/dashboard/modules/widgets/redis/network/README.md new file mode 100644 index 0000000..2fcbbcf --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/network/README.md @@ -0,0 +1,42 @@ +# cpu + + +## Requirements + +No requirements. + +## Providers + +No providers. + +## Modules + +| Name | Source | Version | +|------|--------|---------| +| [base](#module\_base) | ../../base | n/a | + +## Resources + +No resources. + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [anomaly\_detection](#input\_anomaly\_detection) | Allow to enable anomaly detection on widget metrics | `bool` | `false` | no | +| [anomaly\_deviation](#input\_anomaly\_deviation) | Deviation of the anomaly band | `number` | `6` | no | +| [by\_pod](#input\_by\_pod) | n/a | `bool` | `false` | no | +| [cluster](#input\_cluster) | n/a | `string` | n/a | yes | +| [coordinates](#input\_coordinates) | position |
object({
x : number
y : number
width : number
height : number
})
| n/a | yes | +| [data\_source](#input\_data\_source) | The custom datasource for widget item |
object({
uid = optional(string, null)
type = optional(string, "prometheus")
})
| n/a | yes | +| [namespace](#input\_namespace) | n/a | `string` | `null` | no | +| [period](#input\_period) | stats | `number` | `60` | no | +| [redis\_name](#input\_redis\_name) | Redis service name | `string` | n/a | yes | +| [region](#input\_region) | n/a | `string` | `""` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| [data](#output\_data) | n/a | + diff --git a/modules/dashboard/modules/widgets/redis/network/base.tf b/modules/dashboard/modules/widgets/redis/network/base.tf new file mode 100644 index 0000000..d34d611 --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/network/base.tf @@ -0,0 +1,16 @@ +module "base" { + source = "../../base" + + name = "Network [${var.period}m]" + data_source = var.data_source + coordinates = var.coordinates + period = var.period + region = var.region + anomaly_detection = var.anomaly_detection + anomaly_deviation = var.anomaly_deviation + + metrics = [ + { label = "In", color : "17becf", expression = "sum(rate(redis_net_input_bytes_total{service=\"${var.redis_name}\", namespace=\"${var.namespace}\"}[${var.period}m])) / 1024 / 1024" }, + { label = "Out", color : "e377c2", expression = "sum(rate(redis_net_output_bytes_total{service=\"${var.redis_name}\", namespace=\"${var.namespace}\"}[${var.period}m])) / 1024 / 1024" } + ] +} diff --git a/modules/dashboard/modules/widgets/redis/network/output.tf b/modules/dashboard/modules/widgets/redis/network/output.tf new file mode 100644 index 0000000..37309dc --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/network/output.tf @@ -0,0 +1,3 @@ +output "data" { + value = module.base.data +} diff --git a/modules/dashboard/modules/widgets/redis/network/variables.tf b/modules/dashboard/modules/widgets/redis/network/variables.tf new file mode 100644 index 0000000..9c16495 --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/network/variables.tf @@ -0,0 +1,59 @@ +variable "data_source" { + type = object({ + uid = optional(string, null) + type = optional(string, "prometheus") + }) + description = "The custom datasource for widget item" +} + +variable "redis_name" { + type = string + description = "Redis service name" +} + +variable "cluster" { + type = string +} + +variable "namespace" { + type = string + default = null +} + +variable "region" { + type = string + default = "" +} + +# position +variable "coordinates" { + type = object({ + x : number + y : number + width : number + height : number + }) +} + +# stats +variable "period" { + type = number + default = 60 +} + +variable "by_pod" { + type = bool + default = false +} + +variable "anomaly_detection" { + type = bool + default = false + description = "Allow to enable anomaly detection on widget metrics" +} + +variable "anomaly_deviation" { + type = number + default = 6 + description = "Deviation of the anomaly band" +} diff --git a/modules/dashboard/modules/widgets/redis/replicas/README.md b/modules/dashboard/modules/widgets/redis/replicas/README.md new file mode 100644 index 0000000..2fcbbcf --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/replicas/README.md @@ -0,0 +1,42 @@ +# cpu + + +## Requirements + +No requirements. + +## Providers + +No providers. + +## Modules + +| Name | Source | Version | +|------|--------|---------| +| [base](#module\_base) | ../../base | n/a | + +## Resources + +No resources. + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [anomaly\_detection](#input\_anomaly\_detection) | Allow to enable anomaly detection on widget metrics | `bool` | `false` | no | +| [anomaly\_deviation](#input\_anomaly\_deviation) | Deviation of the anomaly band | `number` | `6` | no | +| [by\_pod](#input\_by\_pod) | n/a | `bool` | `false` | no | +| [cluster](#input\_cluster) | n/a | `string` | n/a | yes | +| [coordinates](#input\_coordinates) | position |
object({
x : number
y : number
width : number
height : number
})
| n/a | yes | +| [data\_source](#input\_data\_source) | The custom datasource for widget item |
object({
uid = optional(string, null)
type = optional(string, "prometheus")
})
| n/a | yes | +| [namespace](#input\_namespace) | n/a | `string` | `null` | no | +| [period](#input\_period) | stats | `number` | `60` | no | +| [redis\_name](#input\_redis\_name) | Redis service name | `string` | n/a | yes | +| [region](#input\_region) | n/a | `string` | `""` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| [data](#output\_data) | n/a | + diff --git a/modules/dashboard/modules/widgets/redis/replicas/base.tf b/modules/dashboard/modules/widgets/redis/replicas/base.tf new file mode 100644 index 0000000..1127200 --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/replicas/base.tf @@ -0,0 +1,15 @@ +module "base" { + source = "../../base" + + name = "Replicas [${var.period}m]" + data_source = var.data_source + coordinates = var.coordinates + period = var.period + region = var.region + anomaly_detection = var.anomaly_detection + anomaly_deviation = var.anomaly_deviation + + metrics = [ + { label = "Number", color = "1f77b4", expression = "sum(kube_deployment_status_replicas{deployment=\"${var.redis_name}\", namespace=\"${var.namespace}\"}) by (deployment)" }, + ] +} diff --git a/modules/dashboard/modules/widgets/redis/replicas/output.tf b/modules/dashboard/modules/widgets/redis/replicas/output.tf new file mode 100644 index 0000000..37309dc --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/replicas/output.tf @@ -0,0 +1,3 @@ +output "data" { + value = module.base.data +} diff --git a/modules/dashboard/modules/widgets/redis/replicas/variables.tf b/modules/dashboard/modules/widgets/redis/replicas/variables.tf new file mode 100644 index 0000000..9c16495 --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/replicas/variables.tf @@ -0,0 +1,59 @@ +variable "data_source" { + type = object({ + uid = optional(string, null) + type = optional(string, "prometheus") + }) + description = "The custom datasource for widget item" +} + +variable "redis_name" { + type = string + description = "Redis service name" +} + +variable "cluster" { + type = string +} + +variable "namespace" { + type = string + default = null +} + +variable "region" { + type = string + default = "" +} + +# position +variable "coordinates" { + type = object({ + x : number + y : number + width : number + height : number + }) +} + +# stats +variable "period" { + type = number + default = 60 +} + +variable "by_pod" { + type = bool + default = false +} + +variable "anomaly_detection" { + type = bool + default = false + description = "Allow to enable anomaly detection on widget metrics" +} + +variable "anomaly_deviation" { + type = number + default = 6 + description = "Deviation of the anomaly band" +} diff --git a/modules/dashboard/modules/widgets/redis/restarts/README.md b/modules/dashboard/modules/widgets/redis/restarts/README.md new file mode 100644 index 0000000..af9a89d --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/restarts/README.md @@ -0,0 +1,43 @@ +# restarts + + +## Requirements + +No requirements. + +## Providers + +No providers. + +## Modules + +| Name | Source | Version | +|------|--------|---------| +| [base](#module\_base) | ../../base | n/a | + +## Resources + +No resources. + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [account\_id](#input\_account\_id) | n/a | `string` | `null` | no | +| [anomaly\_detection](#input\_anomaly\_detection) | Allow to enable anomaly detection on widget metrics | `bool` | `false` | no | +| [anomaly\_deviation](#input\_anomaly\_deviation) | Deviation of the anomaly band | `number` | `6` | no | +| [cluster](#input\_cluster) | n/a | `string` | n/a | yes | +| [coordinates](#input\_coordinates) | position |
object({
x : number
y : number
width : number
height : number
})
| n/a | yes | +| [data\_source](#input\_data\_source) | The custom datasource for widget item |
object({
uid = optional(string, null)
type = optional(string, "prometheus")
})
| n/a | yes | +| [namespace](#input\_namespace) | n/a | `string` | `"default"` | no | +| [period](#input\_period) | stats | `number` | `3` | no | +| [redis\_namespace](#input\_redis\_namespace) | k8s redis namespace name | `string` | n/a | yes | +| [redis\_pod](#input\_redis\_pod) | n/a | `string` | n/a | yes | +| [region](#input\_region) | n/a | `string` | `""` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| [data](#output\_data) | n/a | + diff --git a/modules/dashboard/modules/widgets/redis/restarts/base.tf b/modules/dashboard/modules/widgets/redis/restarts/base.tf new file mode 100644 index 0000000..648627e --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/restarts/base.tf @@ -0,0 +1,24 @@ +module "base" { + source = "../../base" + + name = "Restarts [${var.period}m]" + data_source = var.data_source + coordinates = var.coordinates + stat = "Maximum" + period = var.period + region = var.region + anomaly_detection = var.anomaly_detection + anomaly_deviation = var.anomaly_deviation + + defaults = { + MetricNamespace = "ContainerInsights" + ClusterName = var.cluster + Namespace = var.namespace + PodName = var.redis_pod + accountId = var.account_id + } + + metrics = [ + { label = "Restarts", color = "d62728", expression = "sum(rate(kube_pod_container_status_restarts_total{pod=\"${var.redis_pod}\", namespace=\"${var.redis_namespace}\"}[${var.period}m]))" }, + ] +} diff --git a/modules/dashboard/modules/widgets/redis/restarts/output.tf b/modules/dashboard/modules/widgets/redis/restarts/output.tf new file mode 100644 index 0000000..37309dc --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/restarts/output.tf @@ -0,0 +1,3 @@ +output "data" { + value = module.base.data +} diff --git a/modules/dashboard/modules/widgets/redis/restarts/variables.tf b/modules/dashboard/modules/widgets/redis/restarts/variables.tf new file mode 100644 index 0000000..a8baefb --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/restarts/variables.tf @@ -0,0 +1,63 @@ +variable "data_source" { + type = object({ + uid = optional(string, null) + type = optional(string, "prometheus") + }) + description = "The custom datasource for widget item" +} + +variable "redis_pod" { + type = string +} + +variable "redis_namespace" { + type = string + description = "k8s redis namespace name" +} + +variable "cluster" { + type = string +} + +variable "namespace" { + type = string + default = "default" +} + +variable "account_id" { + type = string + default = null +} + +variable "region" { + type = string + default = "" +} + +# position +variable "coordinates" { + type = object({ + x : number + y : number + width : number + height : number + }) +} + +# stats +variable "period" { + type = number + default = 3 +} + +variable "anomaly_detection" { + type = bool + default = false + description = "Allow to enable anomaly detection on widget metrics" +} + +variable "anomaly_deviation" { + type = number + default = 6 + description = "Deviation of the anomaly band" +} diff --git a/modules/dashboard/modules/widgets/redis/total-commands/README.md b/modules/dashboard/modules/widgets/redis/total-commands/README.md new file mode 100644 index 0000000..2fcbbcf --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/total-commands/README.md @@ -0,0 +1,42 @@ +# cpu + + +## Requirements + +No requirements. + +## Providers + +No providers. + +## Modules + +| Name | Source | Version | +|------|--------|---------| +| [base](#module\_base) | ../../base | n/a | + +## Resources + +No resources. + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [anomaly\_detection](#input\_anomaly\_detection) | Allow to enable anomaly detection on widget metrics | `bool` | `false` | no | +| [anomaly\_deviation](#input\_anomaly\_deviation) | Deviation of the anomaly band | `number` | `6` | no | +| [by\_pod](#input\_by\_pod) | n/a | `bool` | `false` | no | +| [cluster](#input\_cluster) | n/a | `string` | n/a | yes | +| [coordinates](#input\_coordinates) | position |
object({
x : number
y : number
width : number
height : number
})
| n/a | yes | +| [data\_source](#input\_data\_source) | The custom datasource for widget item |
object({
uid = optional(string, null)
type = optional(string, "prometheus")
})
| n/a | yes | +| [namespace](#input\_namespace) | n/a | `string` | `null` | no | +| [period](#input\_period) | stats | `number` | `60` | no | +| [redis\_name](#input\_redis\_name) | Redis service name | `string` | n/a | yes | +| [region](#input\_region) | n/a | `string` | `""` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| [data](#output\_data) | n/a | + diff --git a/modules/dashboard/modules/widgets/redis/total-commands/base.tf b/modules/dashboard/modules/widgets/redis/total-commands/base.tf new file mode 100644 index 0000000..fd4f1ce --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/total-commands/base.tf @@ -0,0 +1,15 @@ +module "base" { + source = "../../base" + + name = "Total Commands [${var.period}m]" + data_source = var.data_source + coordinates = var.coordinates + period = var.period + region = var.region + anomaly_detection = var.anomaly_detection + anomaly_deviation = var.anomaly_deviation + + metrics = [ + { label = "__auto", expression = "sum(rate(redis_commands_total{service=\"${var.redis_name}\", namespace=\"${var.namespace}\"}[${var.period}m])) by (cmd)" }, + ] +} diff --git a/modules/dashboard/modules/widgets/redis/total-commands/output.tf b/modules/dashboard/modules/widgets/redis/total-commands/output.tf new file mode 100644 index 0000000..37309dc --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/total-commands/output.tf @@ -0,0 +1,3 @@ +output "data" { + value = module.base.data +} diff --git a/modules/dashboard/modules/widgets/redis/total-commands/variables.tf b/modules/dashboard/modules/widgets/redis/total-commands/variables.tf new file mode 100644 index 0000000..9c16495 --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/total-commands/variables.tf @@ -0,0 +1,59 @@ +variable "data_source" { + type = object({ + uid = optional(string, null) + type = optional(string, "prometheus") + }) + description = "The custom datasource for widget item" +} + +variable "redis_name" { + type = string + description = "Redis service name" +} + +variable "cluster" { + type = string +} + +variable "namespace" { + type = string + default = null +} + +variable "region" { + type = string + default = "" +} + +# position +variable "coordinates" { + type = object({ + x : number + y : number + width : number + height : number + }) +} + +# stats +variable "period" { + type = number + default = 60 +} + +variable "by_pod" { + type = bool + default = false +} + +variable "anomaly_detection" { + type = bool + default = false + description = "Allow to enable anomaly detection on widget metrics" +} + +variable "anomaly_deviation" { + type = number + default = 6 + description = "Deviation of the anomaly band" +} diff --git a/modules/dashboard/modules/widgets/redis/total-memory/README.md b/modules/dashboard/modules/widgets/redis/total-memory/README.md new file mode 100644 index 0000000..2fcbbcf --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/total-memory/README.md @@ -0,0 +1,42 @@ +# cpu + + +## Requirements + +No requirements. + +## Providers + +No providers. + +## Modules + +| Name | Source | Version | +|------|--------|---------| +| [base](#module\_base) | ../../base | n/a | + +## Resources + +No resources. + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [anomaly\_detection](#input\_anomaly\_detection) | Allow to enable anomaly detection on widget metrics | `bool` | `false` | no | +| [anomaly\_deviation](#input\_anomaly\_deviation) | Deviation of the anomaly band | `number` | `6` | no | +| [by\_pod](#input\_by\_pod) | n/a | `bool` | `false` | no | +| [cluster](#input\_cluster) | n/a | `string` | n/a | yes | +| [coordinates](#input\_coordinates) | position |
object({
x : number
y : number
width : number
height : number
})
| n/a | yes | +| [data\_source](#input\_data\_source) | The custom datasource for widget item |
object({
uid = optional(string, null)
type = optional(string, "prometheus")
})
| n/a | yes | +| [namespace](#input\_namespace) | n/a | `string` | `null` | no | +| [period](#input\_period) | stats | `number` | `60` | no | +| [redis\_name](#input\_redis\_name) | Redis service name | `string` | n/a | yes | +| [region](#input\_region) | n/a | `string` | `""` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| [data](#output\_data) | n/a | + diff --git a/modules/dashboard/modules/widgets/redis/total-memory/base.tf b/modules/dashboard/modules/widgets/redis/total-memory/base.tf new file mode 100644 index 0000000..1ead1f7 --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/total-memory/base.tf @@ -0,0 +1,18 @@ +module "base" { + source = "../../base" + + name = "Total Memory Usage [${var.period}m]" + data_source = var.data_source + coordinates = var.coordinates + period = var.period + region = var.region + anomaly_detection = var.anomaly_detection + anomaly_deviation = var.anomaly_deviation + + unit = "bytes" + + metrics = [ + { label = "Used", color = "007cef", expression = "redis_memory_used_bytes{service=\"${var.redis_name}\", namespace=\"${var.namespace}\"}" }, + { label = "Max", color = "d400bf", expression = "redis_memory_max_bytes{service=\"${var.redis_name}\", namespace=\"${var.namespace}\"}" } + ] +} diff --git a/modules/dashboard/modules/widgets/redis/total-memory/output.tf b/modules/dashboard/modules/widgets/redis/total-memory/output.tf new file mode 100644 index 0000000..37309dc --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/total-memory/output.tf @@ -0,0 +1,3 @@ +output "data" { + value = module.base.data +} diff --git a/modules/dashboard/modules/widgets/redis/total-memory/variables.tf b/modules/dashboard/modules/widgets/redis/total-memory/variables.tf new file mode 100644 index 0000000..9c16495 --- /dev/null +++ b/modules/dashboard/modules/widgets/redis/total-memory/variables.tf @@ -0,0 +1,59 @@ +variable "data_source" { + type = object({ + uid = optional(string, null) + type = optional(string, "prometheus") + }) + description = "The custom datasource for widget item" +} + +variable "redis_name" { + type = string + description = "Redis service name" +} + +variable "cluster" { + type = string +} + +variable "namespace" { + type = string + default = null +} + +variable "region" { + type = string + default = "" +} + +# position +variable "coordinates" { + type = object({ + x : number + y : number + width : number + height : number + }) +} + +# stats +variable "period" { + type = number + default = 60 +} + +variable "by_pod" { + type = bool + default = false +} + +variable "anomaly_detection" { + type = bool + default = false + description = "Allow to enable anomaly detection on widget metrics" +} + +variable "anomaly_deviation" { + type = number + default = 6 + description = "Deviation of the anomaly band" +} diff --git a/modules/dashboard/widgets-pod.tf b/modules/dashboard/widgets-pod.tf index 94b8960..0eabb75 100644 --- a/modules/dashboard/widgets-pod.tf +++ b/modules/dashboard/widgets-pod.tf @@ -19,3 +19,23 @@ module "pod_cpu_widget" { anomaly_detection = each.value.anomaly_detection anomaly_deviation = each.value.anomaly_deviation } + +module "pod_restarts_widget" { + source = "./modules/widgets/pod/restarts" + + for_each = { for index, item in try(local.widget_config["pod/restarts"], []) : index => item } + + data_source = each.value.data_source + coordinates = each.value.coordinates + period = each.value.period + + # pod + pod = each.value.pod + cluster = try(each.value.cluster, null) + namespace = each.value.namespace + + account_id = each.value.account_id + region = each.value.region + anomaly_detection = each.value.anomaly_detection + anomaly_deviation = each.value.anomaly_deviation +} diff --git a/modules/dashboard/widgets-redis.tf b/modules/dashboard/widgets-redis.tf new file mode 100644 index 0000000..5a6e544 --- /dev/null +++ b/modules/dashboard/widgets-redis.tf @@ -0,0 +1,224 @@ +# Redis widgets +module "redis_max_uptime_widget" { + source = "./modules/widgets/redis/max-uptime" + + for_each = { for index, item in try(local.widget_config["redis/max-uptime"], []) : index => item } + + data_source = each.value.data_source + coordinates = each.value.coordinates + period = each.value.period + cluster = each.value.cluster + + redis_name = each.value.redis_name + namespace = try(each.value.namespace, "$namespace") +} + +module "redis_memory_widget" { + source = "./modules/widgets/redis/memory" + + for_each = { for index, item in try(local.widget_config["redis/memory"], []) : index => item } + + data_source = each.value.data_source + coordinates = each.value.coordinates + period = each.value.period + cluster = each.value.cluster + + redis_name = each.value.redis_name + namespace = try(each.value.namespace, "$namespace") +} + +module "redis_total_memory_widget" { + source = "./modules/widgets/redis/total-memory" + + for_each = { for index, item in try(local.widget_config["redis/total-memory"], []) : index => item } + + data_source = each.value.data_source + coordinates = each.value.coordinates + period = each.value.period + cluster = each.value.cluster + + redis_name = each.value.redis_name + namespace = try(each.value.namespace, "$namespace") +} + +module "redis_cpu_widget" { + source = "./modules/widgets/redis/cpu" + + for_each = { for index, item in try(local.widget_config["redis/cpu"], []) : index => item } + + data_source = each.value.data_source + coordinates = each.value.coordinates + period = each.value.period + cluster = each.value.cluster + + redis_name = each.value.redis_name + namespace = try(each.value.namespace, "$namespace") +} + +module "redis_hits_misses_widget" { + source = "./modules/widgets/redis/hits-misses" + + for_each = { for index, item in try(local.widget_config["redis/hits-misses"], []) : index => item } + + data_source = each.value.data_source + coordinates = each.value.coordinates + period = each.value.period + cluster = each.value.cluster + + redis_name = each.value.redis_name + namespace = try(each.value.namespace, "$namespace") +} + +module "redis_restarts_widget" { + source = "./modules/widgets/redis/restarts" + + for_each = { for index, item in try(local.widget_config["redis/restarts"], []) : index => item } + + data_source = each.value.data_source + coordinates = each.value.coordinates + period = each.value.period + cluster = each.value.cluster + + redis_pod = each.value.redis_pod + redis_namespace = each.value.redis_namespace +} + +module "redis_errors_widget" { + source = "./modules/widgets/redis/errors" + + for_each = { for index, item in try(local.widget_config["redis/errors"], []) : index => item } + + data_source = each.value.data_source + coordinates = each.value.coordinates + period = each.value.period + cluster = each.value.cluster + + redis_name = each.value.redis_name + namespace = try(each.value.namespace, "$namespace") +} + +module "redis_clients_widget" { + source = "./modules/widgets/redis/clients" + + for_each = { for index, item in try(local.widget_config["redis/clients"], []) : index => item } + + data_source = each.value.data_source + coordinates = each.value.coordinates + period = each.value.period + cluster = each.value.cluster + + redis_name = each.value.redis_name + namespace = try(each.value.namespace, "$namespace") +} + +module "redis_connections_widget" { + source = "./modules/widgets/redis/connections" + + for_each = { for index, item in try(local.widget_config["redis/connections"], []) : index => item } + + data_source = each.value.data_source + coordinates = each.value.coordinates + period = each.value.period + cluster = each.value.cluster + + redis_name = each.value.redis_name + namespace = try(each.value.namespace, "$namespace") +} + +module "redis_latency_widget" { + source = "./modules/widgets/redis/latency" + + for_each = { for index, item in try(local.widget_config["redis/latency"], []) : index => item } + + data_source = each.value.data_source + coordinates = each.value.coordinates + period = each.value.period + cluster = each.value.cluster + + redis_name = each.value.redis_name + namespace = try(each.value.namespace, "$namespace") +} + +module "redis_network_widget" { + source = "./modules/widgets/redis/network" + + for_each = { for index, item in try(local.widget_config["redis/network"], []) : index => item } + + data_source = each.value.data_source + coordinates = each.value.coordinates + period = each.value.period + cluster = each.value.cluster + + redis_name = each.value.redis_name + namespace = try(each.value.namespace, "$namespace") +} + +module "redis_replicas_widget" { + source = "./modules/widgets/redis/replicas" + + for_each = { for index, item in try(local.widget_config["redis/replicas"], []) : index => item } + + data_source = each.value.data_source + coordinates = each.value.coordinates + period = each.value.period + cluster = each.value.cluster + + redis_name = each.value.redis_name + namespace = try(each.value.namespace, "$namespace") +} + +module "redis_total_commands_widget" { + source = "./modules/widgets/redis/total-commands" + + for_each = { for index, item in try(local.widget_config["redis/total-commands"], []) : index => item } + + data_source = each.value.data_source + coordinates = each.value.coordinates + period = each.value.period + cluster = each.value.cluster + + redis_name = each.value.redis_name + namespace = try(each.value.namespace, "$namespace") +} + +module "redis_keys_widget" { + source = "./modules/widgets/redis/keys" + + for_each = { for index, item in try(local.widget_config["redis/keys"], []) : index => item } + + data_source = each.value.data_source + coordinates = each.value.coordinates + period = each.value.period + cluster = each.value.cluster + + redis_name = each.value.redis_name + namespace = try(each.value.namespace, "$namespace") +} + +module "redis_expired_evicted_keys_widget" { + source = "./modules/widgets/redis/expired-evicted-keys" + + for_each = { for index, item in try(local.widget_config["redis/expired-evicted-keys"], []) : index => item } + + data_source = each.value.data_source + coordinates = each.value.coordinates + period = each.value.period + cluster = each.value.cluster + + redis_name = each.value.redis_name + namespace = try(each.value.namespace, "$namespace") +} + +module "redis_expiring_notexpiring_keys_widget" { + source = "./modules/widgets/redis/expiring-notexpiring-keys" + + for_each = { for index, item in try(local.widget_config["redis/expiring-notexpiring-keys"], []) : index => item } + + data_source = each.value.data_source + coordinates = each.value.coordinates + period = each.value.period + cluster = each.value.cluster + + redis_name = each.value.redis_name + namespace = try(each.value.namespace, "$namespace") +} diff --git a/modules/dashboard/widgets_blocks.tf b/modules/dashboard/widgets_blocks.tf index 1a20c7b..d2e48fe 100644 --- a/modules/dashboard/widgets_blocks.tf +++ b/modules/dashboard/widgets_blocks.tf @@ -32,3 +32,14 @@ module "block_sla" { balancer_name = try(each.value.block.balancer_name, null) } + +module "block_redis" { + source = "./modules/blocks/redis" + + for_each = { for index, item in try(local.blocks_by_type["redis"], []) : index => item } + + redis_name = each.value.block.redis_name + redis_pod = try(each.value.block.redis_pod, "") + redis_namespace = try(each.value.block.redis_namespace, "") + namespace = try(each.value.block.namespace, "$namespace") +}