diff options
author | Matt Layher <mdlayher@gmail.com> | 2018-02-13 12:04:03 -0500 |
---|---|---|
committer | Ben Kochie <superq@gmail.com> | 2018-02-13 18:04:03 +0100 |
commit | dcb31670d63235cdd0ff0de03fe283980ce4e543 (patch) | |
tree | f381f3927b63489e093b50dd52c42f314e610515 /checkmetrics.sh | |
parent | 3de2542d21da8b15db960677ad82a7d74d306714 (diff) | |
download | prometheus_node_collector-dcb31670d63235cdd0ff0de03fe283980ce4e543.tar.bz2 prometheus_node_collector-dcb31670d63235cdd0ff0de03fe283980ce4e543.tar.xz prometheus_node_collector-dcb31670d63235cdd0ff0de03fe283980ce4e543.zip |
Makefile: add checkmetrics target, use in CI (#797)
Diffstat (limited to 'checkmetrics.sh')
-rwxr-xr-x | checkmetrics.sh | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/checkmetrics.sh b/checkmetrics.sh new file mode 100755 index 0000000..5d846cc --- /dev/null +++ b/checkmetrics.sh | |||
@@ -0,0 +1,18 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | |||
3 | if [[ ( -z "$1" ) || ( -z "$2" ) ]]; then | ||
4 | echo "usage: ./checkmetrics.sh /usr/bin/promtool e2e-output.txt" | ||
5 | exit 1 | ||
6 | fi | ||
7 | |||
8 | # Only check node_exporter's metrics, as the Prometheus Go client currently | ||
9 | # exposes a metric with a unit of microseconds. Once that is fixed, remove | ||
10 | # this filter. | ||
11 | lint=$($1 check metrics < $2 2>&1 | grep "node_") | ||
12 | |||
13 | if [[ ! -z $lint ]]; then | ||
14 | echo -e "Some Prometheus metrics do not follow best practices:\n" | ||
15 | echo "$lint" | ||
16 | |||
17 | exit 1 | ||
18 | fi \ No newline at end of file | ||