[unifi-poller] add servicemonitor (#332)

* add servicemonitor

* add servicemonitor

* add servicemonitor
This commit is contained in:
Devin Buhl 2020-08-18 14:54:25 -04:00 committed by GitHub
parent 81e0519f1c
commit 69d4339aae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 37 additions and 17 deletions

View File

@ -2,7 +2,7 @@ apiVersion: v1
appVersion: "2.0.1" appVersion: "2.0.1"
description: Collect ALL UniFi Controller, Site, Device & Client Data - Export to InfluxDB or Prometheus description: Collect ALL UniFi Controller, Site, Device & Client Data - Export to InfluxDB or Prometheus
name: unifi-poller name: unifi-poller
version: 1.0.0 version: 1.0.1
keywords: keywords:
- unifi - unifi
- unifi-poller - unifi-poller

View File

@ -4,16 +4,9 @@ metadata:
name: {{ include "unifi-poller.fullname" . }} name: {{ include "unifi-poller.fullname" . }}
labels: labels:
{{ include "unifi-poller.labels" . | indent 4 }} {{ include "unifi-poller.labels" . | indent 4 }}
{{- if or (not .Values.config.prometheus.disable) (.Values.service.annotations) }} {{- if .Values.service.annotations }}
annotations: annotations:
{{- if not .Values.config.prometheus.disable }} {{ toYaml .Values.service.annotations | indent 4 }}
prometheus.io/path: /metrics
prometheus.io/port: "9130"
prometheus.io/scrape: "true"
{{- end }}
{{- if .Values.service.annotations }}
{{ toYaml .Values.service.annotations | nindent 4 }}
{{- end }}
{{- end }} {{- end }}
spec: spec:
type: {{ .Values.service.type }} type: {{ .Values.service.type }}

View File

@ -0,0 +1,25 @@
{{- if .Values.prometheus.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "unifi-poller.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "unifi-poller.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ include "unifi-poller.chart" . }}
{{- with .Values.prometheus.serviceMonitor.additionalLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
selector:
matchLabels:
app.kubernetes.io/name: {{ include "unifi-poller.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
endpoints:
- port: http
{{- if .Values.prometheus.serviceMonitor.interval }}
interval: {{ .Values.prometheus.serviceMonitor.interval }}
{{- end }}
path: /metrics
{{- end }}

View File

@ -68,17 +68,23 @@ tolerations: []
affinity: {} affinity: {}
# if using prometheus in the options below
# wire up a servicemonitor for prometheus-operator
prometheus:
serviceMonitor:
enabled: false
interval: 1m
additionalLabels: {}
config: config:
poller: poller:
# config.poller.debug -- Turns on line numbers, microsecond logging, and a per-device log. # config.poller.debug -- Turns on line numbers, microsecond logging, and a per-device log.
# The default is false, but I personally leave this on at home (four devices). # The default is false, but I personally leave this on at home (four devices).
# This may be noisy if you have a lot of devices. It adds one line per device. # This may be noisy if you have a lot of devices. It adds one line per device.
debug: false debug: false
# config.poller.quiet -- Turns off per-interval logs. Only startup and error logs will be emitted. # config.poller.quiet -- Turns off per-interval logs. Only startup and error logs will be emitted.
# Recommend enabling debug with this setting for better error logging. # Recommend enabling debug with this setting for better error logging.
quiet: false quiet: false
# config.poller.plugins -- Load dynamic plugins. Advanced use; only sample mysql plugin provided by default. # config.poller.plugins -- Load dynamic plugins. Advanced use; only sample mysql plugin provided by default.
plugins: [] plugins: []
@ -94,7 +100,7 @@ config:
influxdb: influxdb:
# config.influxdb.disable -- Disable prometheus output # config.influxdb.disable -- Disable prometheus output
disable: false disable: true
# config.influxdb.interval -- # config.influxdb.interval --
interval: "30s" interval: "30s"
# config.influxdb.url -- InfluxDB does not require auth by default, so the user/password are probably unimportant. # config.influxdb.url -- InfluxDB does not require auth by default, so the user/password are probably unimportant.
@ -133,13 +139,11 @@ config:
pass: "unifipoller" pass: "unifipoller"
# config.unifi.defaults.url -- Url to talk to unifi # config.unifi.defaults.url -- Url to talk to unifi
url: "https://127.0.0.1:8443" url: "https://127.0.0.1:8443"
# config.unifi.defaults.sites -- If the controller has more than one site, specify which sites to poll here. # config.unifi.defaults.sites -- If the controller has more than one site, specify which sites to poll here.
# Set this to ["default"] to poll only the first site on the controller. # Set this to ["default"] to poll only the first site on the controller.
# A setting of ["all"] will poll all sites; this works if you only have 1 site too. # A setting of ["all"] will poll all sites; this works if you only have 1 site too.
sites: sites:
- all - all
# config.unifi.defaults.verify_ssl -- If your UniFi controller has a valid SSL certificate (like lets encrypt), # config.unifi.defaults.verify_ssl -- If your UniFi controller has a valid SSL certificate (like lets encrypt),
# you can enable this option to validate it. Otherwise, any SSL certificate is # you can enable this option to validate it. Otherwise, any SSL certificate is
# valid. If you don't know if you have a valid SSL cert, then you don't have one # valid. If you don't know if you have a valid SSL cert, then you don't have one
@ -154,10 +158,8 @@ config:
# more API requests to your controller(s). Don't let these "cons" sway you: # more API requests to your controller(s). Don't let these "cons" sway you:
# it's cool data. Please provide feedback on your experience with this feature. # it's cool data. Please provide feedback on your experience with this feature.
save_dpi: false save_dpi: false
# config.unifi.defaults.save_sites -- Enable collection of site data. This data powers the Network Sites dashboard. # config.unifi.defaults.save_sites -- Enable collection of site data. This data powers the Network Sites dashboard.
# It's not valuable to everyone and setting this to false will save resources. # It's not valuable to everyone and setting this to false will save resources.
save_sites: true save_sites: true
# config.unifi.controllers -- Repeat any controllers like default above # config.unifi.controllers -- Repeat any controllers like default above
controllers: [] controllers: []