Compare commits
No commits in common. "7e15151bec920c4ba3750bbb7713814d7907d9f3" and "0f3820862ca4d3280b3c5a91b1c8ec54ee4a0e59" have entirely different histories.
7e15151bec
...
0f3820862c
37
system/monitoring.nix
Normal file
37
system/monitoring.nix
Normal 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
|
||||
];
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./metrics.nix
|
||||
./logs.nix
|
||||
];
|
||||
}
|
@ -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";
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
{ ... }:
|
||||
{
|
||||
services.prometheus.exporters.node = {
|
||||
enable = true;
|
||||
openFirewall = true;
|
||||
enabledCollectors = [
|
||||
"systemd"
|
||||
"logind"
|
||||
];
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user