forked from tronprotocol/tron-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprometheus-loki.alloy
More file actions
93 lines (85 loc) · 2.71 KB
/
prometheus-loki.alloy
File metadata and controls
93 lines (85 loc) · 2.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
logging {
level = "info"
format = "logfmt"
}
// for java-tron node's metrics
prometheus.scrape "java_tron" {
targets = array.concat(
[{
__address__ = "127.0.0.1:9527",
group = "java-tron",
instance = "tron-docker-test-01",
}],
)
forward_to = [prometheus.remote_write.default.receiver]
job_name = "java-tron"
scrape_interval = "3s"
scrape_timeout = "3s"
}
// Add Unix exporter configuration
prometheus.exporter.unix "local" {
rootfs_path = "/host"
}
// Add relabel configuration for the Unix exporter
discovery.relabel "relabel_unix" {
targets = prometheus.exporter.unix.local.targets
rule {
action = "replace"
target_label = "instance"
replacement = env("HOSTNAME") // e.g., "my-server-01"
}
rule {
action = "replace"
target_label = "group"
replacement = "node-exporter-full" // Custom group name
}
rule {
action = "replace"
target_label = "job"
replacement = "java-tron"
}
}
// Add scrape configuration for the Unix exporter
prometheus.scrape "unix_metrics" {
targets = discovery.relabel.relabel_unix.output
forward_to = [prometheus.remote_write.default.receiver]
job_name = "node-exporter"
scrape_interval = "3s"
scrape_timeout = "3s"
}
prometheus.remote_write "default" {
external_labels = {
monitor = "java-tron-node-remote-write",
}
endpoint {
url = "http://xxxx/api/v1/receive"
remote_timeout = "10s"
headers = {
"X-Auth-Token" = "token",
"X-Service-Group" = "fullnode",
}
queue_config {
capacity = 55000
max_shards = 200
max_samples_per_send = 15000
batch_send_deadline = "6s"
min_backoff = "200ms"
}
metadata_config {
send_interval = "6s"
max_samples_per_send = 15000
}
}
}
// loki remote write
loki.source.file "tronlogs" {
targets = [
{__path__ = "/var/log/tron/tron.log", "instance" = env("HOSTNAME")},
]
forward_to = [loki.write.local.receiver]
}
loki.write "local" {
endpoint {
url = "http://xxxx/loki/api/v1/push"
}
}