diff --git a/.env.tmp b/.env.tmp new file mode 100644 index 0000000..a14519d --- /dev/null +++ b/.env.tmp @@ -0,0 +1,29 @@ + + export AZUREAD_AUTH_URL=https://login.microsoftonline.com/c6874728-71e6-41fe-a9e1-2e8c36776ad8/oauth2/v2.0/authorize + export TF_VAR_zone_id=Z06002415PZ7SU3SAQ3E + export AZUREAD_TOKEN_URL=https://login.microsoftonline.com/c6874728-71e6-41fe-a9e1-2e8c36776ad8/oauth2/v2.0/token + export TF_VAR_enable_transit_gateway=true + export TF_VAR_enabled=true + export TF_VAR_domain_name=staff.service.justice.gov.uk + export TF_VAR_network_services_cidr_block=10.180.104.0/22 + export DB_NAME=grafanadb + export SERVER_ROOT_URL=https://monitoring-alerting.staff.service.justice.gov.uk + export TF_VAR_transit_gateway_id=tgw-026162f1ba39ce704 + export AZUREAD_CLIENT_ID=54295841-9978-4552-9c66-6f48ed7556fb + export TF_VAR_db_username=grafana + export DB_USERNAME=grafana + export TF_VAR_db_password=jswprHGqwd2C9aPm + export DB_PASSWORD=jswprHGqwd2C9aPm + export TF_VAR_farnborough_mgmt_range=172.16.182.0/24 + export AZUREAD_CLIENT_SECRET=.Y8g7875Cfey3li9sDKc7pD-Yg~_KL1J53 + export TF_VAR_byoip_pool_id=ipv4pool-ec2-0dd0c616934a4f4c0 + export TF_VAR_corsham_mgmt_range=172.16.181.0/24 + export TF_VAR_transit_gateway_route_table_id=tgw-rtb-003574027dca6a7a4 + export TF_VAR_assume_role=arn:aws:iam::037161842252:role/SharedServicesCodeBuild + export TF_VAR_pcx_production_pki_ost_cidr=10.195.8.0/22 + export TF_VAR_pcx_production_pki_ost_cidr=10.195.8.0/22 + export TF_VAR_trusted_cidr=86.161.235.64/32,86.188.153.90/32,86.188.153.91/32,31.49.97.253/32,0.0.0.0/0 + export TF_VAR_trusted_cidr=86.161.235.64/32,86.188.153.90/32,86.188.153.91/32,31.49.97.253/32,0.0.0.0/0 + export TF_VAR_mojo_prod_tgw_id=tgw-026162f1ba39ce704 + export TF_VAR_mojo_prod_tgw_id=tgw-026162f1ba39ce704 + export TF_VAR_seondary_internal_cidr=10.180.89.0/24 diff --git a/.gitignore b/.gitignore index 3dd9a1b..4158f4b 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ terraform.tfstate #tmp kube config written by tooling container .kube_config +.env.tmp diff --git a/k8s-helm-charts/cns-team-monitoring/templates/kea-dhcp-lease-statistics-grafana-dashboard.yaml b/k8s-helm-charts/cns-team-monitoring/templates/kea-dhcp-lease-statistics-grafana-dashboard.yaml index d7c322a..0b32349 100644 --- a/k8s-helm-charts/cns-team-monitoring/templates/kea-dhcp-lease-statistics-grafana-dashboard.yaml +++ b/k8s-helm-charts/cns-team-monitoring/templates/kea-dhcp-lease-statistics-grafana-dashboard.yaml @@ -5,489 +5,605 @@ metadata: labels: grafana_dashboard: "1" data: - kea-dhcp-lease-statistics.json: |- - { - "annotations": { - "list": [ - { - "builtIn": 1, - "datasource": { - "type": "grafana", - "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" - } - ] - }, - "editable": true, - "fiscalYearStartMonth": 0, - "graphTooltip": 0, - "links": [], - "liveNow": false, - "panels": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "description": "", - "fieldConfig": { - "defaults": { - "custom": { - "align": "auto", - "displayMode": "auto", - "inspect": false - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 2, - "w": 23, - "x": 0, - "y": 0 - }, - "id": 4, - "options": { - "footer": { - "fields": "", - "reducer": [ - "sum" - ], - "show": false - }, - "showHeader": true - }, - "pluginVersion": "9.0.5", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "editorMode": "code", - "expr": "MoJO_site_info{Info=~\".+$SiteName.+\"} ", - "legendFormat": "{{ "{{SiteName}}" }}", - "range": true, - "refId": "A" - } - ], - "title": "Subnets for $SiteName", - "transformations": [ - { - "id": "labelsToFields", - "options": { - "mode": "columns", - "valueLabel": "Info" - } - }, - { - "id": "extractFields", - "options": { - "format": "auto", - "replace": true, - "source": "subnets" - } - } - ], - "type": "table" - }, - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "description": "", - "gridPos": { - "h": 3, - "w": 6, - "x": 0, - "y": 2 - }, - "id": 6, - "options": { - "content": "# $SiteName2", - "mode": "markdown" - }, - "pluginVersion": "9.0.5", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "editorMode": "code", - "expr": "", - "legendFormat": "{{ "{{SiteName}}" }}", - "range": true, - "refId": "A" - } - ], - "title": "Site Finder ($customSubnet)", - "transformations": [ - { - "id": "labelsToFields", - "options": { - "keepLabels": [ - "Info" - ], - "mode": "columns", - "valueLabel": "Info" - } - } - ], - "type": "text" - }, - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "description": "Paste a subnet into the \"Find Site by Subnet\" box to see it's usage here!", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "#EAB839", - "value": 80 - }, - { - "color": "semi-dark-red", - "value": 90 - } - ] - }, - "unit": "percent" - }, - "overrides": [] - }, - "gridPos": { - "h": 3, - "w": 7, - "x": 6, - "y": 2 - }, - "id": 9, - "options": { - "colorMode": "value", - "graphMode": "none", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto" - }, - "pluginVersion": "9.0.5", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "exemplar": true, - "expr": "subnet_statistics_usage{cidr_block=\"$customSubnet\"}", - "interval": "", - "legendFormat": "Leases", - "refId": "A" - } - ], - "title": "Subnet Usage for $customSubnet", - "type": "stat" - }, - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "description": "", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 13, - "w": 10, - "x": 13, - "y": 2 - }, - "id": 8, - "options": { - "colorMode": "value", - "graphMode": "none", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto" - }, - "pluginVersion": "9.0.5", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "exemplar": true, - "expr": "sum(subnet_statistics_leases)", - "interval": "", - "legendFormat": "Leases", - "refId": "A" - } - ], - "title": "Total Number of leases across MoJO", - "type": "stat" - }, - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "description": "", - "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": 3, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": true, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "line" - } - }, - "decimals": 0, - "mappings": [], - "max": 100, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "orange", - "value": 80 - }, - { - "color": "dark-red", - "value": 90 - } - ] - }, - "unit": "percent" - }, - "overrides": [] - }, - "gridPos": { - "h": 10, - "w": 13, - "x": 0, - "y": 5 - }, - "id": 2, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom" - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "editorMode": "code", - "exemplar": true, - "expr": "subnet_statistics_usage > 60", - "interval": "", - "legendFormat": "{{ "{{cidr_block}}" }}", - "range": true, - "refId": "A" - } - ], - "title": "Subnet Usage by CIDR > 60%", - "type": "timeseries" - } - ], - "refresh": false, - "schemaVersion": 36, - "style": "dark", - "tags": [ - "DHCP", - "Kea" - ], - "templating": { - "list": [ - { - "current": { - "selected": false, - "text": "10 South Colonnade", - "value": "10 South Colonnade" - }, - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "definition": "MoJO_site_info", - "hide": 0, - "includeAll": false, - "label": "MoJO Site Name", - "multi": false, - "name": "SiteName", - "options": [], - "query": { - "query": "MoJO_site_info", - "refId": "StandardVariableQuery" - }, - "refresh": 1, - "regex": ".*Info=\"{\"([^\"]*).*", - "skipUrlSync": false, - "sort": 0, - "type": "query" - }, - { - "current": { - "selected": false, - "text": "10.80.39.0/24", - "value": "10.80.39.0/24" - }, - "description": "Enter your cidr block in the box in standard notation i.e 192.168.0.1/24 the Site finder panel will populate with your Site Name", - "hide": 0, - "label": "Find Site by Subnet", - "name": "customSubnet", - "options": [ - { - "selected": true, - "text": "10.80.39.0/24", - "value": "10.80.39.0/24" - } - ], - "query": "10.80.39.0/24", - "skipUrlSync": false, - "type": "textbox" - }, - { - "current": { - "selected": false, - "text": "HMP Frankland", - "value": "HMP Frankland" - }, - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "definition": "MoJO_site_info{Info=~\".+$customSubnet.+\"}", - "hide": 2, - "includeAll": false, - "multi": false, - "name": "SiteName2", - "options": [], - "query": { - "query": "MoJO_site_info{Info=~\".+$customSubnet.+\"}", - "refId": "StandardVariableQuery" - }, - "refresh": 1, - "regex": "/.*Info=\"{\"([^\"]*).*/m", - "skipUrlSync": false, - "sort": 0, - "type": "query" - } - ] - }, - "time": { - "from": "now-1h", - "to": "now" - }, - "timepicker": {}, - "timezone": "Europe/London", - "title": "DHCP Lease Statistics", - "uid": "9QAN_V67z", - "version": 1, - "weekStart": "Monday" - } + kea-dhcp-lease-statistics.json: |- + { + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "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" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "links": [], + "liveNow": false, + "panels": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "description": "", + "fieldConfig": { + "defaults": { + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 2, + "w": 23, + "x": 0, + "y": 0 + }, + "id": 4, + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true + }, + "pluginVersion": "10.4.1", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "editorMode": "code", + "expr": "MoJO_site_info{Info=~\".+$SiteName.+\"} ", + "legendFormat": "{{ "{{SiteName}}" }}", + "range": true, + "refId": "A" + } + ], + "title": "Subnets for $SiteName", + "transformations": [ + { + "id": "labelsToFields", + "options": { + "mode": "columns", + "valueLabel": "Info" + } + }, + { + "id": "extractFields", + "options": { + "format": "auto", + "replace": true, + "source": "subnets" + } + } + ], + "type": "table" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "description": "", + "gridPos": { + "h": 3, + "w": 6, + "x": 0, + "y": 2 + }, + "id": 6, + "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, + "content": "# $SiteName2", + "mode": "markdown" + }, + "pluginVersion": "10.4.1", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "editorMode": "code", + "expr": "", + "legendFormat": "{{ "{{SiteName}}" }}", + "range": true, + "refId": "A" + } + ], + "title": "Site Finder ($customSubnet)", + "transformations": [ + { + "id": "labelsToFields", + "options": { + "keepLabels": [ + "Info" + ], + "mode": "columns", + "valueLabel": "Info" + } + } + ], + "type": "text" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "description": "Paste a subnet into the \"Find Site by Subnet\" box to see it's usage here!", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "#EAB839", + "value": 80 + }, + { + "color": "semi-dark-red", + "value": 90 + } + ] + }, + "unit": "percent" + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 7, + "x": 6, + "y": 2 + }, + "id": 9, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "10.4.1", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "editorMode": "code", + "exemplar": true, + "expr": "subnet_statistics_usage{cidr_block=\"$customSubnet\"}", + "interval": "", + "legendFormat": "Leases", + "range": true, + "refId": "A" + } + ], + "title": "Subnet Usage for $customSubnet", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 13, + "w": 10, + "x": 13, + "y": 2 + }, + "id": 8, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "10.4.1", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "exemplar": true, + "expr": "sum(subnet_statistics_leases)", + "interval": "", + "legendFormat": "Leases", + "refId": "A" + } + ], + "title": "Total Number of leases across MoJO", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 3, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": true, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "line" + } + }, + "decimals": 0, + "mappings": [], + "max": 100, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "orange", + "value": 80 + }, + { + "color": "dark-red", + "value": 90 + } + ] + }, + "unit": "percent" + }, + "overrides": [] + }, + "gridPos": { + "h": 10, + "w": 13, + "x": 0, + "y": 5 + }, + "id": 2, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "editorMode": "code", + "exemplar": true, + "expr": "subnet_statistics_usage > 60", + "interval": "", + "legendFormat": "{{ "{{cidr_block}}" }}", + "range": true, + "refId": "A" + } + ], + "title": "Subnet Usage by CIDR > 60%", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "description": "Display Subnet specific statistics", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": 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": 23, + "x": 0, + "y": 15 + }, + "id": 10, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "editorMode": "code", + "expr": "subnet_statistics_usage{cidr_block=\"$customSubnet\"}", + "instant": false, + "legendFormat": "__auto", + "range": true, + "refId": "A" + } + ], + "title": "Subnet Statistics $customSubnet", + "type": "timeseries" + } + ], + "refresh": false, + "schemaVersion": 39, + "tags": [ + "DHCP", + "Kea" + ], + "templating": { + "list": [ + { + "current": { + "selected": false, + "text": "10 South Colonnade", + "value": "10 South Colonnade" + }, + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "definition": "MoJO_site_info", + "hide": 0, + "includeAll": false, + "label": "MoJO Site Name", + "multi": false, + "name": "SiteName", + "options": [], + "query": { + "query": "MoJO_site_info", + "refId": "StandardVariableQuery" + }, + "refresh": 1, + "regex": ".*Info=\"{\"([^\"]*).*", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "current": { + "selected": false, + "text": "10.150.236.0/24", + "value": "10.150.236.0/24" + }, + "description": "Enter your cidr block in the box in standard notation i.e 192.168.0.1/24 the Site finder panel will populate with your Site Name", + "hide": 0, + "label": "Find Site by Subnet", + "name": "customSubnet", + "options": [ + { + "selected": true, + "text": "10.150.236.0/24", + "value": "10.150.236.0/24" + } + ], + "query": "10.150.236.0/24", + "skipUrlSync": false, + "type": "textbox" + }, + { + "current": { + "selected": false, + "text": "Mitre House", + "value": "Mitre House" + }, + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "definition": "MoJO_site_info{Info=~\".+$customSubnet.+\"}", + "hide": 2, + "includeAll": false, + "multi": false, + "name": "SiteName2", + "options": [], + "query": { + "query": "MoJO_site_info{Info=~\".+$customSubnet.+\"}", + "refId": "StandardVariableQuery" + }, + "refresh": 1, + "regex": "/.*Info=\"{\"([^\"]*).*/m", + "skipUrlSync": false, + "sort": 0, + "type": "query" + } + ] + }, + "time": { + "from": "now-30d", + "to": "now" + }, + "timepicker": {}, + "timezone": "Europe/London", + "title": "DHCP Lease Statistics", + "uid": "9QAN_V67z", + "version": 1, + "weekStart": "Monday" + } +