node_exporter/checkmetrics.sh
Tobias Schmidt 2c433cdac3
Fix and simplify checkmetrics make target (#1731)
The checkmetrics target currently uses promtool v2.5.0 which doesn't
include many improvements done over the time. This change also
simplifies the promtool installation, avoiding a temporary directory by
extracting the file directly to the target destination.

Signed-off-by: Tobias Schmidt <tobidt@gmail.com>
2020-06-02 23:45:24 +02:00

17 lines
444 B
Bash
Executable File

#!/usr/bin/env bash
if [[ ( -z "$1" ) || ( -z "$2" ) ]]; then
echo "usage: ./checkmetrics.sh /usr/bin/promtool e2e-output.txt"
exit 1
fi
# Ignore known issues in auto-generated and network specific collectors.
lint=$($1 check metrics < "$2" 2>&1 | grep -v -E "^node_(entropy|memory|netstat|wifi_station)_")
if [[ -n $lint ]]; then
echo -e "Some Prometheus metrics do not follow best practices:\n"
echo "$lint"
exit 1
fi