Created
March 11, 2024 22:36
-
-
Save rspier/7f058254f370877218ad4f0d831cf6b1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
COMMON=--restart=unless-stopped | |
default: | |
all-start: | |
egrep ^start Makefile | cut -d: -f1 | xargs make | |
# -p 9090:9090 | |
start-prometheus: | |
docker run -d \ | |
$(COMMON) \ | |
--name prometheus \ | |
--net=host \ | |
--user $(shell id -u) \ | |
-v /home/myusername/prom:/prometheus -v /etc/resolv.conf:/etc/resolv.conf \ | |
prom/prometheus --config.file=/prometheus/cfg/prometheus.yml --web.enable-lifecycle --web.external-url="https://www.mydomain.com/prometheus/" | |
pull-prometheus: | |
docker pull prom/prometheus | |
# -p 9093:9093 | |
start-alertmanager: | |
docker run -d \ | |
$(COMMON) \ | |
--name alertmanager \ | |
--net=host \ | |
--user $(shell id -u) \ | |
-v /home/myusername/prom:/prometheus \ | |
-v /etc/resolv.conf:/etc/resolv.conf \ | |
-v /home/myusername/prom/data/alertmanager:/alertmanager/data \ | |
prom/alertmanager --config.file=/prometheus/cfg/alertmanager.yml --web.external-url="https://www.mydomain.com/alertmanager/" | |
# --user is so it has permission to write to the data directory. | |
pull-alertmanager: | |
docker pull prom/alertmanager | |
refresh-ecobee: | |
go-ecobee status | |
# copy unnecessary because of hardlink | |
# cp -p ~/.go-ecobee-authcache ecobee/authcache | |
start-blackbox: | |
docker run -d \ | |
$(COMMON) \ | |
--name blackbox-exporter \ | |
-p 9115:9115 \ | |
--net=host \ | |
-v /home/myusername/prom/:/prometheus \ | |
prom/blackbox-exporter:master \ | |
--config.file=/prometheus/cfg/blackbox.yml | |
pull-blackbox: | |
docker pull prom/blackbox-exporter:master | |
start-grafana: | |
docker run \ | |
-d \ | |
$(COMMON) \ | |
-p 3000:3000 \ | |
--name=grafana \ | |
--net=host \ | |
-e "GF_SERVER_ROOT_URL=https://www.mydomain.com/grafana" \ | |
-e "GF_SERVER_STATIC_ROOT_PATH=/usr/share/grafana/public" \ | |
-v /home/myusername/prom/grafana:/var/lib/grafana \ | |
--user $(shell id -u) \ | |
grafana/grafana | |
pull-grafana: | |
docker pull grafana/grafana | |
start-pushgateway: | |
docker run \ | |
-d \ | |
$(COMMON) \ | |
-p 9091:9091 \ | |
--name=pushgateway \ | |
--net=host \ | |
-v /home/myusername/prom/data:/data \ | |
--user $(shell id -u) \ | |
prom/pushgateway \ | |
--persistence.file=/data/pushgateway.persist | |
pull-pushgateway: | |
docker pull prom/pushgateway | |
start-collectd-exporter: | |
docker run \ | |
$(COMMON) \ | |
-d \ | |
--net=host \ | |
-p 9103:9103 -p 25826:25826/udp \ | |
--name="collectd-exporter" \ | |
prom/collectd-exporter \ | |
--collectd.listen-address=":25826" | |
pull-collectd-exporter: | |
docker pull prom/collectd-exporter | |
start-mqtt2prom: | |
docker run \ | |
-d \ | |
$(COMMON) \ | |
-p 9641:9641 \ | |
--name=mqtt2prom \ | |
--net=host \ | |
-v /home/myusername/prom/cfg:/cfg \ | |
--user $(shell id -u) \ | |
mqtt2prometheus:latest \ | |
/mqtt2prometheus \ | |
--config=/cfg/tasmota_s31.yaml | |
# SUBSYSTEM=="usbmisc", ATTRS{idVendor}=="0764", ATTRS{idProduct}=="0601", MODE:="664", GROUP="plugdev", SYMLINK+="cybups_dev" | |
start-pwrstat-exporter: | |
docker run \ | |
--name pwrstat-exporter \ | |
--device /dev/bus/usb:/dev/bus/usb \ | |
--device /dev/cybups_dev:/dev/usb/hiddev0 \ | |
--privileged \ | |
--restart unless-stopped \ | |
-p 9651:8088 \ | |
-d cardif99/pwrstat-exporter:latest | |
pull-pwrstat-exporter: | |
docker pull cardif99/pwrstat-exporter:latest | |
stop-pwrstat-exporter: | |
docker stop pwrstat-exporter | |
docker rm pwrstat-exporter | |
stop-prometheus: | |
-docker stop prometheus | |
-docker rm prometheus | |
stop-alertmanager: | |
-docker stop alertmanager | |
-docker rm alertmanager | |
stop-blackbox: | |
-docker stop blackbox-exporter | |
-docker rm blackbox-exporter | |
stop-grafana: | |
-docker stop grafana | |
-docker rm grafana | |
stop-pushgateway: | |
-docker stop pushgateway | |
-docker rm pushgateway | |
stop-collectd-exporter: | |
-docker stop collectd-exporter | |
-docker rm collectd-exporter | |
restart-prometheus: stop-prometheus start-prometheus | |
restart-alertmanager: stop-alertmanager start-alertmanager | |
restart-blackbox: stop-blackbox start-blackbox | |
restart-grafana: stop-grafana start-grafana | |
restart-pushgateway: stop-pushgateway start-pushgateway | |
restart-collectd-exporter: stop-collectd-exporter start-collectd-exporter | |
restart-pwrstat-exporter: stop-pwrstat-exporter start-pwrstat-exporter | |
restart-all: restart-prometheus restart-alertmanager \ | |
restart-blackbox restart-grafana restart-pushgateway \ | |
restart-collectd-exporter restart-pwrstat-exporter | |
reload-prometheus: check-prometheus | |
curl -X POST http://localhost:9090/prometheus/-/reload | |
reload-alertmanager: check-alertmanager | |
curl -X POST http://localhost:9093/alertmanager/-/reload | |
reload-blackbox: check-blackbox | |
curl -X POST http://localhost:9115/-/reload | |
reload: reload-prometheus reload-alertmanager reload-blackbox | |
lint: lint-prometheus | |
lint-prometheus: | |
pint lint cfg/prom_rules.yml | |
check-prometheus: | |
docker run --rm -v /home/myusername/prom:/prometheus --entrypoint promtool prom/prometheus check config /prometheus/cfg/prometheus.yml | |
test-prometheus: | |
docker run --rm -v /home/myusername/prom:/prometheus --entrypoint promtool prom/prometheus test rules /prometheus/cfg/tests.yml | |
check-alertmanager: | |
docker run --rm -v /home/myusername/prom:/prometheus --entrypoint amtool prom/alertmanager \ | |
check-config /prometheus/cfg/alertmanager.yml | |
check-blackbox: | |
docker run --rm \ | |
-v /home/myusername/prom/:/prometheus \ | |
prom/blackbox-exporter \ | |
--config.file=/prometheus/cfg/blackbox.yml \ | |
--config.check | |
AMURL=http://localhost:9093/alertmanager/ | |
amtool-alert: | |
amtool alert --alertmanager.url="${AMURL}" | |
test: check | |
check: check-prometheus check-alertmanager check-blackbox lint | |
pull-all: pull-prometheus pull-alertmanager pull-blackbox pull-grafana pull-pushgateway pull-collectd-exporter | |
restart-pulled: restart-prometheus restart-alertmanager restart-blackbox restart-grafana restart-pushgateway restart-collectd-exporter | |
# end # |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment