diff options
author | Franck Cuny <franck@fcuny.net> | 2023-04-23 13:37:03 -0700 |
---|---|---|
committer | Franck Cuny <franck@fcuny.net> | 2023-04-23 14:29:06 -0700 |
commit | 251379d6084849f26866226b4bd0391216a8ccec (patch) | |
tree | 448c3517fe994c0dca98f4e9c958ef503bfd7eff /modules/services/metrics-exporter | |
parent | modules/grafana: add loki as a source to grafana (diff) | |
download | world-251379d6084849f26866226b4bd0391216a8ccec.tar.gz |
modules/monitoring: consolidate all monitoring services together
This will help to organize and structure monitoring modules a bit better.
Diffstat (limited to 'modules/services/metrics-exporter')
-rw-r--r-- | modules/services/metrics-exporter/default.nix | 21 | ||||
-rw-r--r-- | modules/services/metrics-exporter/promtail.nix | 65 |
2 files changed, 0 insertions, 86 deletions
diff --git a/modules/services/metrics-exporter/default.nix b/modules/services/metrics-exporter/default.nix deleted file mode 100644 index c3c471c..0000000 --- a/modules/services/metrics-exporter/default.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ config, pkgs, lib, ... }: -let cfg = config.my.services.metrics-exporter; -in -{ - imports = [ ./promtail.nix ]; - - options.my.services.metrics-exporter = with lib; { - enable = mkEnableOption "Prometheus metrics exporter"; - }; - - config = lib.mkIf cfg.enable { - services.prometheus = { - exporters = { - node = { - enable = true; - enabledCollectors = [ "tcpstat" "systemd" "interrupts" ]; - }; - }; - }; - }; -} diff --git a/modules/services/metrics-exporter/promtail.nix b/modules/services/metrics-exporter/promtail.nix deleted file mode 100644 index eb574d0..0000000 --- a/modules/services/metrics-exporter/promtail.nix +++ /dev/null @@ -1,65 +0,0 @@ -{ config, lib, pkgs, ... }: -let - cfg = config.my.services.metrics-exporter.promtail; -in -{ - options.my.services.metrics-exporter.promtail = with lib; { - enable = mkEnableOption "promtail logs exporter"; - }; - - config = lib.mkIf cfg.enable { - services.promtail = { - enable = true; - configuration = { - clients = [{ url = "http://192.168.6.40:3100/loki/api/v1/push"; }]; - scrape_configs = [ - { - job_name = "journal"; - journal = { - json = true; - path = "/var/log/journal"; - max_age = "12h"; - labels = { - host = "carmel"; - job = "journal"; - "__path__" = "/var/log/journal"; - }; - }; - - relabel_configs = [ - { - source_labels = [ "__journal__systemd_unit" ]; - target_label = "unit"; - } - { - source_labels = [ "__journal_priority" ]; - target_label = "priority"; - } - { - source_labels = [ "__journal_syslog_identifier" ]; - target_label = "syslog_id"; - } - ]; - } - - { - job_name = "nginx"; - static_configs = [{ - labels = { - host = "carmel"; - job = "nginx"; - __path__ = "/var/log/nginx/*"; - }; - }]; - } - ]; - - server = { - http_listen_port = 9832; - http_path_prefix = "/promtail"; - grpc_listen_port = 0; - }; - }; - }; - }; -} |