diff --git a/packages/rancher-windows-exporter/charts/Chart.yaml b/packages/rancher-windows-exporter/charts/Chart.yaml index 57c088845..d828395f5 100755 --- a/packages/rancher-windows-exporter/charts/Chart.yaml +++ b/packages/rancher-windows-exporter/charts/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 -version: 0.1.0 -appVersion: 0.0.4 +version: 0.1.1 +appVersion: 0.0.2 annotations: catalog.rancher.io/certified: rancher catalog.rancher.io/namespace: cattle-monitoring-system diff --git a/packages/rancher-windows-exporter/charts/templates/_helpers.tpl b/packages/rancher-windows-exporter/charts/templates/_helpers.tpl index 4fc68cf97..16975d9d0 100644 --- a/packages/rancher-windows-exporter/charts/templates/_helpers.tpl +++ b/packages/rancher-windows-exporter/charts/templates/_helpers.tpl @@ -71,3 +71,43 @@ kubernetes.io/os: windows {{- end -}} {{- end -}} {{- end -}} + +{{- define "windowsExporter.renamedMetrics" -}} +{{- $renamed := dict -}} +{{/* v0.15.0 */}} +{{- $_ := set $renamed "windows_mssql_transactions_active_total" "windows_mssql_transactions_active" -}} +{{/* v0.16.0 */}} +{{- $_ := set $renamed "windows_adfs_ad_login_connection_failures" "windows_adfs_ad_login_connection_failures_total" -}} +{{- $_ := set $renamed "windows_adfs_certificate_authentications" "windows_adfs_certificate_authentications_total" -}} +{{- $_ := set $renamed "windows_adfs_device_authentications" "windows_adfs_device_authentications_total" -}} +{{- $_ := set $renamed "windows_adfs_extranet_account_lockouts" "windows_adfs_extranet_account_lockouts_total" -}} +{{- $_ := set $renamed "windows_adfs_federated_authentications" "windows_adfs_federated_authentications_total" -}} +{{- $_ := set $renamed "windows_adfs_passport_authentications" "windows_adfs_passport_authentications_total" -}} +{{- $_ := set $renamed "windows_adfs_password_change_failed" "windows_adfs_password_change_failed_total" -}} +{{- $_ := set $renamed "windows_adfs_password_change_succeeded" "windows_adfs_password_change_succeeded_total" -}} +{{- $_ := set $renamed "windows_adfs_token_requests" "windows_adfs_token_requests_total" -}} +{{- $_ := set $renamed "windows_adfs_windows_integrated_authentications" "windows_adfs_windows_integrated_authentications_total" -}} +{{- $_ := set $renamed "windows_net_packets_outbound_errors" "windows_net_packets_outbound_errors_total" -}} +{{- $_ := set $renamed "windows_net_packets_received_discarded" "windows_net_packets_received_discarded_total" -}} +{{- $_ := set $renamed "windows_net_packets_received_errors" "windows_net_packets_received_errors_total" -}} +{{- $_ := set $renamed "windows_net_packets_received_total" "windows_net_packets_received_total_total" -}} +{{- $_ := set $renamed "windows_net_packets_received_unknown" "windows_net_packets_received_unknown_total" -}} +{{- $_ := set $renamed "windows_dns_memory_used_bytes_total" "windows_dns_memory_used_bytes" -}} +{{- $renamed | toJson -}} +{{- end -}} + +{{- define "windowsExporter.renamedMetricsRelabeling" -}} +{{- range $original, $new := (include "windowsExporter.renamedMetrics" . | fromJson) -}} +- sourceLabels: [__name__] + regex: {{ $original }} + replacement: '{{ $new }}' + targetLabel: __name__ +{{ end -}} +{{- end -}} + +{{- define "windowsExporter.renamedMetricsRules" -}} +{{- range $original, $new := (include "windowsExporter.renamedMetrics" . | fromJson) -}} +- record: {{ $original }} + expr: {{ $new }} +{{ end -}} +{{- end -}} diff --git a/packages/rancher-windows-exporter/charts/templates/prometheusrule.yaml b/packages/rancher-windows-exporter/charts/templates/prometheusrule.yaml new file mode 100644 index 000000000..f31983122 --- /dev/null +++ b/packages/rancher-windows-exporter/charts/templates/prometheusrule.yaml @@ -0,0 +1,13 @@ +{{- if and .Values.prometheusRule .Values.clients }}{{- if and .Values.prometheusRule.enabled .Values.clients.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: PrometheusRule +metadata: + labels: {{ include "windowsExporter.labels" . | nindent 4 }} + name: {{ template "windowsExporter.name" . }} + namespace: {{ template "windowsExporter.namespace" . }} +spec: + groups: + - name: windows-exporter-relabel.rules + rules: +{{- include "windowsExporter.renamedMetricsRules" . | nindent 4 -}} +{{- end }}{{- end }} \ No newline at end of file diff --git a/packages/rancher-windows-exporter/charts/templates/servicemonitor.yaml b/packages/rancher-windows-exporter/charts/templates/servicemonitor.yaml index a2c2f0b54..26ece9b05 100644 --- a/packages/rancher-windows-exporter/charts/templates/servicemonitor.yaml +++ b/packages/rancher-windows-exporter/charts/templates/servicemonitor.yaml @@ -17,14 +17,11 @@ spec: endpoints: - port: windows-metrics metricRelabelings: +{{- include "windowsExporter.renamedMetricsRelabeling" . | nindent 4 -}} - sourceLabels: [__name__] regex: 'wmi_(.*)' replacement: 'windows_$1' targetLabel: __name__ - - sourceLabels: [__name__] - regex: windows_mssql_transactions_active_total - replacement: 'windows_mssql_transactions_active' - targetLabel: __name__ - sourceLabels: [volume, nic] regex: (.*);(.*) separator: '' diff --git a/packages/rancher-windows-exporter/charts/values.yaml b/packages/rancher-windows-exporter/charts/values.yaml index 6130890bd..aa1fd1973 100755 --- a/packages/rancher-windows-exporter/charts/values.yaml +++ b/packages/rancher-windows-exporter/charts/values.yaml @@ -13,6 +13,10 @@ global: serviceMonitor: enabled: true +# Configure PrometheusRule that renames existing metrics +prometheusRule: + enabled: true + ## Components scraping metrics from Windows nodes ## clients: @@ -21,7 +25,7 @@ clients: port: 9796 image: repository: rancher/windows_exporter-package - tag: v0.0.1 + tag: v0.0.2 os: "windows" # Specify the IP addresses of nodes that you want to collect metrics from