feat: Add Prometheus Grafana support to uptime-kuma

This commit is contained in:
Stefan Reimer 2021-09-24 17:51:20 +02:00
parent 5b901ae1b8
commit 52275cda3f
7 changed files with 99 additions and 3 deletions

View File

@ -2,7 +2,7 @@ apiVersion: v2
name: uptime-kuma
description: Chart for deploying uptime-kuma
type: application
version: 0.1.0
version: 0.1.3
appVersion: 1.6.3
home: https://kubezero.com
icon: https://cdn.zero-downtime.net/assets/kubezero/logo-small-64.png

View File

@ -1,6 +1,6 @@
# uptime-kuma
![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.6.3](https://img.shields.io/badge/AppVersion-1.6.3-informational?style=flat-square)
![Version: 0.1.3](https://img.shields.io/badge/Version-0.1.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.6.3](https://img.shields.io/badge/AppVersion-1.6.3-informational?style=flat-square)
Chart for deploying uptime-kuma
@ -26,11 +26,12 @@ Kubernetes: `>= 1.18.0`
|-----|------|---------|-------------|
| fullnameOverride | string | `""` | override the full name of the uptime-kuma chart |
| image | string | `"louislam/uptime-kuma"` | |
| istio.enabled | bool | `true` | |
| istio.enabled | bool | `false` | |
| istio.gateway | string | `"istio-ingress/private-ingressgateway"` | |
| istio.url | string | `"uptime.example.com"` | |
| nameOverride | string | `""` | override the name of the uptime-kuma chart |
| service.port | int | `3001` | The port to be used by the uptime-kuma service |
| serviceMonitor.enabled | bool | `false` | |
| version | string | `"1.6.3-alpine"` | |
## Resources

View File

@ -0,0 +1,8 @@
configmap: grafana-dashboards
gzip: true
folder: Metrics
condition: '.Values.serviceMonitor.enabled'
dashboards:
- name: Uptime
url: https://grafana.com/api/dashboards/14847/revisions/2/download
tags: []

View File

@ -0,0 +1,15 @@
{{- if .Values.serviceMonitor.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ printf "%s-%s" (include "kubezero-lib.fullname" $) "grafana-dashboards" | trunc 63 | trimSuffix "-" }}
namespace: {{ .Release.Namespace }}
labels:
grafana_dashboard: "1"
{{- include "kubezero-lib.labels" . | nindent 4 }}
annotations:
k8s-sidecar-target-directory: Metrics
binaryData:
Uptime.json.gz:
H4sIAAAAAAAC/+1ZW2/bNhR+96/gOGBoALewml7SvXlJOgTL0iBJ22FDEdASbbOhSJWkEruG//sOqRsl0U7QbVga5MWGzqHIc//OEVcDhPDlJRNZbjT+Gf31aVhQFP2SM0UdDSgIrdwv8Mwyo0DFM0WmRBA8rBgsCZIFSd36X7uMa6o0k8Ly9p5FzyLsGOth+LiMCMq7h2lDTP+k8xbVO+YbTjAspZoqBpbonXMBPNRl9o+D38KqRAgJogHXmrU4H3OmTW3kRirgTHLGzZHdKRo21IQYomWuYifCqZIpNXOaNxLAGirIhFu+UTn16HOWBKgslmJfcqnshmo2IU9GQ/Q8iuDn5cshinb8rSvdx40u6Cc05lSZlgiGqBk1tZollbOUWWI0Gg19ekpMPB+LJbCmhGvaYhoya0KzoZZeS4ieTyRRCa65a1+OTcvW7v/ToFyOacJMx2p4Jqg5smEQvdh78bogKZLNL6TkhmXAcGoUoSJyzt0TZ+LKyyUXVoE8ajmyetlxpozyZF+KKZu1DIgTOiU5N7pr1rj0nk+0VpXO3djMIZHnkicaewvWHQ9kGRMz7YViNyDLlTJrR3CLOQqSPRGxogkehlYwkdBFZdIe19CFDRx88O7jCe4tWPffwdGtoswUpWK7MNFWYd6fBkQZ3CJaHZLXhOe0vYH/cifcGx9u9DOZaMlzQzsqQZWkWd+xKOS/W21TSl1E7G2qbjsgHAf19nujwTa7fhqEOH7iSyjECupdkYmDzgLQjyWnsm1MPLcHe3vcwPMb77kTntjWq1Fva1cNXtSPoXwpzPB76bcJia9mSubCt0hRaaolRFHiMz/n2rDpsmLHVBiq/AUSUEkUBdq9nxvps8H6eUzfBVMZx4TH/XjBnGhzIs0JOB5vjFNXu7RDvxbd+VVX9T1cqousWnVptQ2sDj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itor
metadata:
name: {{ include "kubezero-lib.fullname" . }}
{{- with .Values.serviceMonitor.namespace }}
namespace: {{ . }}
{{- end }}
labels:
{{- include "kubezero-lib.labels" . | nindent 4 }}
spec:
jobLabel: {{ .Values.serviceMonitor.jobLabel | default .Release.Name }}
endpoints:
- port: http
path: /metrics
{{- with .Values.serviceMonitor.interval }}
interval: {{ . }}
{{- end }}
{{- with .Values.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ . }}
{{- end }}
{{- if .Values.serviceMonitor.metricRelabelings }}
metricRelabelings:
{{ tpl (toYaml .Values.serviceMonitor.metricRelabelings | indent 6) . }}
{{- end }}
{{- if .Values.serviceMonitor.relabelings }}
relabelings:
{{ toYaml .Values.serviceMonitor.relabelings | indent 6 }}
{{- end }}
{{- if .Values.serviceMonitor.basicAuth }}
basicAuth:
password:
name: {{ include "kubezero-lib.fullname" . }}-servicemonitor-basic-auth
key: password
username:
name: {{ include "kubezero-lib.fullname" . }}-servicemonitor-basic-auth
key: username
{{- end }}
{{- if .Values.serviceMonitor.namespaceSelector }}
namespaceSelector:
{{ toYaml .Values.serviceMonitor.namespaceSelector | indent 4 -}}
{{ else }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
{{- end }}
selector:
matchLabels:
{{- include "kubezero-lib.selectorLabels" . | nindent 6 }}
---
{{- if .Values.serviceMonitor.basicAuth }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "kubezero-lib.fullname" . }}-servicemonitor-basic-auth
data:
password: {{ .Values.serviceMonitor.basicAuth.password | b64enc }}
username: {{ .Values.serviceMonitor.basicAuth.username | b64enc }}
type: Opaque
{{- end }}
{{- end }}

3
charts/uptime-kuma/update.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash -ex
../kubezero-metrics/sync_grafana_dashboards.py dashboards.yaml templates/grafana-dashboards.yaml

View File

@ -30,3 +30,9 @@ istio:
enabled: false
gateway: istio-ingress/private-ingressgateway
url: uptime.example.com
serviceMonitor:
enabled: false
# basicAuth:
# username: uptime
# password: check