diff options
Diffstat (limited to 'lass/3modules')
-rw-r--r-- | lass/3modules/default.nix | 3 | ||||
-rw-r--r-- | lass/3modules/kapacitor.nix | 143 | ||||
-rw-r--r-- | lass/3modules/telegraf.nix | 84 | ||||
-rw-r--r-- | lass/3modules/urxvtd.nix | 55 |
4 files changed, 0 insertions, 285 deletions
diff --git a/lass/3modules/default.nix b/lass/3modules/default.nix index 2bf2df8b3..959c9d1b4 100644 --- a/lass/3modules/default.nix +++ b/lass/3modules/default.nix @@ -6,10 +6,7 @@ _: ./hosts.nix ./mysql-backup.nix ./umts.nix - ./urxvtd.nix ./usershadow.nix ./xresources.nix - ./kapacitor.nix - ./telegraf.nix ]; } diff --git a/lass/3modules/kapacitor.nix b/lass/3modules/kapacitor.nix deleted file mode 100644 index 299a56d92..000000000 --- a/lass/3modules/kapacitor.nix +++ /dev/null @@ -1,143 +0,0 @@ -{ config, lib, pkgs, ... }: - -with builtins; -with lib; - -let - cfg = config.lass.kapacitor; - - out = { - options.lass.kapacitor = api; - config = mkIf cfg.enable imp; - }; - - api = { - enable = mkEnableOption "kapacitor"; - dataDir = mkOption { - type = types.str; - default = "/var/lib/kapacitor"; - }; - user = mkOption { - type = types.str; - default = "kapacitor"; - }; - logLevel = mkOption { - type = types.enum ["DEBUG" "INFO" "WARN" "ERROR" "OFF"]; - default = "INFO"; - }; - alarms = mkOption { - type = with types; attrsOf str; - default = {}; - }; - check_db = mkOption { - type = types.str; - default = "all_data"; - }; - config = mkOption { - type = types.str; - #TODO: find a good default - default = '' - hostname = "localhost" - data_dir = "${cfg.dataDir}" - - [http] - bind-address = ":9092" - auth-enabled = false - log-enabled = true - write-tracing = false - pprof-enabled = false - https-enabled = false - https-certificate = "/etc/ssl/kapacitor.pem" - shutdown-timeout = "10s" - shared-secret = "" - - [replay] - dir = "${cfg.dataDir}/replay" - - [storage] - boltdb = "${cfg.dataDir}/kapacitor.db" - - [task] - dir = "${cfg.dataDir}/tasks" - snapshot-interval = "1m0s" - - [[influxdb]] - enabled = true - name = "default" - default = false - urls = ["http://localhost:8086"] - username = "" - password = "" - ssl-ca = "" - ssl-cert = "" - ssl-key = "" - insecure-skip-verify = false - timeout = "0s" - disable-subscriptions = false - subscription-protocol = "http" - udp-bind = "" - udp-buffer = 1000 - udp-read-buffer = 0 - startup-timeout = "5m0s" - subscriptions-sync-interval = "1m0s" - [influxdb.subscriptions] - [influxdb.excluded-subscriptions] - _kapacitor = ["autogen"] - - [logging] - file = "STDERR" - level = "${cfg.logLevel}" - - [deadman] - interval = "10s" - threshold = 0.0 - id = "{{ .Group }}:NODE_NAME for task '{{ .TaskName }}'" - message = "{{ .ID }} is {{ if eq .Level \"OK\" }}alive{{ else }}dead{{ end }}: {{ index .Fields \"emitted\" | printf \"%0.3f\" }} points/INTERVAL." - global = false - ''; - description = "configuration kapacitor is started with"; - }; - }; - - configFile = pkgs.writeText "kapacitor.conf" cfg.config; - - imp = { - - systemd.services.kapacitor = { - description = "kapacitor"; - after = [ "network.target" ]; - wantedBy = [ "multi-user.target" ]; - - restartIfChanged = true; - - serviceConfig = { - Restart = "always"; - ExecStart = "${pkgs.kapacitor}/bin/kapacitord -config ${configFile}"; - }; - }; - - systemd.services.kapacitor-alarms = { - description = "kapacitor-alarms"; - after = [ "kapacitor.service" ]; - wantedBy = [ "multi-user.target" ]; - - restartIfChanged = true; - - serviceConfig = { - Type = "oneshot"; - ExecStart = pkgs.writeDash "add_alarms" '' - ${pkgs.kapacitor}/bin/kapacitor delete tasks \* - ${concatStrings (mapAttrsToList (name: alarm: '' - ${pkgs.kapacitor}/bin/kapacitor define ${name} \ - -type batch \ - -tick ${pkgs.writeText "${name}.tick" alarm} \ - -dbrp ${cfg.check_db}.default - ${pkgs.kapacitor}/bin/kapacitor enable ${name} - '') cfg.alarms)} - ''; - }; - }; - - }; - -in out diff --git a/lass/3modules/telegraf.nix b/lass/3modules/telegraf.nix deleted file mode 100644 index 0b3be2d69..000000000 --- a/lass/3modules/telegraf.nix +++ /dev/null @@ -1,84 +0,0 @@ -{ config, lib, pkgs, ... }: - -with builtins; -with lib; - -let - cfg = config.lass.telegraf; - - out = { - options.lass.telegraf = api; - config = mkIf cfg.enable imp; - }; - - api = { - enable = mkEnableOption "telegraf"; - dataDir = mkOption { - type = types.str; - default = "/var/lib/telegraf"; - }; - user = mkOption { - type = types.str; - default = "telegraf"; - }; - outputs = mkOption { - type = types.str; - default = '' - [outputs.influxdb] - urls = ["http://localhost:8086"] - database = "telegraf_db" - user_agent = "telegraf" - ''; - }; - inputs = mkOption { - type = with types; listOf str; - default = [ - '' - [cpu] - percpu = false - totalcpu = true - drop = ["cpu_time"] - '' - ]; - }; - interval = mkOption { - type = types.str; - default = "10s"; - }; - config = mkOption { - type = types.str; - #TODO: find a good default - default = '' - [agent] - interval = "${cfg.interval}" - - [outputs] - - ${cfg.outputs} - - ${concatStringsSep "\n" cfg.inputs} - - ''; - description = "configuration telegraf is started with"; - }; - }; - - configFile = pkgs.writeText "telegraf.conf" cfg.config; - - imp = { - - systemd.services.telegraf = { - description = "telegraf"; - after = [ "network.target" ]; - wantedBy = [ "multi-user.target" ]; - - restartIfChanged = true; - - serviceConfig = { - Restart = "always"; - ExecStart = "${pkgs.telegraf}/bin/telegraf -config ${configFile}"; - }; - }; - }; - -in out diff --git a/lass/3modules/urxvtd.nix b/lass/3modules/urxvtd.nix deleted file mode 100644 index 469616a9f..000000000 --- a/lass/3modules/urxvtd.nix +++ /dev/null @@ -1,55 +0,0 @@ -{ config, lib, pkgs, ... }: - -let -in - -with builtins; -with lib; - -{ - options = { - services.urxvtd = { - enable = mkOption { - type = types.bool; - default = false; - description = "Enable urxvtd per user"; - }; - users = mkOption { - type = types.listOf types.string; - default = []; - description = "users to run urxvtd for"; - }; - urxvtPackage = mkOption { - type = types.package; - default = pkgs.rxvt_unicode; - description = "urxvt package to use"; - }; - }; - }; - - config = - let - cfg = config.services.urxvtd; - users = cfg.users; - urxvt = cfg.urxvtPackage; - mkService = user: { - description = "urxvt terminal daemon"; - wantedBy = [ "multi-user.target" ]; - restartIfChanged = false; - path = [ pkgs.xlibs.xrdb ]; - environment = { - DISPLAY = ":0"; - URXVT_PERL_LIB = "${urxvt}/lib/urxvt/perl"; - }; - serviceConfig = { - Restart = "always"; - User = user; - ExecStart = "${urxvt}/bin/urxvtd"; - }; - }; - in - mkIf cfg.enable { - environment.systemPackages = [ urxvt ]; - systemd.services = listToAttrs (map (u: { name = "${u}-urxvtd"; value = mkService u; }) users); - }; -} |