Skip to content

Instantly share code, notes, and snippets.

@alastairparagas
Created June 27, 2018 19:58
Show Gist options
  • Select an option

  • Save alastairparagas/2d5a0e7b5f22738ce0ae417b8b080f05 to your computer and use it in GitHub Desktop.

Select an option

Save alastairparagas/2d5a0e7b5f22738ce0ae417b8b080f05 to your computer and use it in GitHub Desktop.
Makefile for Go Prometheus
MAKEFLAGS += --warn-undefined-variables
.SHELLFLAGS := -o pipefail -euc
BUILD_DIRECTORY := $(shell pwd)/
GOPATH := $(BUILD_DIRECTORY)vendor/
GOBIN := $(BUILD_DIRECTORY)bin/
install:
@echo "---> Installing Promtool"
@GOPATH=$(GOPATH) GOBIN=$(GOBIN) go get github.com/prometheus/prometheus/cmd/promtool
@echo "---> Installing Prometheus"
@GOPATH=$(GOPATH) GOBIN=$(GOBIN) go get github.com/prometheus/prometheus/cmd/prometheus
@echo "---> Installing CloudProber CLI tool"
GOBIN=$(GOBIN) go install $(GOPATH)/src/github.com/google/cloudprober/cmd/cloudprober.go
@echo "---> Installing Amtool CLI tool"
@GOPATH=$(GOPATH) GOBIN=$(GOBIN) go get github.com/prometheus/alertmanager/cmd/amtool
@echo "---> Installing AlertManager CLI tool"
@GOPATH=$(GOPATH) GOBIN=$(GOBIN) go get github.com/prometheus/alertmanager/cmd/alertmanager
validate:
@echo "--> Validate Prometheus Config File"
$(GOBIN)promtool check config ./prometheus.yml
@echo "--> Validate Prometheus Alerts File"
$(GOBIN)promtool check rules ./prometheus-alerts.yml
clean:
rm -rf $(GOPATH)
rm -rf $(GOBIN)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment