cluster/services/monitoring: refactor
This commit is contained in:
parent
9b5e44461e
commit
6624e2b7c7
1 changed files with 22 additions and 24 deletions
|
@ -1,6 +1,6 @@
|
||||||
{ cluster, lib, ... }:
|
{ cluster, lib, ... }:
|
||||||
let
|
let
|
||||||
myNode = cluster.config.vars.mesh.${cluster.config.vars.hostName};
|
inherit (lib) singleton;
|
||||||
|
|
||||||
relabel = from: to: {
|
relabel = from: to: {
|
||||||
source_labels = [ from ];
|
source_labels = [ from ];
|
||||||
|
@ -12,7 +12,7 @@ in {
|
||||||
services.grafana-agent = {
|
services.grafana-agent = {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = {
|
settings = {
|
||||||
metrics.global.remote_write = lib.singleton {
|
metrics.global.remote_write = singleton {
|
||||||
url = "${cluster.config.links.prometheus-ingest.url}/api/v1/write";
|
url = "${cluster.config.links.prometheus-ingest.url}/api/v1/write";
|
||||||
};
|
};
|
||||||
integrations.node_exporter = {
|
integrations.node_exporter = {
|
||||||
|
@ -22,30 +22,28 @@ in {
|
||||||
"systemd"
|
"systemd"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
logs.configs = lib.singleton {
|
logs.configs = singleton {
|
||||||
name = "logging";
|
name = "logging";
|
||||||
positions.filename = "\${STATE_DIRECTORY:/tmp}/logging-positions.yaml";
|
positions.filename = "\${STATE_DIRECTORY:/tmp}/logging-positions.yaml";
|
||||||
clients = [
|
clients = singleton {
|
||||||
{ url = "${cluster.config.links.loki-ingest.url}/loki/api/v1/push"; }
|
url = "${cluster.config.links.loki-ingest.url}/loki/api/v1/push";
|
||||||
];
|
};
|
||||||
scrape_configs = [
|
scrape_configs = singleton {
|
||||||
{
|
job_name = "journal";
|
||||||
job_name = "journal";
|
journal = {
|
||||||
journal = {
|
max_age = "12h";
|
||||||
max_age = "12h";
|
labels.host = cluster.config.vars.hostName;
|
||||||
labels.host = cluster.config.vars.hostName;
|
};
|
||||||
};
|
relabel_configs = [
|
||||||
relabel_configs = [
|
(relabel "__journal__systemd_unit" "systemd_unit")
|
||||||
(relabel "__journal__systemd_unit" "systemd_unit")
|
(relabel "__journal__hostname" "machine_name")
|
||||||
(relabel "__journal__hostname" "machine_name")
|
(relabel "__journal__exe" "executable")
|
||||||
(relabel "__journal__exe" "executable")
|
(relabel "__journal__comm" "command")
|
||||||
(relabel "__journal__comm" "command")
|
(relabel "__journal__boot_id" "systemd_boot_id")
|
||||||
(relabel "__journal__boot_id" "systemd_boot_id")
|
(relabel "__journal__systemd_cgroup" "systemd_cgroup")
|
||||||
(relabel "__journal__systemd_cgroup" "systemd_cgroup")
|
(relabel "__journal_syslog_identifier" "syslog_identifier")
|
||||||
(relabel "__journal_syslog_identifier" "syslog_identifier")
|
];
|
||||||
];
|
};
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue