From 4ca6023584403fc1809312943dcb8258cf16a8dc Mon Sep 17 00:00:00 2001 From: Diego Lagos <92735530+diegolagospagopa@users.noreply.github.com> Date: Thu, 24 Aug 2023 10:48:38 +0200 Subject: [PATCH] feat: Added Grafana-managed (#82) --- src/aks-platform/03_prometheus_managed.tf | 134 +- src/grafana-monitoring/.terraform.lock.hcl | 47 + src/grafana-monitoring/00_azuread.tf | 16 + src/grafana-monitoring/02_grafana_managed.tf | 38 + src/grafana-monitoring/99_locals.tf | 24 + src/grafana-monitoring/99_main.tf | 29 + src/grafana-monitoring/99_variables.tf | 120 + src/grafana-monitoring/README.md | 55 + src/grafana-monitoring/dash/jmx-exporter.json | 1930 +++++++++++++++++ src/grafana-monitoring/env/dev01/backend.ini | 1 + .../env/dev01/backend.tfvars | 4 + .../env/dev01/terraform.tfvars | 35 + src/grafana-monitoring/terraform.sh | 38 + 13 files changed, 2393 insertions(+), 78 deletions(-) create mode 100644 src/grafana-monitoring/.terraform.lock.hcl create mode 100644 src/grafana-monitoring/00_azuread.tf create mode 100644 src/grafana-monitoring/02_grafana_managed.tf create mode 100644 src/grafana-monitoring/99_locals.tf create mode 100644 src/grafana-monitoring/99_main.tf create mode 100644 src/grafana-monitoring/99_variables.tf create mode 100644 src/grafana-monitoring/README.md create mode 100644 src/grafana-monitoring/dash/jmx-exporter.json create mode 100644 src/grafana-monitoring/env/dev01/backend.ini create mode 100644 src/grafana-monitoring/env/dev01/backend.tfvars create mode 100644 src/grafana-monitoring/env/dev01/terraform.tfvars create mode 100755 src/grafana-monitoring/terraform.sh diff --git a/src/aks-platform/03_prometheus_managed.tf b/src/aks-platform/03_prometheus_managed.tf index 70fc9a24..dc739351 100644 --- a/src/aks-platform/03_prometheus_managed.tf +++ b/src/aks-platform/03_prometheus_managed.tf @@ -1,80 +1,58 @@ -resource "azurerm_monitor_workspace" "prometheus_amw" { - name = local.monitor_log_analytics_workspace_prometheus_name - location = azurerm_resource_group.rg_aks.location - resource_group_name = azurerm_resource_group.rg_aks.name +# resource "azurerm_monitor_workspace" "prometheus_amw" { +# name = local.monitor_log_analytics_workspace_prometheus_name +# location = azurerm_resource_group.rg_aks.location +# resource_group_name = azurerm_resource_group.rg_aks.name + +# tags = var.tags +# } + +# resource "azurerm_monitor_data_collection_endpoint" "prometheus_dce" { +# name = "${local.project}-prometheus-dce" +# location = azurerm_resource_group.rg_aks.location +# resource_group_name = azurerm_resource_group.rg_aks.name +# kind = "Linux" +# } + +# resource "azurerm_monitor_data_collection_rule" "prometheus_dcr" { +# name = "${local.project}-prometheus-dcr" +# location = azurerm_resource_group.rg_aks.location +# resource_group_name = azurerm_resource_group.rg_aks.name +# data_collection_endpoint_id = azurerm_monitor_data_collection_endpoint.prometheus_dce.id +# kind = "Linux" + +# destinations { +# monitor_account { +# monitor_account_id = azurerm_monitor_workspace.prometheus_amw.id +# name = "monitoring_account_prometheus" +# } +# } + +# data_flow { +# streams = ["Microsoft-PrometheusMetrics"] +# destinations = ["monitoring_account_prometheus"] +# } + +# data_sources { +# prometheus_forwarder { +# streams = ["Microsoft-PrometheusMetrics"] +# name = "PrometheusDataSource" +# } +# } + +# description = "DCR for Azure Monitor Metrics Profile (Managed Prometheus)" +# depends_on = [ +# azurerm_monitor_data_collection_endpoint.prometheus_dce, +# ] +# } + +# resource "azurerm_monitor_data_collection_rule_association" "dcra" { +# name = "${local.project}-prometheus-dcra" +# target_resource_id = module.aks[0].id +# data_collection_rule_id = azurerm_monitor_data_collection_rule.prometheus_dcr.id +# description = "Association of data collection rule. Deleting this association will break the data collection for this AKS Cluster." +# depends_on = [ +# azurerm_monitor_data_collection_rule.prometheus_dcr +# ] +# } - tags = var.tags -} -resource "azurerm_monitor_data_collection_endpoint" "prometheus_dce" { - name = "${local.project}-prometheus-dce" - location = azurerm_resource_group.rg_aks.location - resource_group_name = azurerm_resource_group.rg_aks.name - kind = "Linux" -} - -resource "azurerm_monitor_data_collection_rule" "prometheus_dcr" { - name = "${local.project}-prometheus-dcr" - location = azurerm_resource_group.rg_aks.location - resource_group_name = azurerm_resource_group.rg_aks.name - data_collection_endpoint_id = azurerm_monitor_data_collection_endpoint.prometheus_dce.id - kind = "Linux" - - destinations { - monitor_account { - monitor_account_id = azurerm_monitor_workspace.prometheus_amw.id - name = "monitoring_account_prometheus" - } - } - - data_flow { - streams = ["Microsoft-PrometheusMetrics"] - destinations = ["monitoring_account_prometheus"] - } - - data_sources { - prometheus_forwarder { - streams = ["Microsoft-PrometheusMetrics"] - name = "PrometheusDataSource" - } - } - - description = "DCR for Azure Monitor Metrics Profile (Managed Prometheus)" - depends_on = [ - azurerm_monitor_data_collection_endpoint.prometheus_dce, - ] -} - -resource "azurerm_monitor_data_collection_rule_association" "dcra" { - name = "${local.project}-prometheus-dcra" - target_resource_id = module.aks[0].id - data_collection_rule_id = azurerm_monitor_data_collection_rule.prometheus_dcr.id - description = "Association of data collection rule. Deleting this association will break the data collection for this AKS Cluster." - depends_on = [ - azurerm_monitor_data_collection_rule.prometheus_dcr - ] -} - -# -# Enable prometheus monitoring for AKS cluster -# -resource "null_resource" "enable_prometheus_monitoring" { - triggers = { - AKS_NAME = module.aks[0].name - AKS_RESOURCE_GROUP = azurerm_resource_group.rg_aks.name - AMW_ID = azurerm_monitor_workspace.prometheus_amw.id - } - - depends_on = [ - module.aks[0] - ] - - provisioner "local-exec" { - command = < +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >=1.0.0 | +| [azuread](#requirement\_azuread) | = 2.10.0 | +| [azurerm](#requirement\_azurerm) | = 3.25.0 | + +## Modules + +No modules. + +## Resources + +| Name | Type | +|------|------| +| [azurerm_dashboard_grafana.grafana_dashboard](https://registry.terraform.io/providers/hashicorp/azurerm/3.25.0/docs/resources/dashboard_grafana) | resource | +| [azurerm_resource_group.grafana_rg](https://registry.terraform.io/providers/hashicorp/azurerm/3.25.0/docs/resources/resource_group) | resource | +| [azurerm_role_assignment.grafana_dashboard_monitoring_reader](https://registry.terraform.io/providers/hashicorp/azurerm/3.25.0/docs/resources/role_assignment) | resource | +| [azuread_group.adgroup_admin](https://registry.terraform.io/providers/hashicorp/azuread/2.10.0/docs/data-sources/group) | data source | +| [azuread_group.adgroup_developers](https://registry.terraform.io/providers/hashicorp/azuread/2.10.0/docs/data-sources/group) | data source | +| [azuread_group.adgroup_externals](https://registry.terraform.io/providers/hashicorp/azuread/2.10.0/docs/data-sources/group) | data source | +| [azuread_group.adgroup_security](https://registry.terraform.io/providers/hashicorp/azuread/2.10.0/docs/data-sources/group) | data source | +| [azurerm_client_config.current](https://registry.terraform.io/providers/hashicorp/azurerm/3.25.0/docs/data-sources/client_config) | data source | +| [azurerm_subscription.current](https://registry.terraform.io/providers/hashicorp/azurerm/3.25.0/docs/data-sources/subscription) | data source | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [apim\_dns\_zone\_prefix](#input\_apim\_dns\_zone\_prefix) | The dns subdomain for apim. | `string` | `null` | no | +| [dns\_zone\_internal\_prefix](#input\_dns\_zone\_internal\_prefix) | The dns subdomain. | `string` | `null` | no | +| [domain](#input\_domain) | n/a | `string` | n/a | yes | +| [env](#input\_env) | n/a | `string` | n/a | yes | +| [env\_short](#input\_env\_short) | n/a | `string` | n/a | yes | +| [external\_domain](#input\_external\_domain) | Domain for delegation | `string` | `null` | no | +| [instance](#input\_instance) | One of beta, prod01, prod02 | `string` | n/a | yes | +| [k8s\_kube\_config\_path\_prefix](#input\_k8s\_kube\_config\_path\_prefix) | n/a | `string` | `"~/.kube"` | no | +| [location](#input\_location) | One of westeurope, northeurope | `string` | n/a | yes | +| [location\_short](#input\_location\_short) | One of wue, neu | `string` | n/a | yes | +| [location\_string](#input\_location\_string) | One of West Europe, North Europe | `string` | n/a | yes | +| [log\_analytics\_workspace\_name](#input\_log\_analytics\_workspace\_name) | Specifies the name of the Log Analytics Workspace. | `string` | n/a | yes | +| [log\_analytics\_workspace\_resource\_group\_name](#input\_log\_analytics\_workspace\_resource\_group\_name) | The name of the resource group in which the Log Analytics workspace is located in. | `string` | n/a | yes | +| [monitor\_resource\_group\_name](#input\_monitor\_resource\_group\_name) | Monitor resource group name | `string` | n/a | yes | +| [prefix](#input\_prefix) | n/a | `string` | n/a | yes | +| [tags](#input\_tags) | n/a | `map(any)` |
{
"CreatedBy": "Terraform"
}
| no | +| [tls\_cert\_check\_helm](#input\_tls\_cert\_check\_helm) | tls cert helm chart configuration |
object({
chart_version = string,
image_name = string,
image_tag = string
})
| n/a | yes | + +## Outputs + +No outputs. + diff --git a/src/grafana-monitoring/dash/jmx-exporter.json b/src/grafana-monitoring/dash/jmx-exporter.json new file mode 100644 index 00000000..bf3f90be --- /dev/null +++ b/src/grafana-monitoring/dash/jmx-exporter.json @@ -0,0 +1,1930 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "target": { + "limit": 100, + "matchAny": false, + "tags": [], + "type": "dashboard" + }, + "type": "dashboard" + } + ] + }, + "description": "Complete dashboard using metrics from prometheus JMX exporter, with drill down per service > pod", + "editable": true, + "fiscalYearStartMonth": 0, + "gnetId": 7727, + "graphTooltip": 0, + "id": 91, + "links": [], + "liveNow": false, + "panels": [ + { + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [ + { + "options": { + "match": "null", + "result": { + "text": "N/A" + } + }, + "type": "special" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "#299c46", + "value": null + }, + { + "color": "rgba(237, 129, 40, 0.89)", + "value": 50 + }, + { + "color": "#d44a3a", + "value": 75 + } + ] + }, + "unit": "percent" + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 6, + "x": 0, + "y": 0 + }, + "id": 13, + "links": [], + "maxDataPoints": 100, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "mean" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "9.4.12", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "expr": "(sum(jvm_memory_bytes_used{area=\"heap\",service=\"$service\",pod=\"$pod\"})*100) / sum(jvm_memory_bytes_max{area=\"heap\",service=\"$service\",pod=\"$pod\"})", + "format": "time_series", + "intervalFactor": 1, + "refId": "A" + } + ], + "title": "Heap used", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [ + { + "options": { + "match": "null", + "result": { + "text": "N/A" + } + }, + "type": "special" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "#299c46", + "value": null + }, + { + "color": "rgba(237, 129, 40, 0.89)", + "value": 35 + }, + { + "color": "#d44a3a", + "value": 50 + } + ] + }, + "unit": "dateTimeAsUS" + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 6, + "x": 6, + "y": 0 + }, + "id": 15, + "links": [], + "maxDataPoints": 100, + "options": { + "colorMode": "none", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "9.4.12", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "expr": "avg(process_start_time_seconds{service=\"$service\"})*1000", + "format": "time_series", + "intervalFactor": 1, + "refId": "A" + } + ], + "title": "Start time", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "decimals": 0, + "mappings": [ + { + "options": { + "match": "null", + "result": { + "text": "N/A" + } + }, + "type": "special" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "#299c46", + "value": null + }, + { + "color": "rgba(237, 129, 40, 0.89)", + "value": 35 + }, + { + "color": "#d44a3a", + "value": 50 + } + ] + }, + "unit": "s" + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 6, + "x": 12, + "y": 0 + }, + "id": 14, + "links": [], + "maxDataPoints": 100, + "options": { + "colorMode": "none", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "9.4.12", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "expr": "time() - max(process_start_time_seconds{service=\"$service\"})", + "format": "time_series", + "intervalFactor": 1, + "refId": "A" + } + ], + "title": "Uptime", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "decimals": 0, + "mappings": [ + { + "options": { + "match": "null", + "result": { + "text": "N/A" + } + }, + "type": "special" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "#299c46", + "value": null + }, + { + "color": "rgba(237, 129, 40, 0.89)", + "value": 35 + }, + { + "color": "#d44a3a", + "value": 50 + } + ] + }, + "unit": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 6, + "x": 18, + "y": 0 + }, + "id": 19, + "links": [], + "maxDataPoints": 100, + "options": { + "colorMode": "none", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/^version$/", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "9.4.12", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "expr": "jvm_info{}", + "format": "table", + "instant": true, + "intervalFactor": 1, + "legendFormat": "", + "refId": "A" + } + ], + "title": "JVM Version", + "type": "stat" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "fieldConfig": { + "defaults": { + "links": [] + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 24, + "x": 0, + "y": 4 + }, + "hiddenSeries": false, + "id": 2, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": true, + "rightSide": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "9.4.12", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "/Throttle/", + "yaxis": 2 + } + ], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "editorMode": "code", + "expr": "sum by (namespace,pod) (rate(container_cpu_usage_seconds_total{pod=~\"$pod\",namespace=\"$namespace\"}[1m]))", + "legendFormat": "CPU Cores Usage {{pod}}", + "range": true, + "refId": "B" + }, + { + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "editorMode": "code", + "expr": "sum by (namespace,pod) ((container_cpu_cfs_throttled_periods_total{pod=~\"$pod\",namespace=\"$namespace\"} / container_cpu_cfs_periods_total{pod=~\"$pod\",namespace=\"$namespace\"}) * 100)", + "legendFormat": "Throttle Percent {{pod}}", + "range": true, + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "CPU Usage vs Throttling Percent", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "$$hashKey": "object:216", + "format": "short", + "label": "cpu cores", + "logBase": 1, + "show": true + }, + { + "$$hashKey": "object:217", + "format": "percent", + "label": "throttling percent", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 10, + "w": 12, + "x": 0, + "y": 12 + }, + "hiddenSeries": false, + "id": 8, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": true, + "rightSide": false, + "show": true, + "sort": "current", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "9.4.12", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "expr": "jvm_memory_bytes_used{area=\"heap\",service=\"$service\",pod=~\"$pod\"}", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "Used {{pod}}", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "expr": " jvm_memory_bytes_max{area=\"heap\",service=\"$service\",pod=~\"$pod\"}", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "Max {{pod}}", + "refId": "B" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Heap", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "bytes", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 10, + "w": 12, + "x": 12, + "y": 12 + }, + "hiddenSeries": false, + "id": 18, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": true, + "rightSide": false, + "show": true, + "sort": "current", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "9.4.12", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "expr": "jvm_memory_bytes_used{area=\"nonheap\",service=\"$service\",pod=~\"$pod\"}", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "Used {{pod}}", + "refId": "A" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Non Heap", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "bytes", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 8, + "x": 0, + "y": 22 + }, + "hiddenSeries": false, + "id": 2, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": true, + "rightSide": false, + "show": true, + "sort": "current", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "9.4.12", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "expr": "jvm_memory_pool_bytes_max{service=\"$service\", pool=\"G1 Eden Space\",pod=~\"$pod\"}", + "format": "time_series", + "interval": "", + "intervalFactor": 5, + "legendFormat": "Max {{pod}}", + "metric": "jvm_memory_bytes_used", + "refId": "B", + "step": 5 + }, + { + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "expr": "jvm_memory_pool_bytes_used{service=\"$service\", pool=\"G1 Eden Space\",pod=~\"$pod\"}", + "format": "time_series", + "interval": "", + "intervalFactor": 5, + "legendFormat": "Used {{pod}}", + "metric": "jvm_memory_bytes_used", + "refId": "A", + "step": 5 + }, + { + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "expr": "jvm_memory_pool_bytes_committed{service=\"$service\", pool=\"G1 Eden Space\",pod=~\"$pod\"}", + "format": "time_series", + "interval": "", + "intervalFactor": 5, + "legendFormat": "Committed {{pod}}", + "metric": "jvm_memory_bytes_used", + "refId": "C", + "step": 5 + } + ], + "thresholds": [], + "timeRegions": [], + "title": "G1 Eden Space", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "bytes", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 8, + "x": 8, + "y": 22 + }, + "hiddenSeries": false, + "id": 16, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": true, + "rightSide": false, + "show": true, + "sort": "current", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "9.4.12", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "editorMode": "code", + "expr": "jvm_memory_pool_bytes_max{service=\"$service\",pod=~\"$pod\"}", + "format": "time_series", + "interval": "", + "intervalFactor": 5, + "legendFormat": "__auto", + "metric": "jvm_memory_bytes_used", + "range": true, + "refId": "B", + "step": 5 + }, + { + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "expr": "jvm_memory_pool_bytes_used{service=\"$service\", pool=\"G1 Old Gen\",pod=~\"$pod\"}", + "format": "time_series", + "interval": "", + "intervalFactor": 5, + "legendFormat": "Used {{pod}}", + "metric": "jvm_memory_bytes_used", + "refId": "A", + "step": 5 + }, + { + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "expr": "jvm_memory_pool_bytes_committed{service=\"$service\", pool=\"G1 Old Gen\",pod=~\"$pod\"}", + "format": "time_series", + "interval": "", + "intervalFactor": 5, + "legendFormat": "Committed {{pod}}", + "metric": "jvm_memory_bytes_used", + "refId": "C", + "step": 5 + } + ], + "thresholds": [], + "timeRegions": [], + "title": "G1 Old Gen", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "bytes", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 8, + "x": 16, + "y": 22 + }, + "hiddenSeries": false, + "id": 7, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": true, + "rightSide": false, + "show": true, + "sort": "current", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "9.4.12", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "expr": "jvm_memory_pool_bytes_max{service=\"$service\", pool=\"G1 Survivor Space\",pod=~\"$pod\"}", + "format": "time_series", + "interval": "", + "intervalFactor": 5, + "legendFormat": "Max {{pod}}", + "metric": "jvm_memory_bytes_used", + "refId": "B", + "step": 5 + }, + { + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "expr": "jvm_memory_pool_bytes_used{service=\"$service\", pool=\"G1 Survivor Space\",pod=~\"$pod\"}", + "format": "time_series", + "interval": "", + "intervalFactor": 5, + "legendFormat": "Used {{pod}}", + "metric": "jvm_memory_bytes_used", + "refId": "A", + "step": 5 + }, + { + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "expr": "jvm_memory_pool_bytes_committed{service=\"$service\", pool=\"G1 Survivor Space\",pod=~\"$pod\"}", + "format": "time_series", + "interval": "", + "intervalFactor": 5, + "legendFormat": "Committed {{pod}}", + "metric": "jvm_memory_bytes_used", + "refId": "C", + "step": 5 + } + ], + "thresholds": [], + "timeRegions": [], + "title": "G1 Survivor Space", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "bytes", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 8, + "x": 0, + "y": 30 + }, + "hiddenSeries": false, + "id": 9, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": true, + "rightSide": false, + "show": true, + "sort": "current", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "9.4.12", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "expr": "jvm_memory_pool_bytes_max{service=\"$service\", pool=\"Metaspace\",pod=~\"$pod\"}", + "format": "time_series", + "interval": "", + "intervalFactor": 5, + "legendFormat": "Max {{pod}}", + "metric": "jvm_memory_bytes_used", + "refId": "B", + "step": 5 + }, + { + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "expr": "jvm_memory_pool_bytes_used{service=\"$service\", pool=\"Metaspace\",pod=~\"$pod\"}", + "format": "time_series", + "interval": "", + "intervalFactor": 5, + "legendFormat": "Used {{pod}}", + "metric": "jvm_memory_bytes_used", + "refId": "A", + "step": 5 + }, + { + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "expr": "jvm_memory_pool_bytes_committed{service=\"$service\", pool=\"Metaspace\",pod=~\"$pod\"}", + "format": "time_series", + "interval": "", + "intervalFactor": 5, + "legendFormat": "Committed {{pod}}", + "metric": "jvm_memory_bytes_used", + "refId": "C", + "step": 5 + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Metaspace", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "bytes", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 8, + "x": 8, + "y": 30 + }, + "hiddenSeries": false, + "id": 11, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": true, + "rightSide": false, + "show": true, + "sort": "current", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "9.4.12", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "expr": "jvm_memory_pool_bytes_max{service=\"$service\", pool=\"Compressed Class Space\",pod=~\"$pod\"}", + "format": "time_series", + "interval": "", + "intervalFactor": 5, + "legendFormat": "Max {{pod}}", + "metric": "jvm_memory_bytes_used", + "refId": "B", + "step": 5 + }, + { + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "expr": "jvm_memory_pool_bytes_used{service=\"$service\", pool=\"Compressed Class Space\",pod=~\"$pod\"}", + "format": "time_series", + "interval": "", + "intervalFactor": 5, + "legendFormat": "Used {{pod}}", + "metric": "jvm_memory_bytes_used", + "refId": "A", + "step": 5 + }, + { + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "expr": "jvm_memory_pool_bytes_committed{service=\"$service\", pool=\"Compressed Class Space\",pod=~\"$pod\"}", + "format": "time_series", + "interval": "", + "intervalFactor": 5, + "legendFormat": "Committed {{pod}}", + "metric": "jvm_memory_bytes_used", + "refId": "C", + "step": 5 + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Compressed Class Space", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "bytes", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 8, + "x": 16, + "y": 30 + }, + "hiddenSeries": false, + "id": 10, + "legend": { + "alignAsTable": true, + "avg": true, + "current": true, + "max": true, + "min": true, + "rightSide": false, + "show": true, + "sort": "current", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "9.4.12", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "expr": "jvm_memory_pool_bytes_max{service=\"$service\", pool=\"Code Cache\",pod=~\"$pod\"}", + "format": "time_series", + "interval": "", + "intervalFactor": 5, + "legendFormat": "Max {{pod}}", + "metric": "jvm_memory_bytes_used", + "refId": "B", + "step": 5 + }, + { + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "expr": "jvm_memory_pool_bytes_used{service=\"$service\", pool=\"Code Cache\",pod=~\"$pod\"}", + "format": "time_series", + "interval": "", + "intervalFactor": 5, + "legendFormat": "Used {{pod}}", + "metric": "jvm_memory_bytes_used", + "refId": "A", + "step": 5 + }, + { + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "expr": "jvm_memory_pool_bytes_committed{service=\"$service\", pool=\"Code Cache\",pod=~\"$pod\"}", + "format": "time_series", + "interval": "", + "intervalFactor": 5, + "legendFormat": "Committed {{pod}}", + "metric": "jvm_memory_bytes_used", + "refId": "C", + "step": 5 + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Code Cache", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "bytes", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 38 + }, + "hiddenSeries": false, + "id": 3, + "legend": { + "alignAsTable": true, + "avg": false, + "current": true, + "max": true, + "min": false, + "rightSide": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "9.4.12", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "expr": "jvm_threads_current{service=~\"$service\",pod=~\"$pod\"}", + "format": "time_series", + "intervalFactor": 5, + "legendFormat": "JVM current threads {{pod}}", + "metric": "jvm_threads_current", + "refId": "A", + "step": 10 + }, + { + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "expr": "jvm_threads_daemon{service=~\"$service\",pod=~\"$pod\"}", + "format": "time_series", + "intervalFactor": 5, + "legendFormat": "JVM daemon threads {{pod}}", + "metric": "jvm_threads_daemon", + "refId": "B", + "step": 10 + }, + { + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "expr": "jvm_threads_deadlocked{service=~\"$service\",pod=~\"$pod\"}", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "JVM deadlocked threads {{pod}}", + "refId": "C" + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Threads used", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "decimals": 0, + "format": "short", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 38 + }, + "hiddenSeries": false, + "id": 6, + "legend": { + "alignAsTable": true, + "avg": false, + "current": true, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "9.4.12", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "expr": "jvm_gc_collection_seconds_count{service=~\"$service\",pod=~\"$pod\"}", + "format": "time_series", + "interval": "", + "intervalFactor": 5, + "legendFormat": "{{gc}} {{pod}}", + "metric": "", + "refId": "A", + "step": 10 + } + ], + "thresholds": [], + "timeRegions": [], + "title": "GC count", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "decimals": 0, + "format": "short", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 46 + }, + "hiddenSeries": false, + "id": 5, + "legend": { + "alignAsTable": true, + "avg": false, + "current": true, + "max": true, + "min": true, + "rightSide": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "9.4.12", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "expr": "rate(jvm_gc_collection_seconds_sum{service=~\"$service\",pod=~\"$pod\"}[5m])", + "format": "time_series", + "interval": "", + "intervalFactor": 5, + "legendFormat": "{{gc}} {{pod}}", + "metric": "jvm_gc_collection_seconds_sum", + "refId": "A", + "step": 10 + } + ], + "thresholds": [], + "timeRegions": [], + "title": "GC time / 1 min. rate", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "s", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 46 + }, + "hiddenSeries": false, + "id": 4, + "legend": { + "alignAsTable": true, + "avg": false, + "current": true, + "max": true, + "min": true, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "9.4.12", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "expr": "jvm_classes_loaded{service=~\"$service\",pod=~\"$pod\"}", + "format": "time_series", + "interval": "", + "intervalFactor": 5, + "legendFormat": "loaded {{pod}}", + "metric": "jvm_classes_loaded", + "refId": "A", + "step": 10 + } + ], + "thresholds": [], + "timeRegions": [], + "title": "Class loading", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "mode": "time", + "show": true, + "values": [] + }, + "yaxes": [ + { + "decimals": 0, + "format": "short", + "label": "", + "logBase": 1, + "show": true + }, + { + "format": "short", + "logBase": 1, + "show": true + } + ], + "yaxis": { + "align": false + } + } + ], + "refresh": "30s", + "revision": 1, + "schemaVersion": 38, + "style": "dark", + "tags": [ + "JVM" + ], + "templating": { + "list": [ + { + "allValue": "", + "current": { + "selected": false, + "text": "pagopapagopareceiptpdfdatastore-microservice-chart", + "value": "pagopapagopareceiptpdfdatastore-microservice-chart" + }, + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "definition": "", + "hide": 0, + "includeAll": false, + "label": "service", + "multi": false, + "name": "service", + "options": [], + "query": { + "query": "label_values(service)", + "refId": "Prometheus-service-Variable-Query" + }, + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "tagValuesQuery": "", + "tagsQuery": "", + "type": "query", + "useTags": false + }, + { + "allValue": ".*", + "current": { + "selected": false, + "text": "All", + "value": "$__all" + }, + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "definition": "", + "hide": 0, + "includeAll": true, + "label": "pod", + "multi": false, + "name": "pod", + "options": [], + "query": { + "query": "label_values(jvm_info{service=\"$service\"},pod)", + "refId": "Prometheus-pod-Variable-Query" + }, + "refresh": 1, + "regex": "/.*(?!-).*/", + "skipUrlSync": false, + "sort": 0, + "type": "query", + "useTags": false + }, + { + "allValue": ".*", + "current": { + "selected": false, + "text": "receipts", + "value": "receipts" + }, + "datasource": { + "type": "prometheus", + "uid": "4QStEOoVk" + }, + "definition": "", + "hide": 0, + "includeAll": true, + "label": "namespace", + "multi": false, + "name": "namespace", + "options": [], + "query": { + "query": "label_values(jvm_info{service=\"$service\"},namespace)", + "refId": "Prometheus-namespace-Variable-Query" + }, + "refresh": 1, + "regex": "/.*(?!-).*/", + "skipUrlSync": false, + "sort": 0, + "type": "query", + "useTags": false + } + ] + }, + "time": { + "from": "2023-07-25T07:40:16.830Z", + "to": "2023-07-25T23:40:16.830Z" + }, + "timepicker": { + "refresh_intervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ], + "time_options": [ + "5m", + "15m", + "1h", + "6h", + "12h", + "24h", + "2d", + "7d", + "30d" + ] + }, + "timezone": "", + "title": "JMX prometheus exporter", + "uid": "nshAi8pmz", + "version": 21, + "weekStart": "" +} diff --git a/src/grafana-monitoring/env/dev01/backend.ini b/src/grafana-monitoring/env/dev01/backend.ini new file mode 100644 index 00000000..a0170211 --- /dev/null +++ b/src/grafana-monitoring/env/dev01/backend.ini @@ -0,0 +1 @@ +subscription=devopslab diff --git a/src/grafana-monitoring/env/dev01/backend.tfvars b/src/grafana-monitoring/env/dev01/backend.tfvars new file mode 100644 index 00000000..f7b99f4a --- /dev/null +++ b/src/grafana-monitoring/env/dev01/backend.tfvars @@ -0,0 +1,4 @@ +resource_group_name = "terraform-state-rg" +storage_account_name = "tfinfdevopslab" +container_name = "terraform-state" +key = "grafana.terraform.tfstate" diff --git a/src/grafana-monitoring/env/dev01/terraform.tfvars b/src/grafana-monitoring/env/dev01/terraform.tfvars new file mode 100644 index 00000000..7c0fe617 --- /dev/null +++ b/src/grafana-monitoring/env/dev01/terraform.tfvars @@ -0,0 +1,35 @@ +prefix = "dvopla" +env_short = "d" +env = "dev" +domain = "grafana" +location = "northeurope" +location_short = "neu" +location_string = "North Europe" +instance = "dev" + +tags = { + CreatedBy = "Terraform" + Environment = "Dev" + Owner = "PagoPa" + Source = "https://github.com/pagopa/cstar-infrastructure/tree/main/src/grafana-monitoring" + CostCenter = "TS310 - PAGAMENTI & SERVIZI" +} + +### External resources + +monitor_resource_group_name = "dvopla-d-monitor-rg" +log_analytics_workspace_name = "dvopla-d-law" +log_analytics_workspace_resource_group_name = "dvopla-d-monitor-rg" + +external_domain = "pagopa.it" +dns_zone_internal_prefix = "internal.devopslab" +apim_dns_zone_prefix = "dev.cstar" + +# chart releases: https://github.com/pagopa/aks-microservice-chart-blueprint/releases +# image tags: https://github.com/pagopa/infra-ssl-check/releases +tls_cert_check_helm = { + chart_version = "1.21.0" + image_name = "ghcr.io/pagopa/infra-ssl-check" + image_tag = "v1.2.2@sha256:22f4b53177cc8891bf10cbd0deb39f60e1cd12877021c3048a01e7738f63e0f9" +} + diff --git a/src/grafana-monitoring/terraform.sh b/src/grafana-monitoring/terraform.sh new file mode 100755 index 00000000..c1945565 --- /dev/null +++ b/src/grafana-monitoring/terraform.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +set -e + +action=$1 +env=$2 +shift 2 +other=$@ + +if [ -z "$action" ]; then + echo "Missed action: init, apply, plan" + exit 0 +fi + +if [ -z "$env" ]; then + echo "env should be: dev, uat or prod." + exit 0 +fi + +source "./env/$env/backend.ini" +az account set -s "${subscription}" + +if echo "init plan apply refresh import output state taint destroy" | grep -w $action > /dev/null; then + if [ $action = "init" ]; then + terraform $action -reconfigure -backend-config="./env/$env/backend.tfvars" $other + elif [ $action = "output" ] || [ $action = "state" ] || [ $action = "taint" ]; then + # init terraform backend + terraform init -reconfigure -backend-config="./env/$env/backend.tfvars" + terraform $action $other + else + # init terraform backend + terraform init -reconfigure -backend-config="./env/$env/backend.tfvars" + terraform $action -var-file="./env/$env/terraform.tfvars" $other + fi +else + echo "Action not allowed." + exit 1 +fi