Move all dashboards to GitOps (#175)

* Typo

* Remove Grafana provider

* Temp: move dashbaords to gitOps

* Move external labels to resource attributes

* Avoid DDoS with using 0.0.0.0

* Pre-commit

* Transition in two steps

Will need to remove provider in a separate version to provide a transition path as removing this will break terraform and leave orphans in the state

* Move patterns' dashboards creation to gitOps

Standardize config objects for patterns as well

* Pre-commit

* Create AMP dashboard from external source with Grafana provider

* Fix deprecated option

* Fix Flux requirements

* Run pre-commit

* Update example with operator

* Cleanup examples

* Update multicluster example

* Update multicluster example

* Drop dead variable

* Update docs

* Change GitOps branch name

* Update docs

* Replacing Secrets Manager to SSM to store Grafana API Key (#178)

* Fixing SSM

* Fixing SSM

* Replacing Secrets Manager with SSM

* Replacing Secrets Manager with SSM

* Update architecture diagram

* Update architecture diagram

* Update README.md

* Update index.md

* Fixing Grafana Operator Version

* Fix multicluster example

* Update docs

---------

Co-authored-by: Ela AWS <51791117+elamaran11@users.noreply.github.com>
Co-authored-by: Elamaran Shanmugam <elamaran.shan@gmail.com>
This commit is contained in:
Rodrigue Koffi
2023-06-12 18:00:42 +02:00
committed by GitHub
parent c5e4c0c718
commit fa38a90efc
46 changed files with 363 additions and 4462 deletions
@@ -1,795 +0,0 @@
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- 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": "Dashboard for Amazon Managed Prometheus",
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": 51,
"iteration": 1666292684202,
"links": [],
"liveNow": false,
"panels": [
{
"gridPos": {
"h": 7,
"w": 5,
"x": 0,
"y": 0
},
"id": 16,
"options": {
"content": "# Ingestion Usage Metrics\n\nMetrics relating to ingestion usage of the AMP service",
"mode": "markdown"
},
"pluginVersion": "8.4.7",
"title": "Usage",
"type": "text"
},
{
"datasource": {
"type": "cloudwatch",
"uid": "$datasource"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 7,
"w": 9,
"x": 5,
"y": 0
},
"id": 6,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"alias": "",
"datasource": {
"type": "cloudwatch",
"uid": "$datasource"
},
"dimensions": {},
"expression": "SELECT SUM(ResourceCount) FROM SCHEMA(\"AWS/Usage\", Class,Resource,ResourceId,Service,Type) WHERE Type = 'Resource' AND ResourceId = '$WorkspaceID' AND Resource = 'ActiveSeries' AND Service = 'Prometheus' AND Class = 'None'",
"id": "",
"matchExact": true,
"metricEditorMode": 1,
"metricName": "",
"metricQueryType": 0,
"namespace": "",
"period": "",
"queryMode": "Metrics",
"refId": "A",
"region": "default",
"sqlExpression": "",
"statistic": "Average"
}
],
"title": "Active Series Metrics",
"type": "timeseries"
},
{
"datasource": {
"type": "cloudwatch",
"uid": "$datasource"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 7,
"w": 9,
"x": 14,
"y": 0
},
"id": 2,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"alias": "",
"datasource": {
"type": "cloudwatch",
"uid": "$datasource"
},
"dimensions": {},
"expression": "SELECT AVG(ResourceCount) FROM SCHEMA(\"AWS/Usage\", Class,Resource,ResourceId,Service,Type) WHERE Type = 'Resource' AND ResourceId = '$WorkspaceID' AND Resource = 'IngestionRate' AND Service = 'Prometheus' AND Class = 'None'",
"id": "",
"matchExact": true,
"metricEditorMode": 1,
"metricName": "",
"metricQueryType": 0,
"namespace": "",
"period": "",
"queryMode": "Metrics",
"refId": "A",
"region": "default",
"sqlExpression": "",
"statistic": "Average"
}
],
"title": "Workspace Ingestion Rate",
"type": "timeseries"
},
{
"gridPos": {
"h": 8,
"w": 5,
"x": 0,
"y": 7
},
"id": 22,
"options": {
"content": "# Billing\n\nContains information relating to the cost of AMP\n\n",
"mode": "markdown"
},
"pluginVersion": "8.4.7",
"title": "Billing",
"type": "text"
},
{
"datasource": {
"type": "cloudwatch",
"uid": "$datasource"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 18,
"x": 5,
"y": 7
},
"id": 24,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"alias": "",
"datasource": {
"type": "cloudwatch",
"uid": "$datasource"
},
"dimensions": {},
"expression": "SELECT SUM(EstimatedCharges) FROM SCHEMA(\"AWS/Billing\", Currency,ServiceName) WHERE ServiceName = 'AmazonPrometheus'",
"id": "",
"matchExact": true,
"metricEditorMode": 1,
"metricName": "",
"metricQueryType": 0,
"namespace": "",
"period": "",
"queryMode": "Metrics",
"refId": "A",
"region": "default",
"sqlExpression": "",
"statistic": "Average"
}
],
"title": "Sum of Estimated AMP Charges (total)",
"type": "timeseries"
},
{
"gridPos": {
"h": 9,
"w": 5,
"x": 0,
"y": 15
},
"id": 14,
"options": {
"content": "# Alert Usage Metrics\n\nMetrics associated with Alertmanager Alert Usage",
"mode": "markdown"
},
"pluginVersion": "8.4.7",
"title": "Alerts",
"type": "text"
},
{
"datasource": {
"type": "cloudwatch",
"uid": "$datasource"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 1
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 9,
"w": 4,
"x": 5,
"y": 15
},
"id": 4,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"textMode": "auto"
},
"pluginVersion": "8.4.7",
"targets": [
{
"alias": "",
"datasource": {
"type": "cloudwatch",
"uid": "$datasource"
},
"dimensions": {},
"expression": "SELECT AVG(ResourceCount) FROM SCHEMA(\"AWS/Usage\", Class,Resource,ResourceId,Service,Type) WHERE Type = 'Resource' AND ResourceId = '$WorkspaceID' AND Resource = 'ActiveAlerts' AND Service = 'Prometheus' AND Class = 'None'",
"id": "",
"matchExact": true,
"metricEditorMode": 1,
"metricName": "",
"metricQueryType": 0,
"namespace": "",
"period": "",
"queryMode": "Metrics",
"refId": "A",
"region": "default",
"sqlExpression": "",
"statistic": "Average"
}
],
"title": "Active Alerts",
"type": "stat"
},
{
"datasource": {
"type": "cloudwatch",
"uid": "$datasource"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 1
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 9,
"w": 5,
"x": 9,
"y": 15
},
"id": 12,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"textMode": "auto"
},
"pluginVersion": "8.4.7",
"targets": [
{
"alias": "",
"datasource": {
"type": "cloudwatch",
"uid": "$datasource"
},
"dimensions": {},
"expression": "SELECT AVG(AlertManagerNotificationsFailed) FROM SCHEMA(\"AWS/Prometheus\", Workspace) WHERE Workspace = '$WorkspaceID'",
"id": "",
"matchExact": true,
"metricEditorMode": 1,
"metricName": "",
"metricQueryType": 0,
"namespace": "",
"period": "",
"queryMode": "Metrics",
"refId": "A",
"region": "default",
"sqlExpression": "",
"statistic": "Average"
}
],
"title": "Alert Manager Notifications Failed",
"type": "stat"
},
{
"datasource": {
"type": "cloudwatch",
"uid": "$datasource"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 9,
"w": 4,
"x": 14,
"y": 15
},
"id": 10,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"textMode": "auto"
},
"pluginVersion": "8.4.7",
"targets": [
{
"alias": "",
"datasource": {
"type": "cloudwatch",
"uid": "$datasource"
},
"dimensions": {},
"expression": "SELECT AVG(AlertManagerAlertsReceived) FROM SCHEMA(\"AWS/Prometheus\", Workspace) WHERE Workspace = '$WorkspaceID'",
"id": "",
"matchExact": true,
"metricEditorMode": 1,
"metricName": "",
"metricQueryType": 0,
"namespace": "",
"period": "",
"queryMode": "Metrics",
"refId": "A",
"region": "default",
"sqlExpression": "",
"statistic": "Average"
}
],
"title": "Alert Manager Alerts Received",
"type": "stat"
},
{
"datasource": {
"type": "cloudwatch",
"uid": "$datasource"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 9,
"w": 5,
"x": 18,
"y": 15
},
"id": 8,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"textMode": "auto"
},
"pluginVersion": "8.4.7",
"targets": [
{
"alias": "",
"datasource": {
"type": "cloudwatch",
"uid": "$datasource"
},
"dimensions": {},
"expression": "SELECT AVG(ResourceCount) FROM SCHEMA(\"AWS/Usage\", Class,Resource,ResourceId,Service,Type) WHERE Type = 'Resource' AND ResourceId = '$WorkspaceID' AND Resource = 'SizeOfAlerts' AND Service = 'Prometheus' AND Class = 'None'",
"id": "",
"matchExact": true,
"metricEditorMode": 1,
"metricName": "",
"metricQueryType": 0,
"namespace": "",
"period": "",
"queryMode": "Metrics",
"refId": "A",
"region": "default",
"sqlExpression": "",
"statistic": "Average"
}
],
"title": "Size of Alerts",
"type": "stat"
},
{
"gridPos": {
"h": 7,
"w": 5,
"x": 0,
"y": 24
},
"id": 20,
"options": {
"content": "# AMP Vended Logs\n\nLast 25 log events from AMP Vended Logs for alert and rule evaluation",
"mode": "markdown"
},
"pluginVersion": "8.4.7",
"title": "AMP Logs",
"type": "text"
},
{
"datasource": {
"type": "cloudwatch",
"uid": "$datasource"
},
"gridPos": {
"h": 7,
"w": 18,
"x": 5,
"y": 24
},
"id": 18,
"options": {
"dedupStrategy": "none",
"enableLogDetails": true,
"prettifyLogMessage": false,
"showCommonLabels": false,
"showLabels": false,
"showTime": false,
"sortOrder": "Descending",
"wrapLogMessage": false
},
"targets": [
{
"datasource": {
"type": "cloudwatch",
"uid": "$datasource"
},
"expression": "fields @timestamp, @message\n| sort @timestamp desc\n| limit 25",
"id": "",
"logGroupNames": [
"/aws/vendedlogs/amp"
],
"namespace": "",
"queryMode": "Logs",
"refId": "A",
"region": "default",
"statsGroups": []
}
],
"timeFrom": "6h",
"timeShift": "6h",
"title": "AMP Vended Logs",
"type": "logs"
}
],
"refresh": "",
"schemaVersion": 35,
"style": "dark",
"tags": [],
"templating": {
"list": [
{
"current": {
"selected": true,
"text": [
"ws-e8b003eb-0528-4208-b31c-edf4598d5f66"
],
"value": [
"ws-e8b003eb-0528-4208-b31c-edf4598d5f66"
]
},
"datasource": {
"type": "cloudwatch",
"uid": "$datasource"
},
"definition": "dimension_values(default,AWS/Prometheus,RuleEvaluations,Workspace)",
"hide": 0,
"includeAll": false,
"multi": true,
"name": "WorkspaceID",
"options": [],
"query": "dimension_values(default,AWS/Prometheus,RuleEvaluations,Workspace)",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"type": "query"
},
{
"current": {
"selected": false,
"text": "Amazon CloudWatch us-west-2",
"value": "Amazon CloudWatch us-west-2"
},
"hide": 0,
"includeAll": false,
"multi": false,
"name": "datasource",
"options": [],
"query": "cloudwatch",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"type": "datasource"
}
]
},
"time": {
"from": "now-6h",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "AMP Accelerator Dashboard",
"uid": "",
"version": 1,
"weekStart": ""
}
+10 -2
View File
@@ -14,17 +14,25 @@ resource "grafana_data_source" "cloudwatch" {
# Giving priority to Managed Prometheus datasources
is_default = false
json_data {
json_data_encoded = jsonencode({
default_region = var.aws_region
sigv4_auth = true
sigv4_auth_type = "workspace-iam-role"
sigv4_region = var.aws_region
})
}
data "http" "dashboard" {
url = "https://raw.githubusercontent.com/aws-observability/aws-observability-accelerator/a72787328e493c4628680487e3c885fc395d1c56/artifacts/grafana-dashboards/amp/amp-dashboard.json"
request_headers = {
Accept = "application/json"
}
}
resource "grafana_dashboard" "this" {
folder = var.dashboards_folder_id
config_json = file("${path.module}/dashboards/amp-dashboard.json")
config_json = data.http.dashboard.response_body
}
module "billing" {
@@ -1,8 +1,3 @@
variable "dashboards_folder_id" {
description = "Grafana folder ID for automatic dashboards"
type = string
}
variable "aws_region" {
description = "AWS Region"
type = string
@@ -24,3 +19,9 @@ variable "ingestion_rate_threshold" {
type = number
default = 70000
}
variable "dashboards_folder_id" {
description = "Grafana folder ID for automatic dashboards"
default = "0"
type = string
}
@@ -6,9 +6,17 @@ terraform {
source = "hashicorp/aws"
version = ">= 4.0.0"
}
helm = {
source = "hashicorp/helm"
version = ">= 2.4.1"
}
grafana = {
source = "grafana/grafana"
version = ">= 1.25.0"
}
http = {
source = "hashicorp/http"
version = ">= 3.3.0"
}
}
}