Skip to content

Commit

Permalink
Update vmWare Exporter and add recent Grafana Dashboard to helm chart
Browse files Browse the repository at this point in the history
  • Loading branch information
toschneck committed Oct 26, 2023
1 parent a7846cb commit 5a9c340
Show file tree
Hide file tree
Showing 22 changed files with 6,931 additions and 182 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Dedicated components for customer purposes.
| [s3/s3-syncer-aws-cli](./components/s3/s3-syncer-aws-cli) | s3-syncer based CronJob on the `aws s3` cli to sync two different S3 locations as well Azure (by Minio Azure Gateway) |
| [s3/s3-dbdump-syncer](./components/s3/s3-dbdump-syncer) | s3-syncer based CronJob creates a DB dump of a postgres SQL database and sync it via the `aws s3` cli to a target S3 location. |
| [api/cluster-management-by-api](components/api/cluster-management-by-api) | Bash based management scripts to specify your KKP cluster by API for CI/CD or GitOPs purposes. |
| [vmware-exporter](components/vmware-exporter) | Helm chart for VMware Exporter and Dashboard for Prometheus and Grafana for monitoring of vSphere environments in the KKP MLA stack. |
| [nutanix-exporter](components/nutanix-exporter) | Helm chart for [nutanix-exporter](https://github.com/claranet/nutnix-exporter) - exporter for Prometheus that can be used for monitoring of Nutanix-based environments. |

## Kubermatic Example Setups
Expand Down
21 changes: 21 additions & 0 deletions components/vmware-exporter/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
6 changes: 6 additions & 0 deletions components/vmware-exporter/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: vmware-exporter
repository: https://kremers.github.io
version: 2.2.0
digest: sha256:a33e8859092bfa1481fbca760b7c3367d52832d39c0d0fe032a1780b48e792e7
generated: "2021-10-25T12:57:37.394937992+02:00"
15 changes: 9 additions & 6 deletions components/vmware-exporter/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
apiVersion: v1
apiVersion: v2
name: vmware-exporter
appVersion: v0.18.2
appVersion: v0.18.4
description: VMware vCenter Exporter for Prometheus Helm chart
home: https://github.com/pryorda/vmware_exporter
maintainers:
- name: The Kubermatic Kubernetes Platform contributors
email: support@kubermatic.com
sources:
- https://github.com/pryorda/vmware_exporter
version: 2.2.0
version: 2.2.0-mod-v1
# To save the dependency
# helm pull kremers/vmware-exporter --untar --version 2.2.0 --destination charts/
dependencies:
- name: vmware-exporter
version: 2.2.0
repository: https://kremers.github.io
57 changes: 57 additions & 0 deletions components/vmware-exporter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# VMWare Exporter & Dashboard for KKP
_Last modified: 2023-10-26_

The chart contains the following components:
- vm-exporter helm chart, sourced from [kremers/charts-vmware-exporter](https://github.com/kremers/charts-vmware-exporter)
- grafana dashboards, included from [pryorda/vmware_exporter - dashboards](https://github.com/pryorda/vmware_exporter/tree/main/dashboards)

![VMware Cluster - VMware vSphere Dashboards](./vmware-vsphere-grafana-dashboard.png)

## Configure KKP
Based on the documentation [Customization of the Master / Seed MLA Stack - Grafana Dashboards](https://docs.kubermatic.com/kubermatic/v2.23/tutorials-howtos/monitoring-logging-alerting/master-seed/customization/#grafana-dashboards), KKP needs the dashboards at the `monitoring` namespace to get used. This already configured as default for the helm chart:
```yaml
vmware-exporter:
grafana:
configmap:
namespace: monitoring
name: vsphere-dashboard
```
Additionally, we need to configure the KKP values yaml to include the new dashboard configmap. The scraping of the vmware exporter metrics is by default already enabled. As first step we need include the authentication to the vSphere for the deployment:
```yaml
# KKP values.yaml
vmware-exporter:
vsphere:
user: "xxx-TODO-VIEW-ONLY-USER-xxx"
password: "xxx-TODO-PW-xxx"
host: "xxx-TODO-VSPHERE-HOST-xxx"
```
After this, we need to set as final step the `grafana:` config
```yaml
# KKP values.yaml
# ====== grafana ======
grafana:
provisioning:
dashboards:
extra:
- folder: "VMware vSphere Dashboards"
name: "vsphere-dashboard"
options:
path: /grafana-dashboard-definitions/vsphere-dashboard
org_id: 1
type: file
volumes:
- name: vsphere-dashboard
mountPath: /grafana-dashboard-definitions/vsphere-dashboard
configMap: vsphere-dashboard
```
## Rollout
To roll out the custom dashboard, you can just deploy the `grafana` and `vmware-exporter` helm chart
```bash
helm --namespace monitoring upgrade --install --wait --values /path/to/your/helm-values.yaml vmware-exporter /path/to/community-components/components/vmware-exporter
helm --namespace monitoring upgrade --install --wait --values /path/to/your/helm-values.yaml grafana charts/monitoring/grafana/
```

---
Original README 👉 [charts/vmware-exporter/README.md](./charts/vmware-exporter/README.md)
---

21 changes: 21 additions & 0 deletions components/vmware-exporter/charts/vmware-exporter/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
13 changes: 13 additions & 0 deletions components/vmware-exporter/charts/vmware-exporter/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
appVersion: 0.13.2
description: VMware vCenter Exporter for Prometheus Helm chart
home: https://github.com/pryorda/vmware_exporter
maintainers:
- email: info@martinkremers.de
name: kremers
- email: daniel@pryorda.net
name: pryorda
name: vmware-exporter
sources:
- https://github.com/pryorda/vmware_exporter
version: 2.2.0
5 changes: 5 additions & 0 deletions components/vmware-exporter/charts/vmware-exporter/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
approvers:
- kremers
- pryorda
reviewers:
- chrisz100
153 changes: 153 additions & 0 deletions components/vmware-exporter/charts/vmware-exporter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
# VMWare_exporter Helm Chart

* Chart can be found at github [kremers/charts-vmware-exporter](https://github.com/kremers/charts-vmware-exporter)
* Installs the VMWare_exporter for Prometheus [pryorda/vmware_exporter](https://github.com/pryorda/vmware_exporter)

## TL;DR;

```console
$ helm install kremers/vmware-exporter
```

## Installing the Chart

To install the chart with the release name `my-release`:

```console
$ helm install --name my-release kremers/vmware-exporter
```

## Uninstalling the Chart

To uninstall/delete the my-release deployment:

```console
$ helm delete my-release
```

The command removes all the Kubernetes components associated with the chart and deletes the release.


## Configuration

| Parameter | Description | Default |
|-------------------------------------------|-----------------------------------------------|---------------------------------------------------------|
| `replicaCount` | Number of nodes | `1` |
| `livenessProbe` | Liveness Probe settings | `{ "httpGet": { "path": "/healthz", "port": 9272 } "initialDelaySeconds": 30, "failureThreshold": 10}` |
| `readinessProbe` | Rediness Probe settings | `{ "httpGet": { "path": "/healthz", "port": 9272 }` |
| `image.repository` | Image repository | `pryorda/vmware_exporter` |
| `image.tag` | Image tag. (`Must be >= 0.7.4`) | `v0.10.4` |
| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
| `service.enabled` | Enable a service for vmware_exporter | `false` |
| `service.type` | Kubernetes service type | `ClusterIP` |
| `service.port` | Kubernetes port where service is exposed | `80` |
| `service.targetPort` | internal service is port | `9272` |
| `service.annotations` | Service annotations | `{}` |
| `service.labels` | Custom labels | `{}` |
| `podAnnotations` | podAnnotations i.e. for prometheus scraping | `{prometheus.io/scrape: "true", prometheus.io/port: "9272", prometheus.io/path: "/metrics"}` |
| `ingress.enabled` | Enables Ingress | `false` |
| `ingress.annotations` | Ingress annotations | `{}` |
| `ingress.labels` | Custom labels | `{}` |
| `ingress.path` | Ingress accepted path | `/` |
| `ingress.hosts` | Ingress accepted hostnames | `[]` |
| `ingress.tls` | Ingress TLS configuration | `[]` |
| `resources` | CPU/Memory resource requests/limits | `{}` |
| `nodeSelector` | Node labels for pod assignment | `{}` |
| `tolerations` | Toleration labels for pod assignment | `[]` |
| `affinity` | Affinity settings for pod assignment | `{}` |
| `securityContext` | Security Context for the Container | `{}` |
| `podSecurityContext` | Security Context for the Pod | `{}` |
| `vsphere.user` | User for vcenter login | `user` |
| `vsphere.password` | Password for vcenter login | `na` |
| `vsphere.existingSecret` | Provide password for vCenter login w/ secret | |
| `vsphere.host` | Hostname or IP for vcenter login | `vcenter` |
| `vsphere.ignoressl` | User for vcenter | `user` |
| `vsphere.collectors.hosts` | Collect host metrics | `true` |
| `vsphere.collectors.datastores` | Collect datastore metrics | `true` |
| `vsphere.collectors.vms` | Collect vm metrics | `true` |
| `vsphere.sections` | Add additional configuraiton sections via environment variables | `[]]` |




### Example of vcenter configuration

```yaml
vsphere:
user: user
password: somepassword
host: vcenter.someCompany.com
ignoressl: false
collectors:
hosts: true
datastores: true
vms: true
```

## Sharding the exporter for different vcenter instances

If different tenants are configured that have restricted visibility to specific folders, metrics can be sharded.
This will allow a setup like:

Prometheus customer(A) => VMWare exporter customer(A) => VCenter restricted access for customer(A)
Prometheus customer(B) => VMWare exporter customer(B) => VCenter restricted access for customer(B)

Some Grafana dashboard, connected to a datasource with mixed content will allow access to the whole underlying datasource with VIEWER privileges.

- [Grafana datasource permissions security notes](https://grafana.com/docs/permissions/overview/#datasource-permissions)
- [Prometheus reference about datasource security](https://prometheus.io/docs/operating/security/#authentication-authorization-and-encryption)

To enable seperation in the K8S autodiscovery to the following:

podAnnotations:
yourcustomannotation/scrape: "true"
yourcustomannotation/port: "9272"
prometheus.io/scrape: null
prometheus.io/port: null
prometheus.io/path: null

The scraping of Prometheus can be configured, adding additionalScrapeConfig parts or replacing prometheus.yml (most common for sharded data):

Parametrize the stable/prometheus chart like in the following example, take care for **yourcustomannotation**:

serverFiles:
prometheus.yml:
rule_files:
- /etc/config/rules
- /etc/config/alerts
scrape_configs:
- job_name: prometheus
static_configs:
- targets:
- localhost:9090
- job_name: 'k8s-yourcustomannotation'
kubernetes_sd_configs:
- role: pod
relabel_configs:
- source_labels: [__meta_kubernetes_pod_annotation_yourcustomannotation_scrape]
separator: ;
regex: "true"
replacement: $1
action: keep
- source_labels: [__meta_kubernetes_pod_annotation_yourcustomannotation _path]
separator: ;
regex: (.+)
target_label: __metrics_path__
replacement: $1
action: replace
- source_labels: [__address__, __meta_kubernetes_pod_annotation_yourcustomannotation _port]
separator: ;
regex: ([^:]+)(?::\d+)?;(\d+)
target_label: __address__
replacement: $1:$2
action: replace
kubeStateMetrics:
enabled: false
nodeExporter:
enabled: false
pushgateway:
enabled: false
alertmanager:
enabled: false
alertmanagerFiles:
alertmanager.yml: ""
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

helm package .
helm repo index ./


Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Assure your Prometheus kubernetes_sd is configured to scrape the following pod annotations:

podAnnotations:
{{- range $k, $v := .Values.vmware-exporter.podAnnotations }}
{{- range $k, $v := .Values.podAnnotations }}
{{- if $v }}
- {{ $k }}: {{ $v | quote }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Expand the name of the chart.
*/}}
{{- define "vmware-exporter.name" -}}
{{- default .Chart.Name .Values.vmware-exporter.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Expand All @@ -12,10 +12,10 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
If release name contains chart name it will be used as a full name.
*/}}
{{- define "vmware-exporter.fullname" -}}
{{- if .Values.vmware-exporter.fullnameOverride -}}
{{- .Values.vmware-exporter.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.vmware-exporter.nameOverride -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "vmware-exporter.fullname" . }}-config
labels:
app: {{ template "vmware-exporter.name" . }}
chart: {{ template "vmware-exporter.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
data:
VSPHERE_USER: {{ .Values.vsphere.user | quote }}
VSPHERE_HOST: {{ .Values.vsphere.host | quote }}
VSPHERE_IGNORE_SSL: {{ .Values.vsphere.ignoressl | quote }}
VSPHERE_SPECS_SIZE: {{ .Values.vsphere.specsSize | quote }}
VSPHERE_FETCH_CUSTOM_ATTRIBUTES: {{ .Values.vsphere.fetchCustomAttributes | quote }}
VSPHERE_FETCH_TAGS: {{ .Values.vsphere.fetchTags | quote }}
VSPHERE_FETCH_ALARMS: {{ .Values.vsphere.fetchAlarms | quote }}
VSPHERE_COLLECT_HOSTS: {{ .Values.vsphere.collectors.hosts | quote }}
VSPHERE_COLLECT_DATASTORES: {{ default "True" .Values.vsphere.collectors.datastores | quote }}
VSPHERE_COLLECT_VMS: {{ .Values.vsphere.collectors.vms | quote }}
VSPHERE_COLLECT_VMGUESTS: {{ .Values.vsphere.collectors.vmguests | quote }}
VSPHERE_COLLECT_SNAPSHOTS: {{ .Values.vsphere.collectors.snapshots | quote }}
{{- range $section := .Values.vsphere.sections }}
{{- $key := $section.name }}
VSPHERE_{{ $key }}_USER: {{ $section.user | quote }}
VSPHERE_{{ $key }}_HOST: {{ $section.host | quote }}
VSPHERE_{{ $key }}_IGNORE_SSL: {{ $section.ignoressl | quote }}
{{- if $section.fetchCustomAttributes }}
VSPHERE_{{ $key }}_FETCH_CUSTOM_ATTRIBUTES: {{ $section.fetchCustomAttributes | quote }}
{{- end }}
{{- if $section.fetchTags }}
VSPHERE_{{ $key }}_FETCH_TAGS: {{ $section.fetchTags | quote }}
{{- end }}
{{- if $section.fetchAlarms }}
VSPHERE_{{ $key }}_FETCH_ALARMS: {{ $section.fetchAlarms | quote }}
{{- end }}
{{- if $section.collectors }}
VSPHERE_{{ $key }}_COLLECT_HOSTS: {{ default $.Values.vsphere.collectors.hosts $section.collectors.hosts | quote }}
VSPHERE_{{ $key }}_COLLECT_DATASTORES: {{ default "True" $section.collectors.datastores | quote }}
VSPHERE_{{ $key }}_COLLECT_VMS: {{ default $.Values.vsphere.collectors.vms $section.collectors.vms | quote }}
VSPHERE_{{ $key }}_COLLECT_VMGUESTS: {{ default $.Values.vsphere.collectors.vmguests $section.collectors.vmguests | quote }}
VSPHERE_{{ $key }}_COLLECT_SNAPSHOTS: {{ default $.Values.vsphere.collectors.snapshots $section.collectors.snapshots | quote }}
{{- end }}
{{- end }}
Loading

0 comments on commit 5a9c340

Please sign in to comment.