diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..40c3d04 --- /dev/null +++ b/.env.example @@ -0,0 +1,9 @@ +GF_ADMIN_USER=admin +GF_ADMIN_PASSWORD=notadmin +ZCASHD_RPCUSER=zcashrpc +ZCASHD_RPCPASSWORD=notsecure +ZCASHD_ALLOWIP=0.0.0.0/0 +ZCASHD_DATADIR=/srv/zcashd/.zcash +ZCASHD_PARMDIR=/srv/zcashd/.zcash-params +ZCASHD_NETWORK=testnet +ZCASHD_GEN=0 diff --git a/.gitignore b/.gitignore index 495e5dc..1748322 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ zcashd_exporter +.env \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4222405 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM golang:1.13 + +ADD . /go/src/github.com/zcash-hackworks/zcashd_exporter + +RUN go get github.com/zcash-hackworks/zcashd_exporter +RUN go install github.com/zcash-hackworks/zcashd_exporter + +ENTRYPOINT ["zcashd_exporter"] +CMD ["--help"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..fe95872 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,45 @@ +--- +version: '2' + +services: + zcashd: + image: gcr.io/zcash-web/zcashd:latest + volumes: + - $ZCASHD_DATADIR:/srv/zcashd/.zcash + - $ZCASHD_PARMDIR:/srv/zcashd/.zcash-params + environment: + - ZCASHD_RPCUSER=$ZCASHD_RPCUSER + - ZCASHD_RPCPASSWORD=$ZCASHD_RPCPASSWORD + - ZCASHD_NETWORK=$ZCASHD_NETWORK + - ZCASHD_ALLOWIP=$ZCASHD_ALLOWIP + mem_limit: 4G + ports: + - "28332:28332" + - "18232:18232" + zcashd_exporter: + build: . + environment: + - ZCASHD_RPCUSER=$ZCASHD_RPCUSER + - ZCASHD_RPCPASSWORD=$ZCASHD_RPCPASSWORD + command: + - --rpc.host=zcashd + - --rpc.port=18232 + - --rpc.user=$ZCASHD_RPCUSER + - --rpc.password=$ZCASHD_RPCPASSWORD + ports: + - "9100:9100" + + grafana: + image: grafana/grafana:6.4.3 + ports: + - "3000:3000" + environment: + - GF_ADMIN_USER=$GF_ADMIN_USER + - GF_ADMIN_PASSWORD=$GF_ADMIN_PASSWORD + prometheus: + image: prom/prometheus:v2.13.1 + ports: + - "9090:9090" + volumes: + - ./docker/prometheus/config.yml:/etc/prometheus/prometheus.yml + diff --git a/docker/prometheus/config.yml b/docker/prometheus/config.yml new file mode 100644 index 0000000..31338ac --- /dev/null +++ b/docker/prometheus/config.yml @@ -0,0 +1,30 @@ +# my global config +global: + scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute. + evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute. + # scrape_timeout is set to the global default (10s). + +# Alertmanager configuration +alerting: + alertmanagers: + - static_configs: + - targets: + # - alertmanager:9093 + +# Load rules once and periodically evaluate them according to the global 'evaluation_interval'. +rule_files: + # - "first_rules.yml" + # - "second_rules.yml" + +# 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=` 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']