Compare commits
3 commits
3025145ec6
...
513c2327fd
Author | SHA1 | Date | |
---|---|---|---|
513c2327fd | |||
433966c433 | |||
d1f8cc2e84 |
7 changed files with 60 additions and 1 deletions
|
@ -161,6 +161,7 @@
|
||||||
home-manager.useUserPackages = true;
|
home-manager.useUserPackages = true;
|
||||||
home-manager.extraSpecialArgs = {
|
home-manager.extraSpecialArgs = {
|
||||||
packagesPath = ./packages;
|
packagesPath = ./packages;
|
||||||
|
hostsPath = ./hosts;
|
||||||
};
|
};
|
||||||
home-manager.sharedModules = [
|
home-manager.sharedModules = [
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,5 +5,6 @@
|
||||||
# ./docker-registry-proxy.nix
|
# ./docker-registry-proxy.nix
|
||||||
./nginx.nix
|
./nginx.nix
|
||||||
./renovate.nix
|
./renovate.nix
|
||||||
|
./prometheus.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
17
hosts/istal/services/prometheus.nix
Normal file
17
hosts/istal/services/prometheus.nix
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{ config, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
services.prometheus.exporters.node = {
|
||||||
|
enable = true;
|
||||||
|
port = 40000;
|
||||||
|
# https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/services/monitoring/prometheus/exporters.nix
|
||||||
|
enabledCollectors = [ "systemd" ];
|
||||||
|
# /nix/store/zgsw0yx18v10xa58psanfabmg95nl2bb-node_exporter-1.8.1/bin/node_exporter --help
|
||||||
|
extraFlags = [ "--collector.ethtool" "--collector.softirqs" "--collector.tcpstat" "--collector.wifi" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
networking.firewall.allowedTCPPorts = [
|
||||||
|
config.services.prometheus.exporters.node.port
|
||||||
|
];
|
||||||
|
|
||||||
|
}
|
|
@ -2,10 +2,11 @@
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./grafana
|
|
||||||
./miniflux
|
./miniflux
|
||||||
./wireguard
|
./wireguard
|
||||||
./nginx.nix
|
./nginx.nix
|
||||||
./dns.nix
|
./dns.nix
|
||||||
|
./grafana.nix
|
||||||
|
./prometheus.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
39
hosts/tatos/services/prometheus.nix
Normal file
39
hosts/tatos/services/prometheus.nix
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
{ config, hostsPath, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
istalData = import (hostsPath + "/istal/data.secret.nix");
|
||||||
|
nodeExporterPort = 40000;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
services.prometheus.exporters.node = {
|
||||||
|
enable = true;
|
||||||
|
port = nodeExporterPort;
|
||||||
|
# https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/services/monitoring/prometheus/exporters.nix
|
||||||
|
enabledCollectors = [ "systemd" ];
|
||||||
|
# /nix/store/zgsw0yx18v10xa58psanfabmg95nl2bb-node_exporter-1.8.1/bin/node_exporter --help
|
||||||
|
extraFlags = [ "--collector.ethtool" "--collector.softirqs" "--collector.tcpstat" "--collector.wifi" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
# https://wiki.nixos.org/wiki/Prometheus
|
||||||
|
# https://nixos.org/manual/nixos/stable/#module-services-prometheus-exporters-configuration
|
||||||
|
# https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/services/monitoring/prometheus/default.nix
|
||||||
|
services.prometheus = {
|
||||||
|
enable = true;
|
||||||
|
listenAddress = "127.0.0.1";
|
||||||
|
port = 33010;
|
||||||
|
globalConfig.scrape_interval = "15s"; # "1m"
|
||||||
|
scrapeConfigs = [
|
||||||
|
{
|
||||||
|
job_name = "node_dev";
|
||||||
|
static_configs = [
|
||||||
|
{
|
||||||
|
targets = [
|
||||||
|
"localhost:${toString nodeExporterPort}"
|
||||||
|
"${istalData.addr}:${toString nodeExporterPort}"
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
Binary file not shown.
Loading…
Add table
Reference in a new issue