mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
fix(monitoring): node exporter collectors
This commit is contained in:
parent
ab9e4b52d4
commit
c31fcdcdbd
2 changed files with 56 additions and 22 deletions
21
modules/extern/nixos/monitoring.nix
vendored
21
modules/extern/nixos/monitoring.nix
vendored
|
|
@ -8,6 +8,7 @@ let
|
|||
}: let
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.modules) mkIf mkMerge mkDefault mkOptionDefault;
|
||||
inherit (lib.lists) elem;
|
||||
inherit (gensokyo-zone.lib) mkAlmostOptionDefault mapOptionDefaults unmerged domain;
|
||||
inherit (nixosConfig.gensokyo-zone) access;
|
||||
in {
|
||||
|
|
@ -61,14 +62,17 @@ let
|
|||
in {
|
||||
enable = mkDefault true;
|
||||
port = mkDefault 9091;
|
||||
extraFlags = [ "--collector.disable-defaults" ];
|
||||
enabledCollectors = mkIf cfg.defaultCollectors (mkMerge [
|
||||
[
|
||||
"systemd"
|
||||
"logind"
|
||||
"arp"
|
||||
"cpu"
|
||||
"entropy"
|
||||
"filesystem"
|
||||
"netdev"
|
||||
"ethtool"
|
||||
"sysctl"
|
||||
"loadavg"
|
||||
"meminfo"
|
||||
|
|
@ -78,6 +82,12 @@ let
|
|||
"uname"
|
||||
"vmstat"
|
||||
]
|
||||
(mkIf nixosConfig.boot.supportedFilesystems.btrfs or false [
|
||||
"btrfs"
|
||||
])
|
||||
(mkIf nixosConfig.boot.supportedFilesystems.xfs or false [
|
||||
"xfs"
|
||||
])
|
||||
(mkIf nixosConfig.boot.supportedFilesystems.zfs or false [
|
||||
"zfs"
|
||||
])
|
||||
|
|
@ -91,6 +101,17 @@ let
|
|||
"nvme"
|
||||
"hwmon"
|
||||
])
|
||||
(mkIf (nixosConfig.services.xserver.enable && elem "amdgpu" nixosConfig.services.xserver.videoDrivers) [
|
||||
"drm"
|
||||
])
|
||||
(mkIf (nixosConfig.networking.wireless.enable || nixosConfig.networking.wireless.iwd.enable || nixosConfig.networking.networkmanager.enable) [
|
||||
"wifi"
|
||||
])
|
||||
(mkIf nixosConfig.powerManagement.enable [
|
||||
"thermal_zone"
|
||||
"powersupplyclass"
|
||||
"rapl"
|
||||
])
|
||||
]);
|
||||
};
|
||||
promtail = let
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
}: let
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.attrsets) attrValues;
|
||||
inherit (lib.lists) concatMap toList;
|
||||
inherit (lib.lists) concatMap toList elem;
|
||||
allExporters = let
|
||||
exporters = removeAttrs config.services.prometheus.exporters ["unifi-poller"];
|
||||
in
|
||||
|
|
@ -13,27 +13,38 @@
|
|||
in {
|
||||
config = {
|
||||
services.prometheus.exporters = {
|
||||
node = mkMerge [
|
||||
{
|
||||
#enable = true;
|
||||
port = 9091;
|
||||
enabledCollectors = [
|
||||
node = {
|
||||
port = 9091;
|
||||
extraFlags = [ "--collector.disable-defaults" ];
|
||||
enabledCollectors = mkMerge [
|
||||
(mkIf config.boot.supportedFilesystems.xfs or false [
|
||||
"xfs"
|
||||
])
|
||||
(mkIf config.boot.supportedFilesystems.zfs or false [
|
||||
"zfs"
|
||||
])
|
||||
(mkIf config.boot.supportedFilesystems.nfs or config.boot.supportedFilesystems.nfs4 or false [
|
||||
"nfs"
|
||||
];
|
||||
}
|
||||
(mkIf config.services.nfs.server.enable {
|
||||
enabledCollectors = [
|
||||
])
|
||||
(mkIf config.services.nfs.server.enable [
|
||||
"nfsd"
|
||||
];
|
||||
})
|
||||
(mkIf (!config.boot.isContainer) {
|
||||
enabledCollectors = [
|
||||
])
|
||||
(mkIf (!config.boot.isContainer) [
|
||||
"nvme"
|
||||
"hwmon"
|
||||
];
|
||||
})
|
||||
{
|
||||
enabledCollectors = [
|
||||
"thermal_zone"
|
||||
])
|
||||
(mkIf config.powerManagement.enable [
|
||||
"powersupplyclass"
|
||||
"rapl"
|
||||
])
|
||||
(mkIf (config.services.xserver.enable && elem "amdgpu" config.services.xserver.videoDrivers) [
|
||||
"drm"
|
||||
])
|
||||
(mkIf (config.networking.wireless.enable || config.networking.wireless.iwd.enable || config.networking.networkmanager.enable) [
|
||||
"wifi"
|
||||
])
|
||||
[
|
||||
"arp"
|
||||
"cpu"
|
||||
"cpufreq"
|
||||
|
|
@ -44,6 +55,9 @@ in {
|
|||
"netdev"
|
||||
"sysctl"
|
||||
"systemd"
|
||||
"ethtool"
|
||||
"logind"
|
||||
"cgroups"
|
||||
"loadavg"
|
||||
"meminfo"
|
||||
"netstat"
|
||||
|
|
@ -52,10 +66,9 @@ in {
|
|||
"time"
|
||||
"uname"
|
||||
"vmstat"
|
||||
"zfs"
|
||||
];
|
||||
}
|
||||
];
|
||||
]
|
||||
];
|
||||
};
|
||||
};
|
||||
networking.firewall.interfaces.lan.allowedTCPPorts =
|
||||
map (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue