Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add prometheus #221

Merged
merged 1 commit into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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<target>\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))"
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
5 changes: 3 additions & 2 deletions docker-grafana/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
4 changes: 4 additions & 0 deletions docker-grafana/provisioning/datasources/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,8 @@ datasources:
# httpHeaderValue1: "Bearer xf5yhfkpsnmgo"
# version: 1
# # <bool> allow users to edit datasources from the UI.
editable: true
- name: Prometheus-vertica-ce
url: http://prometheus:9090
type: prometheus
editable: true
16 changes: 16 additions & 0 deletions docker-prometheus/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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
18 changes: 18 additions & 0 deletions docker-prometheus/prometheus.yml
Original file line number Diff line number Diff line change
@@ -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']
10 changes: 8 additions & 2 deletions etc/VerticaPyLab.conf.default
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,24 @@ 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

#
# Spark
#
SPARK_VERSION=3.3.2

#
# Prometheus
#
PROM_VERSION=v2.48.0
PROM_VOLUME=prometheus-data

#
# Other
#