aboutsummaryrefslogtreecommitdiff
path: root/nixos/modules/monitoring.nix
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2023-01-08 11:25:01 +0100
committerKarel Kočí <cynerd@email.cz>2023-01-08 11:25:01 +0100
commitd5dc7479c489d17e6dcacf081c0f1b5242d99bd9 (patch)
treec12d18231cacb81ff5b69a2073894d228e3c81e7 /nixos/modules/monitoring.nix
parentc7a226a92d65cedd384fa29083efdbb07a6084b0 (diff)
downloadnixos-personal-d5dc7479c489d17e6dcacf081c0f1b5242d99bd9.tar.gz
nixos-personal-d5dc7479c489d17e6dcacf081c0f1b5242d99bd9.tar.bz2
nixos-personal-d5dc7479c489d17e6dcacf081c0f1b5242d99bd9.zip
Format using Alejandra
Diffstat (limited to 'nixos/modules/monitoring.nix')
-rw-r--r--nixos/modules/monitoring.nix127
1 files changed, 74 insertions, 53 deletions
diff --git a/nixos/modules/monitoring.nix b/nixos/modules/monitoring.nix
index abeba2d..86a37e4 100644
--- a/nixos/modules/monitoring.nix
+++ b/nixos/modules/monitoring.nix
@@ -1,13 +1,13 @@
-{ config, lib, pkgs, ... }:
-
-with lib;
-
-let
-
-cnf = config.cynerd.monitoring;
-hostName = config.networking.hostName;
-isHost = cnf.host == hostName;
-
+{
+ config,
+ lib,
+ pkgs,
+ ...
+}:
+with lib; let
+ cnf = config.cynerd.monitoring;
+ hostName = config.networking.hostName;
+ isHost = cnf.host == hostName;
in {
options.cynerd.monitoring = {
enable = mkOption {
@@ -29,7 +29,7 @@ in {
};
config = mkMerge [
- { cynerd.monitoring.host = "errol"; }
+ {cynerd.monitoring.host = "errol";}
(mkIf cnf.enable {
# Telegraf configuration
@@ -38,53 +38,75 @@ in {
environmentFiles = ["/run/secrets/telegraf.env"];
extraConfig = {
agent = {};
- outputs.influxdb_v2 = [{
- urls = ["http://errol:8086"];
- token = "$INFLUX_TOKEN";
- organization = "personal";
- bucket = "monitoring";
- tagdrop.source = ["bigclown"]; # See home-assistant.nix
- }];
- inputs = {
- cpu = [{
- percpu = true;
- totalcpu = true;
- }];
- mem = [{}];
- swap = [{}];
- disk = [{
- ignore_fs = [
- "tmpfs" "devtmpfs" "devfs" "iso9660" "overlay" "aufs" "squashfs"
+ outputs.influxdb_v2 = [
+ {
+ urls = ["http://errol:8086"];
+ token = "$INFLUX_TOKEN";
+ organization = "personal";
+ bucket = "monitoring";
+ tagdrop.source = ["bigclown"]; # See home-assistant.nix
+ }
+ ];
+ inputs =
+ {
+ cpu = [
+ {
+ percpu = true;
+ totalcpu = true;
+ }
];
- }];
- diskio = [{}];
- net = [{}];
- system = [{}];
- processes = [{}];
- systemd_units = [{}];
- wireguard = [{}];
- } // (optionalAttrs cnf.hw {
- sensors = [{}];
- smart = [{
- path_smartctl = "${pkgs.smartmontools}/bin/smartctl";
- use_sudo = true;
- }];
- wireless = [{}];
- });
+ mem = [{}];
+ swap = [{}];
+ disk = [
+ {
+ ignore_fs = [
+ "tmpfs"
+ "devtmpfs"
+ "devfs"
+ "iso9660"
+ "overlay"
+ "aufs"
+ "squashfs"
+ ];
+ }
+ ];
+ diskio = [{}];
+ net = [{}];
+ system = [{}];
+ processes = [{}];
+ systemd_units = [{}];
+ wireguard = [{}];
+ }
+ // (optionalAttrs cnf.hw {
+ sensors = [{}];
+ smart = [
+ {
+ path_smartctl = "${pkgs.smartmontools}/bin/smartctl";
+ use_sudo = true;
+ }
+ ];
+ wireless = [{}];
+ });
};
};
- systemd.services.telegraf.path = with pkgs; [
- "/run/wrappers"
- ] ++ (optionals cnf.hw [
- lm_sensors smartmontools nvme-cli
- ]);
+ systemd.services.telegraf.path = with pkgs;
+ [
+ "/run/wrappers"
+ ]
+ ++ (optionals cnf.hw [
+ lm_sensors
+ smartmontools
+ nvme-cli
+ ]);
security.sudo.extraRules = [
{
users = ["telegraf"];
- commands = [{
- command = "${pkgs.smartmontools}/bin/smartctl";
- options = ["NOPASSWD"];
- }];
+ commands = [
+ {
+ command = "${pkgs.smartmontools}/bin/smartctl";
+ options = ["NOPASSWD"];
+ }
+ ];
}
];
})
@@ -112,6 +134,5 @@ in {
};
networking.firewall.allowedTCPPorts = [8086 3000];
})
-
];
}