From 3e65c6aff7daed451c4b88be06cb244842b34383 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Mon, 6 Mar 2023 09:28:09 +0000 Subject: [PATCH] [plex-exporter] Update to common, add loglevel argument (#48) * [plex-exporter] Update to common, add loglevel argument * Fix empty lines * Clean linting * Add missing repo to ct --- .github/ct.yaml | 1 + charts/plex-exporter/Chart.yaml | 7 ++--- charts/plex-exporter/ci/loglevel.yml | 5 ++++ charts/plex-exporter/templates/common.yaml | 4 +++ .../templates/prometheusrules.yaml | 28 ------------------- .../templates/servicemonitor.yaml | 25 ----------------- charts/plex-exporter/values.yaml | 24 ++++++++-------- 7 files changed, 26 insertions(+), 68 deletions(-) create mode 100644 charts/plex-exporter/ci/loglevel.yml delete mode 100644 charts/plex-exporter/templates/prometheusrules.yaml delete mode 100644 charts/plex-exporter/templates/servicemonitor.yaml diff --git a/.github/ct.yaml b/.github/ct.yaml index f09bf47..6b2d145 100644 --- a/.github/ct.yaml +++ b/.github/ct.yaml @@ -8,3 +8,4 @@ chart-repos: - k8s-at-home-libraries=https://library-charts.k8s-at-home.com - k8s-at-home=https://k8s-at-home.com/charts - jetstack=https://charts.jetstack.io +- nikdoof=https://nikdoof.github.io/helm-charts/ diff --git a/charts/plex-exporter/Chart.yaml b/charts/plex-exporter/Chart.yaml index 4c4f998..ecf6d5c 100644 --- a/charts/plex-exporter/Chart.yaml +++ b/charts/plex-exporter/Chart.yaml @@ -1,8 +1,8 @@ apiVersion: v2 -appVersion: 0.2.2 +appVersion: 0.2.3 description: A prometheus exporter for Plex Media Server name: plex-exporter -version: 0.1.2 +version: 0.1.3 kubeVersion: ">=1.16.0-0" keywords: - plex-exporter @@ -16,5 +16,4 @@ maintainers: dependencies: - name: common repository: https://nikdoof.github.io/helm-charts/ - version: 4.5.2 - + version: 4.5.3 diff --git a/charts/plex-exporter/ci/loglevel.yml b/charts/plex-exporter/ci/loglevel.yml new file mode 100644 index 0000000..639fbb4 --- /dev/null +++ b/charts/plex-exporter/ci/loglevel.yml @@ -0,0 +1,5 @@ +--- +plex: + autodiscover: true + token: a0a0a0a0a0 + loglevel: debug diff --git a/charts/plex-exporter/templates/common.yaml b/charts/plex-exporter/templates/common.yaml index a676e85..0128d80 100644 --- a/charts/plex-exporter/templates/common.yaml +++ b/charts/plex-exporter/templates/common.yaml @@ -14,6 +14,10 @@ args: - "--token" - "{{ .Values.plex.token }}" {{ end }} + {{ if .Values.plex.loglevel }} + - "--log-level" + - "{{ .Values.plex.loglevel }}" + {{ end }} {{- end -}} {{- $_ := mergeOverwrite .Values (include "plex-exporter.harcodedValues" . | fromYaml) -}} diff --git a/charts/plex-exporter/templates/prometheusrules.yaml b/charts/plex-exporter/templates/prometheusrules.yaml deleted file mode 100644 index f331e7b..0000000 --- a/charts/plex-exporter/templates/prometheusrules.yaml +++ /dev/null @@ -1,28 +0,0 @@ -{{- if and .Values.metrics.enabled .Values.metrics.prometheusRule.enabled }} -{{- include "common.values.setup" . -}} -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: PlexExporterAbsent - annotations: - description: Plex Exporter has disappeared from Prometheus service discovery. - summary: Plex 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 }} diff --git a/charts/plex-exporter/templates/servicemonitor.yaml b/charts/plex-exporter/templates/servicemonitor.yaml deleted file mode 100644 index b4b1c81..0000000 --- a/charts/plex-exporter/templates/servicemonitor.yaml +++ /dev/null @@ -1,25 +0,0 @@ -{{- if .Values.metrics.enabled }} -{{- include "common.values.setup" . -}} -apiVersion: monitoring.coreos.com/v1 -kind: ServiceMonitor -metadata: - name: {{ include "common.names.fullname" . }} - labels: - {{- include "common.labels" . | nindent 4 }} - {{- with .Values.metrics.serviceMonitor.labels }} - {{- toYaml . | nindent 4 }} - {{- end }} -spec: - selector: - matchLabels: - {{- include "common.labels.selectorLabels" . | nindent 6 }} - endpoints: - - port: metrics - {{- with .Values.metrics.serviceMonitor.interval }} - interval: {{ . }} - {{- end }} - {{- with .Values.metrics.serviceMonitor.scrapeTimeout }} - scrapeTimeout: {{ . }} - {{- end }} - path: /metrics -{{- end }} diff --git a/charts/plex-exporter/values.yaml b/charts/plex-exporter/values.yaml index 3b1281c..7f20fd2 100644 --- a/charts/plex-exporter/values.yaml +++ b/charts/plex-exporter/values.yaml @@ -9,7 +9,7 @@ image: # -- image repository repository: granra/plex_exporter # -- image tag - tag: v0.2.2 + tag: v0.2.3 # -- image pull policy pullPolicy: IfNotPresent @@ -42,6 +42,8 @@ plex: token: # -- Enable autodiscover using plex.tv autodiscover: true + # -- Logging level + # loglevel: info metrics: # -- Enable and configure a Prometheus serviceMonitor for the chart under this key. @@ -58,13 +60,13 @@ metrics: labels: {} # -- Configure additionial rules for the chart under this key. # @default -- See prometheusrules.yaml - rules: [] - # - alert: plexExporterAbsent - # annotations: - # description: plex Exporter has disappeared from Prometheus service discovery. - # summary: plex Exporter is down. - # expr: | - # absent(up{job=~".*plexexporter.*"} == 1) - # for: 5m - # labels: - # severity: critical + rules: + - alert: PlexExporterAbsent + annotations: + description: Plex Exporter has disappeared from Prometheus service discovery. + summary: Plex Exporter is down. + expr: | + absent(up{job=~".*{{ include "common.names.fullname" . }}.*"} == 1) + for: 5m + labels: + severity: critical