Prometheus remote storage adapter, which stores timeseries data into RDBMS.
Currently, it suports only write operation.
You need to install golang for building.
make
then run,
./prometheus_sql_adapter web \
--listen '0.0.0.0:8080' \
# to use sqlite,
--db 'sqlite://file:/var/lib/sqlite/prometheus.db?cache=shared&mode=rwc'
# --db 'sqlite://file::memory:?cache=shared' # use in-memory db(for debugging)
# to use mysql,
# --db 'mysql://root:root@tcp(mysql-server-addr:3306)/db'
Write a docker-compose.yml like:
---
version: '3.7'
services:
prometheus_sql_adapter:
container_name: prometheus_sql_adapter
hostname: prometheus_sql_adapter
image: prometheus_sql_adapter
build:
context: ./
restart: always
command:
- 'web'
- '--listen'
- '0.0.0.0:8080'
- '--db'
# to use sqlite,
- 'sqlite://file:/var/lib/sqlite/prometheus.db?cache=shared&mode=rwc'
# - 'sqlite://file::memory:?cache=shared' # use in-memory db(for debugging)
# to use mysql,
# - 'mysql://root:root@tcp(mysql-server-addr:3306)/db'
then,
docker-comopse build # It takes long time. Be patient....
docker-comopse up -d
Write these line to /etc/prometheus/config.yml
remote_write:
- url: 'http://<hostname>:8080/write'
remote_read:
- url: 'http://<hostname>:8080/read'