Added loki logging and grafana provisioning

This commit is contained in:
Ben Wilson 2019-12-04 09:34:10 -05:00
parent 213948bb6a
commit 6a306bd495
6 changed files with 68 additions and 14 deletions

View File

@ -1,5 +1,5 @@
GF_ADMIN_USER=admin
GF_ADMIN_PASSWORD=notadmin
GF_SECURITY_ADMIN_USER=admin
GF_SECURITY_ADMIN_PASSWORD=notadmin
ZCASHD_RPCUSER=zcashrpc
ZCASHD_RPCPASSWORD=notsecure
ZCASHD_ALLOWIP=0.0.0.0/0

View File

@ -38,6 +38,12 @@ cp .env.exmaple .env
Edit `.env` if you have any specific changes.
### Install loki docker loging driver
```
docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions
```
#### Start docker-compose
Start with

View File

@ -13,9 +13,11 @@ services:
- ZCASHD_NETWORK=$ZCASHD_NETWORK
- ZCASHD_ALLOWIP=$ZCASHD_ALLOWIP
mem_limit: 4G
ports:
- "28332:28332"
- "18232:18232"
logging:
driver: loki
options:
loki-url: 'http://localhost:3100/api/prom/push'
zcashd_exporter:
build: .
environment:
@ -23,23 +25,55 @@ services:
- ZCASHD_RPCPASSWORD=$ZCASHD_RPCPASSWORD
command:
- --rpc.host=zcashd
- --rpc.port=18232
- --rpc.port=8232
- --rpc.user=$ZCASHD_RPCUSER
- --rpc.password=$ZCASHD_RPCPASSWORD
ports:
- "9100:9100"
logging:
driver: loki
options:
loki-url: 'http://localhost:3100/api/prom/push'
grafana:
image: grafana/grafana:6.4.3
entrypoint:
- bash
- -c
- grafana-cli plugins install grafana-piechart-panel && /run.sh
ports:
- "3000:3000"
environment:
- GF_ADMIN_USER=$GF_ADMIN_USER
- GF_ADMIN_PASSWORD=$GF_ADMIN_PASSWORD
- GF_SECURITY_ADMIN_USER=$GF_SECURITY_ADMIN_USER
- GF_SECURITY_ADMIN_PASSWORD=$GF_SECURITY_ADMIN_PASSWORD
volumes:
- ./docker/grafana/provisioning/:/etc/grafana/provisioning/
logging:
driver: loki
options:
loki-url: 'http://localhost:3100/api/prom/push'
prometheus:
image: prom/prometheus:v2.13.1
ports:
- "9090:9090"
volumes:
- ./docker/prometheus/config.yml:/etc/prometheus/prometheus.yml
- promethus_data:/promethus_data
logging:
driver: loki
options:
loki-url: 'http://localhost:3100/api/prom/push'
loki:
image: grafana/loki:master
ports:
- '3100:3100'
command: -config.file=/etc/loki/local-config.yaml
logging:
driver: loki
options:
loki-url: 'http://localhost:3100/api/prom/push'
volumes:
promethus_data:

View File

@ -0,0 +1,11 @@
apiVersion: 1
datasources:
- name: Loki
type: loki
access: proxy
orgId: 1
url: http://loki:3100
version: 1
editable: false
jsonData:
maxLines: 1000

View File

@ -0,0 +1,9 @@
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
access: proxy
orgId: 1
url: http://prometheus:9090
version: 1
editable: false

View File

@ -19,12 +19,6 @@ rule_files:
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
- job_name: 'prometheus'
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.
static_configs:
- targets: ['localhost:9090']
- job_name: 'zcashd_exporter'
static_configs:
- targets: ['zcashd_exporter:9100']