diff --git a/Makefile b/Makefile index 520d1286..e5b472f0 100644 --- a/Makefile +++ b/Makefile @@ -31,6 +31,7 @@ QUERY?=select version(); SHELL:=/bin/bash SPARK_ENV_FILE:=docker-spark/docker/.env +GF_ENV_FILE:=docker-grafana/.env help: ## Display this help. @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-22s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' "$(firstword $(MAKEFILE_LIST))" @@ -190,11 +191,11 @@ spark-uninstall: spark-stop docker image rm mdouchement/hdfs # A set of command to handle grafana -docker-grafana/.env: ## Set environment variables to run grafana with docker-compose +$(GF_ENV_FILE): ## Set environment variables to run grafana with docker-compose @bin/grafana .PHONY: grafana-install -grafana-install: docker-grafana/.env ## Create grafana container +grafana-install: $(GF_ENV_FILE) ## Create grafana container cd docker-grafana && docker-compose up -d .PHONY: grafana-start @@ -208,7 +209,22 @@ grafana-stop: ## Stop grafana grafana-uninstall: grafana-stop## Remove the grafana container and its associated images @source etc/VerticaPyLab.conf; \ cd docker-grafana && docker-compose rm -f; \ - docker image rm grafana/grafana-oss:$$GF_VERSION + docker image rm grafana/grafana-enterprise:$$GF_VERSION + +# A set of commands to handle Prometheus +.PHONY: prom-start +prom-start: etc/VerticaPyLab.conf ## Start prometheus container + cd docker-prometheus && docker-compose up -d + +.PHONY: prom-stop +prom-stop: ## Stop prometheus + cd docker-prometheus && docker-compose stop + +.PHONY: prom-uninstall +prom-uninstall: prom-stop ## Remove the prometheus container and its associated images + @source etc/VerticaPyLab.conf; \ + cd docker-prometheus && docker-compose rm -f; \ + docker image rm prom/prometheus:$$PROM_VERSION # aliases for convenience start: all diff --git a/docker-grafana/docker-compose.yml b/docker-grafana/docker-compose.yml index 8ad05389..c91bdada 100644 --- a/docker-grafana/docker-compose.yml +++ b/docker-grafana/docker-compose.yml @@ -1,10 +1,11 @@ services: # My grafana service grafana: - image: grafana/grafana-oss:${GF_VERSION:-9.4.3} + image: grafana/grafana-enterprise:${GF_VERSION:-9.5.1} environment: - - GF_INSTALL_PLUGINS=vertica-grafana-datasource ${GF_VERTICA_PLUGIN_VERSION:-2.0.2} + - GF_INSTALL_PLUGINS=vertica-grafana-datasource ${GF_VERTICA_PLUGIN_VERSION:-2.1.0} - GF_AUTH_ANONYMOUS_ENABLED=true + - GF_AUTH_BASIC_ENABLED=false - GF_AUTH_ANONYMOUS_ORG_ROLE=Admin container_name: grafana ports: diff --git a/docker-grafana/provisioning/datasources/sample.yaml b/docker-grafana/provisioning/datasources/sample.yaml index 71a5bac7..7a08cc07 100644 --- a/docker-grafana/provisioning/datasources/sample.yaml +++ b/docker-grafana/provisioning/datasources/sample.yaml @@ -51,4 +51,8 @@ datasources: # httpHeaderValue1: "Bearer xf5yhfkpsnmgo" # version: 1 # # allow users to edit datasources from the UI. + editable: true + - name: Prometheus-vertica-ce + url: http://prometheus:9090 + type: prometheus editable: true \ No newline at end of file diff --git a/docker-prometheus/docker-compose.yml b/docker-prometheus/docker-compose.yml new file mode 100644 index 00000000..cdfb96b6 --- /dev/null +++ b/docker-prometheus/docker-compose.yml @@ -0,0 +1,16 @@ +version: '3' +services: + prometheus: + image: prom/prometheus:${PROM_VERSION:-v2.48.0} + volumes: + - "./prometheus.yml:/etc/prometheus/prometheus.yml" + - "prometheus-data:/prometheus" + ports: + - 9090:9090 +volumes: + prometheus-data: +networks: + default: + name: demo + driver: bridge + external: true \ No newline at end of file diff --git a/docker-prometheus/prometheus.yml b/docker-prometheus/prometheus.yml new file mode 100644 index 00000000..fed71e9b --- /dev/null +++ b/docker-prometheus/prometheus.yml @@ -0,0 +1,18 @@ +global: + scrape_interval: 10s +scrape_configs: + - job_name: prometheus + static_configs: + - targets: + - prometheus:9090 + - job_name: 'vertica' + scheme: https + basic_auth: + username: 'dbadmin' + password: '' + tls_config: + insecure_skip_verify: true + metrics_path: '/v1/metrics' + scrape_interval: 5s + static_configs: + - targets: ['verticadb:8443'] \ No newline at end of file diff --git a/etc/VerticaPyLab.conf.default b/etc/VerticaPyLab.conf.default index 7de0e2b2..5db6b76d 100644 --- a/etc/VerticaPyLab.conf.default +++ b/etc/VerticaPyLab.conf.default @@ -33,11 +33,11 @@ DOCKER_NETWORK=demo # # Grafana # -GF_VERSION=9.4.3 +GF_VERSION=9.5.1 GF_VERTICA_PLUGIN_VERSION=2.1.0 # Do not change this variable unless you want to run grafana on a diffrent port # either as standalone or together with VerticaPyLab(in this case you need to run -# `make verticapylab-build` to crete a custom image) +# `make verticapylab-build` to create a custom image) GF_PORT=3000 # @@ -45,6 +45,12 @@ GF_PORT=3000 # SPARK_VERSION=3.3.2 +# +# Prometheus +# +PROM_VERSION=v2.48.0 +PROM_VOLUME=prometheus-data + # # Other #