Compare commits
2 Commits
0f3820862c
...
7e15151bec
Author | SHA1 | Date | |
---|---|---|---|
7e15151bec | |||
71b6ace553 |
system
@ -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
|
||||
];
|
||||
}
|
7
system/monitoring/default.nix
Normal file
7
system/monitoring/default.nix
Normal file
@ -0,0 +1,7 @@
|
||||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./metrics.nix
|
||||
./logs.nix
|
||||
];
|
||||
}
|
39
system/monitoring/logs.nix
Normal file
39
system/monitoring/logs.nix
Normal 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";
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
11
system/monitoring/metrics.nix
Normal file
11
system/monitoring/metrics.nix
Normal file
@ -0,0 +1,11 @@
|
||||
{ ... }:
|
||||
{
|
||||
services.prometheus.exporters.node = {
|
||||
enable = true;
|
||||
openFirewall = true;
|
||||
enabledCollectors = [
|
||||
"systemd"
|
||||
"logind"
|
||||
];
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user