diff --git a/assets/node-exporter/daemonset.yaml b/assets/node-exporter/daemonset.yaml index 59cb1bb9eb..fad3c65def 100644 --- a/assets/node-exporter/daemonset.yaml +++ b/assets/node-exporter/daemonset.yaml @@ -41,6 +41,18 @@ spec: - --collector.cpu.info - --collector.textfile.directory=/var/node_exporter/textfile - --no-collector.btrfs + command: + - /bin/sh + - -c + - | + export GOMAXPROCS=4 + # We don't take CPU affinity into account as the container dones't have integer CPU requests + NUM_CPUS=$(grep -c '^processor' "/proc/cpuinfo" 2>/dev/null || echo "0") + if [ "$NUM_CPUS" -lt "$GOMAXPROCS" ]; then + export GOMAXPROCS="$NUM_CPUS" + fi + echo "Set GOMAXPROCS=$GOMAXPROCS" + exec /bin/node_exporter "$0" "$@" image: quay.io/prometheus/node-exporter:v1.5.0 name: node-exporter resources: