forked from retzkek/chiamon
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial commit with full docker-compose stack
- Loading branch information
0 parents
commit 2c4c015
Showing
11 changed files
with
653 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 Kevin M. Retzke | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# ChiaMon | ||
|
||
Example using [mtail](https://github.com/google/mtail) to collect metrics from | ||
[Chia](https://chia.net) logs, with | ||
[docker-compose](https://github.com/docker/compose/) stack to collect data with | ||
[Prometheus](https://prometheus.io/) and graph in | ||
[Grafana](https://grafana.com). | ||
|
||
## mtail program | ||
|
||
The mtail program is in `mtail/chialog.mtail`. Currently it only collects harvester metrics: | ||
|
||
* `chia_harvester_blocks_total`: cumulative number of block challenges attempted | ||
* `chia_harvester_plots_total`: current number of plots | ||
* `chia_harvester_plots_eligible`: cumulative number of plots that passed filter | ||
* `chia_harvester_proofs_total`: cumulative number of proofs won | ||
* `chia_harvester_search_time`: histogram of proof search times | ||
|
||
## Grafana dashboard | ||
|
||
The Grafana dashboard is in `grafana/dashboards/Chia.json`. It assumed the | ||
Prometheus datasource is named `Prometheus`, that the plotting drive is mounted | ||
at `/chia_tmp` and that the farming drives are mounted at `/farm*` (if your | ||
setup is different, change the dashboard, not your setup!). | ||
|
||
## Stack | ||
|
||
The docker-compose file will mount the Chia log from | ||
`$HOME/.chia/mainnet/log/debug.log`, verify that this location is correct and | ||
set the log level to INFO in the Chia configuration (usually at | ||
`$HOME/.chia/mainnet/config/config.yaml`): | ||
|
||
``` yaml | ||
log_level: INFO | ||
``` | ||
Run: | ||
docker-compose up -d | ||
This will do the following: | ||
* Build container image with configuration for mtail from source | ||
* Download node_exporter, prometheus, and grafana images from docker hub | ||
* Run containers in the background | ||
The grafana service provisions the prometheus datasource and a basic dashboard | ||
that displays harvester and node metrics. | ||
Access Grafana at http://localhost:3000 and login with the default admin/admin | ||
username and password (you'll be prompted to change the password). | ||
## Note | ||
This is not a production-ready deployment; there's no persistence of Prometheus | ||
data or the Grafana database, so changes will be lost when the services are | ||
recreated. To do that you'd want to bind-mount local paths to the respective | ||
data directories; consult each project's documentation for details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
version: '2' | ||
services: | ||
mtail: | ||
build: mtail | ||
command: | ||
- "-progs" | ||
- "/etc/mtail" | ||
- "-logs" | ||
- "/var/log/chia/debug.log" | ||
- "-logtostderr" | ||
volumes: | ||
- ${HOME}/.chia/mainnet/log/debug.log:/var/log/chia/debug.log | ||
node_exporter: | ||
image: quay.io/prometheus/node-exporter:latest | ||
command: | ||
- '--path.rootfs=/host' | ||
pid: host | ||
volumes: | ||
- '/:/host:ro,rslave' | ||
prometheus: | ||
build: prometheus | ||
ports: | ||
- "127.0.0.1:9090:9090" | ||
volumes: | ||
- prom_data:/prometheus | ||
grafana: | ||
build: grafana | ||
ports: | ||
- "127.0.0.1:3000:3000" | ||
volumes: | ||
prom_data: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
FROM grafana/grafana | ||
COPY dashboards /etc/grafana/dashboards/ | ||
COPY dashboards.yaml /etc/grafana/provisioning/dashboards/ | ||
COPY datasources.yaml /etc/grafana/provisioning/datasources/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
apiVersion: 1 | ||
|
||
providers: | ||
- name: 'default' | ||
orgId: 1 | ||
folder: '' | ||
type: file | ||
disableDeletion: false | ||
updateIntervalSeconds: 0 | ||
allowUiUpdates: true | ||
options: | ||
path: /etc/grafana/dashboards | ||
foldersFromFilesStructure: true | ||
|
Oops, something went wrong.