add grafana

This commit is contained in:
Joseph Hanson 2024-10-21 11:46:13 -05:00
parent 09baa7cf09
commit be0f0bc52e
Signed by: jahanson
SSH key fingerprint: SHA256:vy6dKBECV522aPAwklFM3ReKAVB086rT3oWwiuiFG7o
6 changed files with 4451 additions and 0 deletions

View file

@ -0,0 +1,332 @@
---
# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/helm.toolkit.fluxcd.io/helmrelease_v2beta2.json
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: grafana
spec:
interval: 30m
chartRef:
kind: OCIRepository
name: grafana
namespace: flux-system
driftDetection:
mode: enabled
install:
remediation:
retries: 3
upgrade:
cleanupOnFail: true
remediation:
retries: 3
values:
deploymentStrategy:
type: RollingUpdate
testFramework:
enabled: false
serviceMonitor:
enabled: true
metricRelabelings:
- action: labeldrop
regex: (pod)
ingress:
enabled: true
ingressClassName: internal-nginx
hosts:
- &host "grafana.jahanson.tech"
tls:
- hosts:
- *host
topologySpreadConstraints:
- maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app.kubernetes.io/name: grafana
persistence:
enabled: false
plugins:
- grafana-clock-panel
- https://github.com/VictoriaMetrics/victorialogs-datasource/releases/download/v0.4.0/victorialogs-datasource-v0.4.0.zip;victorialogs-datasource
- https://github.com/VictoriaMetrics/victoriametrics-datasource/releases/download/v0.9.0/victoriametrics-datasource-v0.9.0.zip;victoriametrics-datasource
datasources:
datasources.yaml:
apiVersion: 1
deleteDatasources:
- { name: Alertmanager, orgId: 1 }
- { name: Loki, orgId: 1 }
- { name: Prometheus, orgId: 1 }
datasources:
- name: Prometheus
type: prometheus
uid: prometheus
access: proxy
url: http://vmsingle-victoria.observability.svc:8429
isDefault: true
jsonData:
prometheusType: Prometheus
timeInterval: 60s
- name: VictoriaMetrics
type: victoriametrics-datasource
access: proxy
url: http://vmsingle-stack.observability.svc:8429
- name: VictoriaLogs
type: victorialogs-datasource
access: proxy
url: http://victoria-logs.observability:9428
- name: Alertmanager
type: alertmanager
uid: alertmanager
access: proxy
url: http://alertmanager.observability.svc.cluster.local:9093
jsonData:
implementation: prometheus
dashboardProviders:
dashboardproviders.yaml:
apiVersion: 1
providers:
- name: default
orgId: 1
folder: ""
type: file
disableDeletion: false
editable: true
options:
path: /var/lib/grafana/dashboards/default
- name: flux
orgId: 1
folder: Flux
type: file
disableDeletion: false
editable: true
options:
path: /var/lib/grafana/dashboards/flux
- name: kubernetes
orgId: 1
folder: Kubernetes
type: file
disableDeletion: false
editable: true
options:
path: /var/lib/grafana/dashboards/kubernetes
- name: nginx
orgId: 1
folder: Nginx
type: file
disableDeletion: false
editable: true
options:
path: /var/lib/grafana/dashboards/nginx
- name: observability
orgId: 1
folder: Observability
type: file
disableDeletion: false
editable: true
options:
path: /var/lib/grafana/dashboards/observability
- name: rook-ceph
orgId: 1
folder: Rook-Ceph
type: file
disableDeletion: false
editable: true
options:
path: /var/lib/grafana/dashboards/rook-ceph
- name: unifi
orgId: 1
folder: Unifi
type: file
disableDeletion: false
editable: true
options:
path: /var/lib/grafana/dashboards/unifi
dashboards:
default:
cloudflared:
# renovate: depName="Cloudflare Tunnels (cloudflared)"
gnetId: 17457
revision: 6
datasource:
- { name: DS_PROMETHEUS, value: Prometheus }
external-dns:
# renovate: depName="External-dns"
gnetId: 15038
revision: 3
datasource: Prometheus
minio:
# renovate: depName="MinIO Dashboard"
gnetId: 13502
revision: 26
datasource:
- { name: DS_PROMETHEUS, value: Prometheus }
node-exporter-full:
# renovate: depName="Node Exporter Full"
gnetId: 1860
revision: 37
datasource: Prometheus
nut-exporter:
# renovate: depName="Prometheus NUT Exporter for DRuggeri"
gnetId: 19308
revision: 3
datasource:
- { name: DS_PROMETHEUS, value: Prometheus }
smart:
# renovate: depName="Dashboard for smartctl_exporter"
gnetId: 20204
revision: 1
datasource:
- { name: DS_PROMETHEUS, value: Prometheus }
volsync:
# removate: depNmae="VolSync Dashboard"
gnetId: 21356
revision: 1
datasource:
- { name: DS_PROMETHEUS, value: Prometheus }
- { name: VAR_REPLICATIONDESTNAME, value: .*-dst }
cert-manager:
url: https://gitlab.com/uneeq-oss/cert-manager-mixin/-/raw/master/dashboards/cert-manager.json?ref_type=heads
datasource: Prometheus
dcgm-exporter:
url: https://raw.githubusercontent.com/NVIDIA/dcgm-exporter/main/grafana/dcgm-exporter-dashboard.json
datasource: Prometheus
external-secrets:
url: https://raw.githubusercontent.com/external-secrets/external-secrets/main/docs/snippets/dashboard.json
datasource: Prometheus
node-feature-discovery:
url: https://raw.githubusercontent.com/kubernetes-sigs/node-feature-discovery/master/examples/grafana-dashboard.json
datasource: Prometheus
flux:
flux-cluster:
url: https://raw.githubusercontent.com/fluxcd/flux2-monitoring-example/main/monitoring/configs/dashboards/cluster.json
datasource: Prometheus
flux-control-plane:
url: https://raw.githubusercontent.com/fluxcd/flux2-monitoring-example/main/monitoring/configs/dashboards/control-plane.json
datasource: Prometheus
kubernetes:
k8s-system-api-server:
url: https://raw.githubusercontent.com/dotdc/grafana-dashboards-kubernetes/master/dashboards/k8s-system-api-server.json
token: ''
k8s-system-coredns:
url: https://raw.githubusercontent.com/dotdc/grafana-dashboards-kubernetes/master/dashboards/k8s-system-coredns.json
token: ''
k8s-views-global:
url: https://raw.githubusercontent.com/dotdc/grafana-dashboards-kubernetes/master/dashboards/k8s-views-global.json
token: ''
k8s-views-namespaces:
url: https://raw.githubusercontent.com/dotdc/grafana-dashboards-kubernetes/master/dashboards/k8s-views-namespaces.json
token: ''
k8s-views-nodes:
url: https://raw.githubusercontent.com/dotdc/grafana-dashboards-kubernetes/master/dashboards/k8s-views-nodes.json
token: ''
k8s-views-pods:
url: https://raw.githubusercontent.com/dotdc/grafana-dashboards-kubernetes/master/dashboards/k8s-views-pods.json
token: ''
nginx:
nginx:
url: https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/grafana/dashboards/nginx.json
datasource: Prometheus
nginx-request-handling-performance:
url: https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/grafana/dashboards/request-handling-performance.json
datasource: Prometheus
observability:
prometheus:
# renovate: depName="Prometheus"
gnetId: 19105
revision: 5
datasource: Prometheus
victoria-agent:
# renovate: depName="VictoriaMetrics - vmagent"
gnetId: 12683
revision: 20
datasource: Prometheus
victoria-alert:
# renovate: depName="VictoriaMetrics - vmalert"
gnetId: 14950
revision: 12
datasource: Prometheus
victoria-operator:
# renovate: depName="VictoriaMetrics - operator"
gnetId: 17869
revision: 3
datasource: Prometheus
victoria-single:
# renovate: depName="VictoriaMetrics - single-node"
gnetId: 10229
revision: 36
datasource: Prometheus
rook-ceph:
rook-ceph-cluster:
# renovate: depName="Ceph Cluster"
gnetId: 2842
revision: 18
datasource: Prometheus
rook-ceph-osd-single:
# renovate: depName="Ceph - OSD (Single)"
gnetId: 5336
revision: 9
datasource: Prometheus
rook-ceph-pools:
# renovate: depName="Ceph - Pools"
gnetId: 5342
revision: 9
datasource: Prometheus
unifi:
unifi-insights:
# renovate: depName="UniFi-Poller: Client Insights - Prometheus"
gnetId: 11315
revision: 9
datasource: Prometheus
unifi-network-sites:
# renovate: depName="UniFi-Poller: Network Sites - Prometheus"
gnetId: 11311
revision: 5
datasource: Prometheus
unifi-uap:
# renovate: depName="UniFi-Poller: UAP Insights - Prometheus"
gnetId: 11314
revision: 10
datasource: Prometheus
unifi-usw:
# renovate: depName="UniFi-Poller: USW Insights - Prometheus"
gnetId: 11312
revision: 9
datasource: Prometheus
## Grafana's primary configuration
## NOTE: values in map will be converted to ini format
## ref: http://docs.grafana.org/installation/configuration/
##
grafana.ini:
analytics:
check_for_updates: false
check_for_plugin_updates: false
reporting_enabled: false
auth:
disable_login_form: true
auth.anonymous:
enabled: true
news:
news_feed_enabled: false
plugins:
allow_loading_unsigned_plugins: "victorialogs-datasource,victoriametrics-datasource"
users:
allow_sign_up: false
auto_assign_org: true
auto_assign_org_role: Admin
sidecar:
dashboards:
enabled: true
searchNamespace: ALL
folderAnnotation: grafana_folder
provider:
disableDelete: true
foldersFromFilesStructure: true
datasources:
enabled: true
searchNamespace: ALL
enableUniqueFilenames: true

View file

@ -0,0 +1,26 @@
---
# yaml-language-server: $schema=https://json.schemastore.org/kustomization
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./helmrelease.yaml
configMapGenerator:
- name: grafana-dashboards
files:
- ./resources/zfs-details.json
options:
annotations:
kustomize.toolkit.fluxcd.io/substitute: disabled
labels:
grafana_dashboard: "1"
- name: flux-dashboards
files:
- ./resources/flux-logs.json
options:
annotations:
kustomize.toolkit.fluxcd.io/substitute: disabled
labels:
grafana_dashboard: "1"
grafana_folder: "Flux"
generatorOptions:
disableNameSuffixHash: true

View file

@ -0,0 +1,392 @@
{
"__inputs": [
{
"name": "DS_VICTORIALOGS",
"label": "VictoriaLogs",
"description": "",
"type": "datasource",
"pluginId": "victorialogs-datasource",
"pluginName": "VictoriaLogs"
}
],
"__elements": {},
"__requires": [
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "11.2.0"
},
{
"type": "panel",
"id": "logs",
"name": "Logs",
"version": ""
},
{
"type": "datasource",
"id": "prometheus",
"name": "Prometheus",
"version": "1.0.0"
},
{
"type": "panel",
"id": "timeseries",
"name": "Time series",
"version": ""
},
{
"type": "datasource",
"id": "victorialogs-datasource",
"name": "VictoriaLogs",
"version": "0.4.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"
},
{
"datasource": {
"type": "datasource",
"uid": "grafana"
},
"enable": true,
"iconColor": "red",
"name": "flux events",
"target": {
"limit": 100,
"matchAny": false,
"tags": [
"flux"
],
"type": "tags"
}
}
]
},
"description": "Flux logs collected from Kubernetes, stored in VictoriaLogs",
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": null,
"links": [],
"liveNow": false,
"panels": [
{
"datasource": {
"type": "victorialogs-datasource",
"uid": "${DS_VICTORIALOGS}"
},
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "bars",
"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": 4,
"w": 24,
"x": 0,
"y": 0
},
"id": 4,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": false
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "victorialogs-datasource",
"uid": "${DS_VICTORIALOGS}"
},
"expr": "sum(count_over_time({namespace=~\"$namespace\", stream=~\"$stream\", app =~\"$controller\"} | json | __error__!=\"JSONParserErr\" | level=~\"$level\" |= \"$query\" [$__interval]))",
"instant": false,
"legendFormat": "Log count",
"range": true,
"refId": "A"
}
],
"type": "timeseries"
},
{
"datasource": {
"type": "victorialogs-datasource",
"uid": "${DS_VICTORIALOGS}"
},
"description": "Logs from services running in Kubernetes",
"gridPos": {
"h": 25,
"w": 24,
"x": 0,
"y": 4
},
"id": 2,
"options": {
"dedupStrategy": "numbers",
"enableLogDetails": false,
"prettifyLogMessage": true,
"showCommonLabels": false,
"showLabels": false,
"showTime": false,
"sortOrder": "Descending",
"wrapLogMessage": false
},
"targets": [
{
"datasource": {
"type": "victorialogs-datasource",
"uid": "${DS_VICTORIALOGS}"
},
"expr": "{namespace=~\"$namespace\", stream=~\"$stream\", app =~\"$controller\"} | json | __error__!=\"JSONParserErr\" | level=~\"$level\" |= \"$query\"",
"refId": "A"
}
],
"type": "logs"
}
],
"refresh": "10s",
"schemaVersion": 39,
"tags": [
"flux"
],
"templating": {
"list": [
{
"current": {
"selected": false,
"text": "",
"value": ""
},
"description": "String to search for",
"hide": 0,
"label": "Search Query",
"name": "query",
"options": [
{
"selected": true,
"text": "",
"value": ""
}
],
"query": "",
"skipUrlSync": false,
"type": "textbox"
},
{
"allValue": "info|error",
"current": {
"selected": false,
"text": "All",
"value": "$__all"
},
"hide": 0,
"includeAll": true,
"multi": false,
"name": "level",
"options": [
{
"selected": true,
"text": "All",
"value": "$__all"
},
{
"selected": false,
"text": "info",
"value": "info"
},
{
"selected": false,
"text": "error",
"value": "error"
}
],
"query": "info,error",
"queryValue": "",
"skipUrlSync": false,
"type": "custom"
},
{
"allValue": ".+",
"current": {
"selected": true,
"text": [
"All"
],
"value": [
"$__all"
]
},
"datasource": {
"type": "victorialogs-datasource",
"uid": "${DS_VICTORIALOGS}"
},
"definition": "label_values(app)",
"hide": 0,
"includeAll": true,
"multi": true,
"name": "controller",
"options": [],
"query": "label_values(app)",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"type": "query"
},
{
"allValue": ".+",
"current": {
"selected": true,
"text": [
"flux-system"
],
"value": [
"flux-system"
]
},
"datasource": {
"type": "victorialogs-datasource",
"uid": "${DS_VICTORIALOGS}"
},
"definition": "label_values(namespace)",
"hide": 0,
"includeAll": true,
"multi": true,
"name": "namespace",
"options": [],
"query": "label_values(namespace)",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"type": "query"
},
{
"allValue": ".+",
"current": {
"selected": false,
"text": "All",
"value": "$__all"
},
"datasource": {
"type": "victorialogs-datasource",
"uid": "${DS_VICTORIALOGS}"
},
"definition": "label_values(stream)",
"hide": 0,
"includeAll": true,
"multi": true,
"name": "stream",
"options": [],
"query": "label_values(stream)",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"type": "query"
},
{
"current": {
"selected": false,
"text": "VictoriaLogs",
"value": "VictoriaLogs"
},
"hide": 0,
"includeAll": false,
"label": "Datasource",
"multi": false,
"name": "DS_VICTORIALOGS",
"options": [],
"query": "victorialogs-datasource",
"queryValue": "VictoriaLogs",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"type": "datasource"
}
]
},
"time": {
"from": "now-6h",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "Flux Logs",
"uid": "flux-logs",
"version": 3,
"weekStart": ""
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,20 @@
---
# yaml-language-server: $schema=https://ks.hsn.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: &app grafana
namespace: flux-system
spec:
targetNamespace: observability
commonMetadata:
labels:
app.kubernetes.io/name: *app
path: ./kubernetes/apps/observability/grafana/app
prune: true
sourceRef:
kind: GitRepository
name: theshire
wait: false
interval: 30m
retryInterval: 1m

View file

@ -8,6 +8,7 @@ resources:
# Flux-Kustomizations # Flux-Kustomizations
- ./alertmanager/ks.yaml - ./alertmanager/ks.yaml
- ./gatus/ks.yaml - ./gatus/ks.yaml
- ./grafana/ks.yaml
- ./node-exporter/ks.yaml - ./node-exporter/ks.yaml
- ./prometheus-operator-crds/ks.yaml - ./prometheus-operator-crds/ks.yaml
- ./unpoller/ks.yaml - ./unpoller/ks.yaml