Compare commits

..

2 Commits

Author SHA1 Message Date
7e15151bec
Change monitoring 2024-12-03 00:29:35 +01:00
71b6ace553
Open port 5001 2024-12-03 00:18:13 +01:00
4 changed files with 57 additions and 37 deletions

View File

@ -1,37 +0,0 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
prometheus-node-exporter
prometheus-systemd-exporter
];
systemd.services."node-exporter" = {
enable = true;
unitConfig = {
Description = "Prometheus Node Exporter";
After = [ "network.target" ];
};
serviceConfig = {
ExecStart = "${pkgs.prometheus-node-exporter}/bin/node_exporter";
};
wantedBy = [ "multi-user.target" ];
};
systemd.services."systemd-exporter" = {
enable = true;
unitConfig = {
Description = "Prometheus Systemd Exporter";
After = [ "network.target" ];
};
serviceConfig = {
ExecStart = "${pkgs.prometheus-systemd-exporter}/bin/systemd_exporter";
};
wantedBy = [ "multi-user.target" ];
};
networking.firewall.allowedTCPPorts = [
9100
9558
8989
];
}

View File

@ -0,0 +1,7 @@
{ ... }:
{
imports = [
./metrics.nix
./logs.nix
];
}

View File

@ -0,0 +1,39 @@
{ ... }:
{
services.promtail = {
enable = true;
configuration = {
server = {
http_listen_address = "0.0.0.0";
http_listen_port = 9099;
grpc_listen_address = "0.0.0.0";
grpc_listen_port = 9098;
};
clients = [
{
url = "http://monitoring01.home.2rjus.net:3100/loki/api/v1/push";
}
];
scrape_configs = [
{
job_name = "journal";
journal = {
json = true;
};
relabel_configs = [
{
source_labels = [ "__journal__systemd_unit" ];
target_label = "systemd_unit";
}
{
source_labels = [ "__journal__hostname" ];
target_label = "host";
}
];
}
];
};
};
}

View File

@ -0,0 +1,11 @@
{ ... }:
{
services.prometheus.exporters.node = {
enable = true;
openFirewall = true;
enabledCollectors = [
"systemd"
"logind"
];
};
}