Compare commits

..

No commits in common. "7e15151bec920c4ba3750bbb7713814d7907d9f3" and "0f3820862ca4d3280b3c5a91b1c8ec54ee4a0e59" have entirely different histories.

4 changed files with 37 additions and 57 deletions

37
system/monitoring.nix Normal file
View File

@ -0,0 +1,37 @@
{ 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

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

View File

@ -1,39 +0,0 @@
{ ... }:
{
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

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