diff --git a/prometheus-node-exporter/templates/bin/_node-exporter.sh.tpl b/prometheus-node-exporter/templates/bin/_node-exporter.sh.tpl new file mode 100644 index 000000000..8fa01df2d --- /dev/null +++ b/prometheus-node-exporter/templates/bin/_node-exporter.sh.tpl @@ -0,0 +1,26 @@ +#!/bin/sh +{{/* +Copyright 2017 The Openstack-Helm Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/}} + +set -ex + +exec /bin/node_exporter \ + --collector.ntp \ + --collector.ntp.server={{ .Values.conf.ntp_server_ip }} \ + --collector.meminfo_numa \ + --collector.bonding \ + --collector.mountstats + --logtostderr diff --git a/prometheus-node-exporter/templates/configmap-bin.yaml b/prometheus-node-exporter/templates/configmap-bin.yaml index 1578a02fa..9a29bf892 100644 --- a/prometheus-node-exporter/templates/configmap-bin.yaml +++ b/prometheus-node-exporter/templates/configmap-bin.yaml @@ -22,6 +22,8 @@ kind: ConfigMap metadata: name: node-exporter-bin data: + node-exporter.sh: | +{{ tuple "bin/_node-exporter.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }} image-repo-sync.sh: | {{- include "helm-toolkit.scripts.image_repo_sync" . | indent 4 }} {{- end }} diff --git a/prometheus-node-exporter/templates/daemonset.yaml b/prometheus-node-exporter/templates/daemonset.yaml index 3397e898c..098a022af 100644 --- a/prometheus-node-exporter/templates/daemonset.yaml +++ b/prometheus-node-exporter/templates/daemonset.yaml @@ -62,12 +62,8 @@ spec: - name: node-exporter {{ tuple $envAll "node_exporter" | include "helm-toolkit.snippets.image" | indent 10 }} {{ tuple $envAll $envAll.Values.pod.resources.node_exporter | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} - args: - - --collector.ntp - - --collector.ntp.server={{ .Values.conf.ntp_server_ip }} - - --collector.meminfo_numa - - --collector.bonding - - --collector.mountstats + command: + - /tmp/node-exporter.sh ports: - name: metrics containerPort: {{ tuple "node_metrics" "internal" "metrics" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} @@ -79,6 +75,10 @@ spec: - name: sys mountPath: /host/sys readOnly: true + - name: node-exporter-bin + mountPath: /tmp/node-exporter.sh + subPath: node-exporter.sh + readOnly: true volumes: - name: proc hostPath: @@ -86,4 +86,8 @@ spec: - name: sys hostPath: path: /sys + - name: node-exporter-bin + configMap: + name: node-exporter-bin + defaultMode: 0555 {{- end }}