Skip to content

Commit 980909f

Browse files
committed
Update README
Signed-off-by: Vitaly Zhuravlev <[email protected]>
1 parent de1efae commit 980909f

File tree

1 file changed

+45
-1
lines changed

1 file changed

+45
-1
lines changed

docs/node-mixin/README.md

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ _This is a work in progress. We aim for it to become a good role model for alert
44
and dashboards eventually, but it is not quite there yet._
55

66
The Node Mixin is a set of configurable, reusable, and extensible alerts and
7-
dashboards based on the metrics exported by the Node Exporter. The mixin creates
7+
dashboards based on the metrics exported by the Node Exporter and logs by Loki(optional). The mixin creates
88
recording and alerting rules for Prometheus and suitable dashboard descriptions
99
for Grafana.
1010

@@ -40,3 +40,47 @@ the previously generated `node_rules.yaml`.
4040
For more advanced uses of mixins, see
4141
https://github.com/monitoring-mixins/docs.
4242

43+
## Loki Logs configuration
44+
45+
To enable logs support in Node Mixin, enable them in config.libsonnet first:
46+
47+
```
48+
{
49+
_config+:: {
50+
enableLokiLogs: true,
51+
},
52+
}
53+
54+
```
55+
56+
then run
57+
```bash
58+
$ make build
59+
```
60+
61+
This would generate extra Logs row on dashboards.
62+
63+
For proper logs correlation, you need to make sure that `job` and `instance` labels values match for both node_exporter metrics and logs, collected by [Promtail](https://grafana.com/docs/loki/latest/clients/promtail/) or [Grafana Agent](https://grafana.com/docs/grafana-cloud/agent/).
64+
65+
To scrape system logs, the following promtail config snippet can be used for `job=integrations/node` and `instance=host-01`:
66+
67+
```yaml
68+
configs:
69+
- name: integrations
70+
scrape_configs:
71+
- job_name: integrations/node_exporter_journal_scrape
72+
journal:
73+
max_age: 24h
74+
labels:
75+
instance: host-01
76+
job: integrations/node
77+
relabel_configs:
78+
- source_labels: ['__journal__systemd_unit']
79+
target_label: 'unit'
80+
- source_labels: ['__journal__boot_id']
81+
target_label: 'boot_id'
82+
- source_labels: ['__journal__transport']
83+
target_label: 'transport'
84+
- source_labels: ['__journal_priority_keyword']
85+
target_label: 'level'
86+
```

0 commit comments

Comments
 (0)