Skip to content

Commit 5ef90c7

Browse files
committed
improve prometheus deploy
1 parent e086977 commit 5ef90c7

7 files changed

Lines changed: 21 additions & 5 deletions

File tree

grafana/provisioning/datasources/datasource.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ datasources:
6363
database: "${MONITOR_DB_DB}"
6464
user: "${MONITOR_DB_USER}"
6565
secureJsonData:
66-
password: ""
66+
password: ${MONITOR_DB_PASSWORD}
6767
basicAuth: false
6868
isDefault: false
6969
editable: true

infra/aggregation_mode/ansible/playbooks/grafana_agg_mode.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
grafana_postgres_db: "{{ lookup('ini', 'grafana_postgres_db', file=config_file) }}"
2323
grafana_postgres_user: "{{ lookup('ini', 'grafana_postgres_user', file=config_file) }}"
2424
grafana_postgres_password: "{{ lookup('ini', 'grafana_postgres_password', file=config_file) }}"
25+
grafana_monitor_host: "{{ lookup('ini', 'grafana_monitor_host', file=config_file) }}"
26+
grafana_monitor_port: "{{ lookup('ini', 'grafana_monitor_port', file=config_file, default='5432') }}"
27+
grafana_monitor_db: "{{ lookup('ini', 'grafana_monitor_db', file=config_file, default='pg_auto_failover') }}"
2528
no_log: true
2629

2730
- name: Install required packages

infra/aggregation_mode/ansible/playbooks/ini/config-hoodi.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ grafana_postgres_host=agg-mode-hoodi-postgres-1
8484
grafana_postgres_port=5432
8585
grafana_postgres_db=agg_mode
8686
grafana_postgres_user=grafana
87+
# Monitor datasource (uses same user/password as postgres datasource)
88+
grafana_monitor_host=agg-mode-hoodi-postgres-monitor
89+
grafana_monitor_port=5432
90+
grafana_monitor_db=pg_auto_failover
8791

8892
# ============================================
8993
# Task Sender Configuration

infra/aggregation_mode/ansible/playbooks/ini/config-mainnet.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ grafana_postgres_host=agg-mode-mainnet-postgres-1
8484
grafana_postgres_port=5432
8585
grafana_postgres_db=agg_mode
8686
grafana_postgres_user=grafana
87+
# Monitor datasource (uses same user/password as postgres datasource)
88+
grafana_monitor_host=agg-mode-mainnet-postgres-monitor
89+
grafana_monitor_port=5432
90+
grafana_monitor_db=pg_auto_failover
8791

8892
# ============================================
8993
# Task Sender Configuration

infra/aggregation_mode/ansible/playbooks/prometheus_agg_mode.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@
7373
owner: "{{ ansible_user }}"
7474
group: "{{ ansible_user }}"
7575

76-
- name: Enable and start Prometheus service
76+
- name: Enable and restart Prometheus service
7777
systemd_service:
7878
name: prometheus
79-
state: started
79+
state: restarted
8080
enabled: true
8181
scope: user
8282
daemon_reload: true

infra/aggregation_mode/ansible/playbooks/templates/grafana/grafana_env.j2

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,8 @@ POSTGRES_PORT={{ grafana_postgres_port }}
77
POSTGRES_DB={{ grafana_postgres_db }}
88
POSTGRES_USER={{ grafana_postgres_user }}
99
POSTGRES_PASSWORD={{ grafana_postgres_password }}
10+
MONITOR_DB_HOST={{ grafana_monitor_host }}
11+
MONITOR_DB_PORT={{ grafana_monitor_port }}
12+
MONITOR_DB_DB={{ grafana_monitor_db }}
13+
MONITOR_DB_USER={{ grafana_postgres_user }}
14+
MONITOR_DB_PASSWORD={{ grafana_postgres_password }}

infra/aggregation_mode/ansible/playbooks/templates/prometheus/prometheus_agg_mode.yaml.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ scrape_configs:
77
static_configs:
88
- targets: ["{{ gateway_primary_hostname }}:8080"]
99
labels:
10-
service: "gateway"
10+
service: "gateway-http"
1111
instance: "primary"
1212

1313
- job_name: "gateway-secondary-http"
1414
scrape_interval: 60s
1515
static_configs:
1616
- targets: ["{{ gateway_secondary_hostname }}:8080"]
1717
labels:
18-
service: "gateway"
18+
service: "gateway-http"
1919
instance: "secondary"
2020

2121
- job_name: "gateway-primary"

0 commit comments

Comments
 (0)