[uptime-robot] metrics refactor (#1181)

* [uptimerobot-prometheus] metrics refactor

* add template to rules

* Update charts/stable/uptimerobot-prometheus/templates/prometheusrules.yaml

Co-authored-by: ᗪєνιη ᗷυнʟ <onedr0p@users.noreply.github.com>

Co-authored-by: ᗪєνιη ᗷυнʟ <onedr0p@users.noreply.github.com>
This commit is contained in:
j_r0dd 2021-09-13 10:18:36 -04:00 committed by GitHub
parent 9bb61afb12
commit 8c79f6c375
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 85 additions and 15 deletions

View File

@ -2,7 +2,7 @@ apiVersion: v2
name: uptimerobot-prometheus
description: Prometheus Exporter for the official uptimerobot CLI
type: application
version: 5.0.0
version: 6.0.0
appVersion: 0.0.1
keywords:
- uptimerobot

View File

@ -1,6 +1,6 @@
# uptimerobot-prometheus
![Version: 5.0.0](https://img.shields.io/badge/Version-5.0.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.0.1](https://img.shields.io/badge/AppVersion-0.0.1-informational?style=flat-square)
![Version: 6.0.0](https://img.shields.io/badge/Version-6.0.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.0.1](https://img.shields.io/badge/AppVersion-0.0.1-informational?style=flat-square)
Prometheus Exporter for the official uptimerobot CLI
@ -83,7 +83,12 @@ You can find an [example grafana dashboard](https://github.com/lekpamartin/uptim
| image.repository | string | `"billimek/prometheus-uptimerobot-exporter"` | image repository |
| image.tag | string | `"0.0.1"` | image tag |
| ingress.main | object | See values.yaml | Enable and configure ingress settings for the chart under this key. |
| prometheus.serviceMonitor | object | See values.yaml | Enable and configure a Prometheus serviceMonitor for the chart under this key. See also the notes under `additionalContainers`. |
| metrics.enabled | bool | See values.yaml | Enable and configure a Prometheus serviceMonitor for the chart under this key. |
| metrics.prometheusRule | object | See values.yaml | Enable and configure Prometheus Rules for the chart under this key. |
| metrics.prometheusRule.rules | list | See prometheusrules.yaml | Configure additionial rules for the chart under this key. |
| metrics.serviceMonitor.interval | string | `"1m"` | |
| metrics.serviceMonitor.labels | object | `{}` | |
| metrics.serviceMonitor.scrapeTimeout | string | `"30s"` | |
| service | object | See values.yaml | Configures service settings for the chart. |
## Changelog
@ -92,6 +97,12 @@ All notable changes to this application Helm chart will be documented in this fi
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
### [6.0.0]
#### Changed
- **BREAKING**: Refactored Prometheus metrics section to add rules. Enabling metrics automatically enables the serviceMonitor.
### [5.0.0]
#### Changed
@ -117,6 +128,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- use helm-docs
[6.0.0]: #600
[5.0.0]: #500
[4.0.0]: #400
[3.0.0]: #300

View File

@ -9,6 +9,12 @@ All notable changes to this application Helm chart will be documented in this fi
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
### [6.0.0]
#### Changed
- **BREAKING**: Refactored Prometheus metrics section to add rules. Enabling metrics automatically enables the serviceMonitor.
### [5.0.0]
#### Changed
@ -34,6 +40,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- use helm-docs
[6.0.0]: #600
[5.0.0]: #500
[4.0.0]: #400
[3.0.0]: #300

View File

@ -0,0 +1,27 @@
{{- if and .Values.metrics.enabled .Values.metrics.prometheusRule.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: {{ include "common.names.fullname" . }}
labels:
{{- include "common.labels" . | nindent 4 }}
{{- with .Values.metrics.prometheusRule.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
groups:
- name: {{ include "common.names.fullname" . }}
rules:
- alert: UptimeRobotExporterAbsent
annotations:
description: Uptime Robot Exporter has disappeared from Prometheus service discovery.
summary: Uptime Robot Exporter is down.
expr: |
absent(up{job=~".*{{ include "common.names.fullname" . }}.*"} == 1)
for: 5m
labels:
severity: critical
{{- with .Values.metrics.prometheusRule.rules }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}

View File

@ -1,11 +1,11 @@
{{- if .Values.prometheus.serviceMonitor.enabled }}
{{- if .Values.metrics.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "common.names.fullname" . }}
name: {{ include "common.names.fullname" . }}
labels:
{{- include "common.labels" . | nindent 4 }}
{{- with .Values.prometheus.serviceMonitor.additionalLabels }}
{{- with .Values.metrics.serviceMonitor.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
@ -13,9 +13,12 @@ spec:
matchLabels:
{{- include "common.labels.selectorLabels" . | nindent 6 }}
endpoints:
- port: http
{{- with .Values.prometheus.serviceMonitor.interval }}
- port: metrics
{{- with .Values.metrics.serviceMonitor.interval }}
interval: {{ . }}
{{- end }}
{{- with .Values.metrics.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ . }}
{{- end }}
path: /metrics
{{- end }}

View File

@ -27,6 +27,10 @@ service:
main:
ports:
http:
enabled: false
metrics:
enabled: true
protocol: TCP
port: 9705
ingress:
@ -35,11 +39,28 @@ ingress:
main:
enabled: false
prometheus:
metrics:
# -- Enable and configure a Prometheus serviceMonitor for the chart under this key.
# See also the notes under `additionalContainers`.
# @default -- See values.yaml
serviceMonitor:
enabled: false
serviceMonitor:
interval: 1m
additionalLabels: {}
scrapeTimeout: 30s
labels: {}
# -- Enable and configure Prometheus Rules for the chart under this key.
# @default -- See values.yaml
prometheusRule:
enabled: false
labels: {}
# -- Configure additionial rules for the chart under this key.
# @default -- See prometheusrules.yaml
rules: []
# - alert: UptimeRobotExporterAbsent
# annotations:
# description: Uptime Robot Exporter has disappeared from Prometheus service discovery.
# summary: Uptime Robot Exporter is down.
# expr: |
# absent(up{job=~".*uptimerobot.*"} == 1)
# for: 5m
# labels:
# severity: critical