Skip to content

Commit fb7d977

Browse files
committed
Add loki and update grafana
1 parent 627a8d6 commit fb7d977

File tree

9 files changed

+192
-2
lines changed

9 files changed

+192
-2
lines changed

dappnode_package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "This package privately and locally collects and displays metrics related to your dappnode and its packages. Based on Grafana and Prometheus. It is recommended to also install the package Node-Exporter if you want system metrics. You can find a guide on how to set up your monitoring system in the next link https://forum.dappnode.io/t/begginer-friendly-install-monitoring-system-on-dappnode-using-dms-package/623",
55
"shortDescription": "DAppNode Monitoring Service",
66
"type": "service",
7-
"architectures": ["linux/amd64", "linux/arm64"],
7+
"architectures": ["linux/amd64"],
88
"mainService": "grafana",
99
"author": "DAppNode Association <[email protected]> (https://github.com/dappnode)",
1010
"contributors": [

docker-compose-promtail.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
version: "3.4"
2+
services:
3+
grafana:
4+
build:
5+
context: grafana
6+
args:
7+
UPSTREAM_VERSION: 9.3.6
8+
image: "grafana.dms.dnp.dappnode.eth:1.0.1"
9+
restart: always
10+
volumes:
11+
- "grafana_data:/var/lib/grafana"
12+
prometheus:
13+
build:
14+
context: prometheus
15+
args:
16+
UPSTREAM_VERSION: v2.30.0
17+
image: "prometheus.dms.dnp.dappnode.eth:1.0.1"
18+
restart: always
19+
volumes:
20+
- "prometheus_data:/prometheus"
21+
- "prometheus_file_sd:/prometheus_file_sd"
22+
environment:
23+
DATA_RETENTION_DAYS: 15
24+
manager:
25+
build: ./manager
26+
image: "manager.dms.dnp.dappnode.eth:1.0.1"
27+
restart: always
28+
volumes:
29+
- "manager_data:/data"
30+
- "prometheus_file_sd:/prometheus_file_sd"
31+
loki:
32+
build:
33+
context: loki
34+
args:
35+
UPSTREAM_VERSION: 2.7.3
36+
command: "-config.file=/etc/loki/local-config.yaml"
37+
restart: always
38+
image: "loki.dms.dnp.dappnode.eth:1.0.1"
39+
promtail:
40+
build:
41+
context: promtail
42+
args:
43+
UPSTREAM_VERSION: 2.7.3
44+
volumes:
45+
- "/var/log:/var/log:ro"
46+
- "/var/lib/docker/containers:/var/lib/docker/containers:ro"
47+
command: "-config.file=/etc/promtail/config.yml"
48+
restart: always
49+
image: "promtail.dms.dnp.dappnode.eth:1.0.1"
50+
volumes:
51+
grafana_data: {}
52+
prometheus_data: {}
53+
manager_data: {}
54+
prometheus_file_sd: {}

docker-compose.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ services:
44
build:
55
context: grafana
66
args:
7-
UPSTREAM_VERSION: 8.1.8
7+
UPSTREAM_VERSION: 9.3.6
88
image: "grafana.dms.dnp.dappnode.eth:1.0.1"
99
restart: always
1010
volumes:
@@ -28,6 +28,14 @@ services:
2828
volumes:
2929
- "manager_data:/data"
3030
- "prometheus_file_sd:/prometheus_file_sd"
31+
loki:
32+
build:
33+
context: loki
34+
args:
35+
UPSTREAM_VERSION: 2.7.3
36+
command: "-config.file=/etc/loki/local-config.yaml"
37+
restart: always
38+
image: "loki.dms.dnp.dappnode.eth:1.0.1"
3139
volumes:
3240
grafana_data: {}
3341
prometheus_data: {}

grafana/datasource.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,11 @@ datasources:
99
basicAuth: false
1010
isDefault: true
1111
editable: true
12+
- name: loki
13+
type: loki
14+
access: proxy
15+
orgId: 1
16+
url: http://loki:3100
17+
basicAuth: false
18+
isDefault: false
19+
editable: true

loki/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
ARG UPSTREAM_VERSION
2+
3+
FROM grafana/loki:${UPSTREAM_VERSION}
4+
5+
COPY local-config.yaml /etc/loki/local-config.yaml

loki/local-config.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
auth_enabled: false
2+
3+
server:
4+
http_listen_port: 3100
5+
grpc_listen_port: 9096
6+
7+
common:
8+
instance_addr: 127.0.0.1
9+
path_prefix: /tmp/loki
10+
storage:
11+
filesystem:
12+
chunks_directory: /tmp/loki/chunks
13+
rules_directory: /tmp/loki/rules
14+
replication_factor: 1
15+
ring:
16+
kvstore:
17+
store: inmemory
18+
19+
query_range:
20+
results_cache:
21+
cache:
22+
embedded_cache:
23+
enabled: true
24+
max_size_mb: 100
25+
26+
schema_config:
27+
configs:
28+
- from: 2020-10-24
29+
store: boltdb-shipper
30+
object_store: filesystem
31+
schema: v11
32+
index:
33+
prefix: index_
34+
period: 24h
35+
36+
limits_config:
37+
ingestion_rate_mb: 1024
38+
ingestion_burst_size_mb: 1024
39+
40+
ruler:
41+
alertmanager_url: http://localhost:9093
42+
43+
# By default, Loki will send anonymous, but uniquely-identifiable usage and configuration
44+
# analytics to Grafana Labs. These statistics are sent to https://stats.grafana.org/
45+
#
46+
# Statistics help us better understand how Loki is used, and they show us performance
47+
# levels for most users. This helps us prioritize features and documentation.
48+
# For more information on what's sent, look at
49+
# https://github.com/grafana/loki/blob/main/pkg/usagestats/stats.go
50+
# Refer to the buildReport method to see what goes into a report.
51+
#
52+
# If you would like to disable reporting, uncomment the following lines:
53+
#analytics:
54+
# reporting_enabled: false

promtail/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
ARG UPSTREAM_VERSION
2+
3+
FROM grafana/promtail:${UPSTREAM_VERSION}
4+
5+
COPY config.yaml /etc/promtail/config.yml

promtail/config.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
server:
2+
http_listen_port: 9080
3+
grpc_listen_port: 0
4+
5+
positions:
6+
filename: /tmp/positions.yaml
7+
8+
clients:
9+
- url: http://loki:3100/loki/api/v1/push
10+
11+
scrape_configs:
12+
- job_name: system
13+
static_configs:
14+
- targets:
15+
- localhost
16+
labels:
17+
job: varlogs
18+
__path__: /var/log/*log
19+
- job_name: docker
20+
static_configs:
21+
- targets:
22+
- localhost
23+
labels:
24+
job: dockerlogs
25+
__path__: /var/lib/docker/containers/*/*log
26+
pipeline_stages:
27+
- json:
28+
expressions:
29+
output: log
30+
stream: stream
31+
attrs:
32+
- json:
33+
expressions:
34+
tag:
35+
source: attrs
36+
- regex:
37+
expression: (?P<image_name>(?:[^|]*[^|])).(?P<container_name>(?:[^|]*[^|])).(?P<image_id>(?:[^|]*[^|])).(?P<container_id>(?:[^|]*[^|]))
38+
source: tag
39+
- timestamp:
40+
format: RFC3339Nano
41+
source: time
42+
- labels:
43+
tag:
44+
stream:
45+
image_name:
46+
container_name:
47+
image_id:
48+
container_id:
49+
- output:
50+
source: output

releases.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,11 @@
4444
"uploadedTo": {
4545
"dappnode": "Wed, 25 Nov 2020 15:55:33 GMT"
4646
}
47+
},
48+
"1.0.1": {
49+
"hash": "/ipfs/QmT4XUd3zAwwGsVNY49BjMCshCk2NKTpP7MYToaMaLDUs3",
50+
"uploadedTo": {
51+
"http://ipfs.dappnode:5001": "Wed, 22 Feb 2023 07:12:48 GMT"
52+
}
4753
}
4854
}

0 commit comments

Comments
 (0)