2022-05-16 01:09:41 +03:00
|
|
|
{ config, hosts, lib, pkgs, ... }:
|
2022-05-15 01:34:45 +03:00
|
|
|
let
|
|
|
|
myNode = hosts.${config.networking.hostName};
|
2022-05-16 01:09:41 +03:00
|
|
|
|
|
|
|
writeJSON = filename: data: pkgs.writeText filename (builtins.toJSON data);
|
|
|
|
|
|
|
|
relabel = from: to: {
|
|
|
|
source_labels = [ from ];
|
|
|
|
target_label = to;
|
|
|
|
};
|
2022-05-15 01:34:45 +03:00
|
|
|
in
|
|
|
|
{
|
2022-06-18 03:44:51 +03:00
|
|
|
# remote loki
|
|
|
|
links.loki = {
|
|
|
|
protocol = "http";
|
|
|
|
ipv4 = hosts.VEGAS.hypr.addr;
|
|
|
|
};
|
2022-05-16 01:09:41 +03:00
|
|
|
|
2022-05-31 22:03:44 +03:00
|
|
|
services.journald.extraConfig = "Storage=volatile";
|
|
|
|
|
2022-05-15 01:34:45 +03:00
|
|
|
services.prometheus.exporters = {
|
|
|
|
node = {
|
|
|
|
enable = true;
|
|
|
|
listenAddress = myNode.hypr.addr;
|
|
|
|
};
|
|
|
|
|
|
|
|
jitsi = {
|
|
|
|
enable = config.services.jitsi-meet.enable;
|
|
|
|
listenAddress = myNode.hypr.addr;
|
|
|
|
interval = "60s";
|
|
|
|
};
|
|
|
|
};
|
2022-05-16 01:09:41 +03:00
|
|
|
|
2022-06-18 20:47:02 +03:00
|
|
|
systemd.services.prometheus-node-exporter = {
|
|
|
|
after = [ "hyprspace.service" "sys-devices-virtual-net-hyprspace.device" ];
|
|
|
|
serviceConfig.RestartSec = "10s";
|
|
|
|
};
|
|
|
|
systemd.services.prometheus-jitsi-exporter = {
|
|
|
|
after = [ "hyprspace.service" "sys-devices-virtual-net-hyprspace.device" ];
|
|
|
|
serviceConfig.RestartSec = "10s";
|
|
|
|
};
|
2022-05-27 02:31:46 +03:00
|
|
|
|
2022-05-16 01:09:41 +03:00
|
|
|
systemd.services.promtail = {
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
|
|
|
|
serviceConfig = {
|
|
|
|
ExecStart = "${pkgs.grafana-loki}/bin/promtail --config.expand-env=true --config.file ${writeJSON "promtail.yaml" {
|
|
|
|
server.disable = true;
|
|
|
|
positions.filename = "\${STATE_DIRECTORY:/tmp}/promtail-positions.yaml";
|
|
|
|
clients = [
|
2022-06-18 03:44:51 +03:00
|
|
|
{ url = "${config.links.loki.url}/loki/api/v1/push"; }
|
2022-05-16 01:09:41 +03:00
|
|
|
];
|
|
|
|
scrape_configs = [
|
|
|
|
{
|
|
|
|
job_name = "journal";
|
|
|
|
journal = {
|
|
|
|
max_age = "12h";
|
|
|
|
labels.host = config.networking.hostName;
|
|
|
|
};
|
|
|
|
relabel_configs = [
|
|
|
|
(relabel "__journal__systemd_unit" "systemd_unit")
|
|
|
|
(relabel "__journal__hostname" "machine_name")
|
|
|
|
(relabel "__journal__exe" "executable")
|
|
|
|
(relabel "__journal__comm" "command")
|
|
|
|
(relabel "__journal__boot_id" "systemd_boot_id")
|
|
|
|
(relabel "__journal__systemd_cgroup" "systemd_cgroup")
|
|
|
|
(relabel "__journal_syslog_identifier" "syslog_identifier")
|
|
|
|
];
|
|
|
|
}
|
|
|
|
];
|
|
|
|
}}";
|
|
|
|
StateDirectory = "promtail";
|
|
|
|
};
|
|
|
|
};
|
2022-05-15 01:34:45 +03:00
|
|
|
}
|