diff --git a/home/modules/runit/services/prometheus.nix b/home/modules/runit/services/prometheus.nix new file mode 100644 index 0000000..fbb5d2c --- /dev/null +++ b/home/modules/runit/services/prometheus.nix @@ -0,0 +1,25 @@ +{ pkgs, config, ... }: + +{ + home.file.".config/prometheus/prometheus.yml".text = '' + global: + scrape_interval: 1m + + scrape_configs: + - job_name: 'restic_rest_server' + static_configs: + - targets: ['${config.runit.services.restic-rest-server.environment.LISTEN_ADDR}'] + ''; + + runit.services.prometheus = { + script = '' + TSDB_PATH=$HOME/services/prometheus + mkdir -p TSDB_PATH + + exec ${pkgs.prometheus}/bin/prometheus \ + --config.file=$HOME/.config/prometheus/prometheus.yml \ + --storage.tsdb.path=$TSDB_PATH \ + --web.listen-address="127.0.0.1:9090" + ''; + }; +}