aboutsummaryrefslogtreecommitdiff
path: root/nixos/hosts/ev/exporters.nix
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2025-09-18 08:52:11 +0200
committerMartin Fischer <martin@push-f.com>2025-09-20 14:40:47 +0200
commitb2df6ac72a41ed2a90df07bec50c638dee7ac6e5 (patch)
treea5c190ce90475e3f38d6c1990892b7b0f28529b8 /nixos/hosts/ev/exporters.nix
parent0d53b5617f165bd33c5db7f5355bb51a46e26b16 (diff)
feat(ev): add miniflux
I already had a miniflux instance a couple years ago but accidentally dropped the database.
Diffstat (limited to 'nixos/hosts/ev/exporters.nix')
-rw-r--r--nixos/hosts/ev/exporters.nix42
1 files changed, 42 insertions, 0 deletions
diff --git a/nixos/hosts/ev/exporters.nix b/nixos/hosts/ev/exporters.nix
new file mode 100644
index 0000000..1c03c35
--- /dev/null
+++ b/nixos/hosts/ev/exporters.nix
@@ -0,0 +1,42 @@
+{ config, lib, pkgs, ... }:
+
+let
+ helpers = import <top/shared/postgres-collectors.nix> { inherit config lib pkgs; };
+ cfg = config.exporters;
+in
+{
+ options.exporters = {
+ sqlExporterPort = lib.mkOption {
+ type = lib.types.int;
+ };
+ };
+
+ imports = [
+ <top/shared/prometheus-sql-exporter/service.nix>
+ ];
+
+ config = {
+ services.prometheus-sql-exporter = {
+ enable = true;
+ port = cfg.sqlExporterPort;
+ config = {
+ target = {
+ # This URL should be postgresql:///postgres?host=/run/postgresql
+ # but sql_exporter uses xo/dburl which isn't spec-compliant: https://github.com/xo/dburl/issues/46
+ data_source_name = "postgresql:/run/postgresql:/postgres";
+ collectors = helpers.collectorNames;
+ };
+ collectors = helpers.collectors;
+ };
+ };
+
+ monitoring.prometheusScrapeConfigs = [
+ {
+ job_name = "sql";
+ static_configs = [{
+ targets = [ "localhost:${toString cfg.sqlExporterPort}" ];
+ }];
+ }
+ ];
+ };
+}