Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

nagios: Support arbitrary database user and dbname in replication check.

Alex Vandiverab130ceb35d4
diff --git a/puppet/zulip/files/nagios_plugins/zulip_postgresql/check_postgresql_replication_lag b/puppet/zulip/files/nagios_plugins/zulip_postgresql/check_postgresql_replication_lag
index 5548b7b98b1..38ba6b5ae06 100755
--- a/puppet/zulip/files/nagios_plugins/zulip_postgresql/check_postgresql_replication_lag
+++ b/puppet/zulip/files/nagios_plugins/zulip_postgresql/check_postgresql_replication_lag
@@ -9,6 +9,10 @@ import re
import subprocess
from typing import Dict, List
+from scripts.lib.zulip_tools import get_config, get_config_file
+
+config_file = get_config_file()
+
states = {
"OK": 0,
"WARNING": 1,
@@ -33,7 +37,10 @@ def run_sql_query(query: str) -> List[List[str]]:
"-z", # Separate columns with nulls
"-v",
"ON_ERROR_STOP=1",
- "zulip",
+ "-d",
+ get_config(config_file, "postgresql", "database_name", "zulip"),
+ "-u",
+ get_config(config_file, "postgresql", "database_user", "zulip"),
"-c",
f"SELECT {query}",
]