[o11y] run node and postgres exporter directly
change mvxkrsxmwlwyvyvylnoxpoummsuwmrzm
commit 245c02545a700cdf285458fa791b06ff31f2c47d
author Alpha Chen <alpha@kejadlen.dev>
date
parent motnlpys
diff --git a/lotus-land-story/main.yml b/lotus-land-story/main.yml
index d32518d..cbdee05 100644
--- a/lotus-land-story/main.yml
+++ b/lotus-land-story/main.yml
@@ -23,6 +23,12 @@
           - python3-psycopg2
         state: present
 
+    - name: Install basic packages
+      ansible.builtin.apt:
+        pkg:
+          - prometheus-node-exporter
+        state: present
+
 - import_playbook: ../playbooks/tailscale.yml # noqa: name[play]
 - import_playbook: ../playbooks/docker.yml    # noqa: name[play]
 
diff --git a/lotus-land-story/postgres.yml b/lotus-land-story/postgres.yml
index e76a6c7..e2ac7f7 100644
--- a/lotus-land-story/postgres.yml
+++ b/lotus-land-story/postgres.yml
@@ -8,6 +8,7 @@
         pkg:
           - postgresql
           - postgresql-client
+          - prometheus-postgres-exporter
         state: present
 
     - name: Make data directory
diff --git a/lotus-land-story/templates/scrape.yml b/lotus-land-story/templates/scrape.yml
index b3b0d51..18d649f 100644
--- a/lotus-land-story/templates/scrape.yml
+++ b/lotus-land-story/templates/scrape.yml
@@ -151,7 +151,12 @@ scrape_configs:
 
   - job_name: postgres
     static_configs:
-      - targets: ['postgres-exporter:9187']
+      - targets: ['host.docker.internal:9187']
+    relabel_configs:
+      - source_labels: [__address__]
+        regex: 'host\.docker\.internal:9187'
+        target_label: instance
+        replacement: 'lotus-land-story:9187'
 
   - job_name: victoria-logs
     static_configs: