Zabbix database is not available.の対応方法
PostgreSQL database "zabbix" on "localhost:5432" is not available: could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
Zabbixより、上記のアラートメールが送られてきました。
現状は特にZabbixの監視機能に何かしらの変化、影響は確認されていませんが、
利用を開始してこれまで3件(凡そ半年に1回の間隔で)同様のメッセージが発生しております。
こちらのアラートの解決方法についてアドバイスをお願い致します。
※Zabbix ServerのOSはUbuntu 18.04.6、PostgreSQL 10.8、Zabbixのversionは4.0.33です。
【確認したこと】
・zabbix server, zabbix agent, posgresqlサービスのステータスがすべてActiveになっていること。
・オープンしているプロセス・ポートの状態を確認。(添付ファイル参照)
・セマフォの数、/sbin/sysctl -a | grep kernel.semコマンドより以下確認 (セマフォのが足りているかを判断する方法が不明です。)
kernel.sem = 32000 1024000000 500 32000
kernel.sem_next_id = -1
・topコマンドのload averageの値が7以下で定常的に動作していること。
・データベース領域の容量 (容量が足りているかを判断する方法が不明です。)
postgres | 7639 kB
zabbix | 1800 MB
template1 | 7505 kB
template0 | 7505 kB
・該当時刻のログ(/var/log/postgresql/postgresql-10-main.log.1)で、以下postgresユーザーの認証失敗が発生していたこと。
2022-05-25 21:55:11.148 UTC [29934] zabbix@zabbix FATAL: the database system is shutting down
2022-05-25 21:55:11.154 UTC [9362] zabbix@zabbix FATAL: terminating connection due to administrator command
2022-05-25 21:55:11.302 UTC [9312] LOG: shutting down
2022-05-25 21:55:11.446 UTC [9310] LOG: database system is shut down
2022-05-25 21:56:28.579 UTC [30183] LOG: listening on IPv4 address "127.0.0.1", port 5432
2022-05-25 21:56:28.617 UTC [30183] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2022-05-25 21:56:28.816 UTC [30188] LOG: database system was shut down at 2022-05-25 21:55:11 UTC
2022-05-25 21:56:28.831 UTC [30189] zabbix@zabbix FATAL: the database system is starting up
2022-05-25 21:56:28.862 UTC [30183] LOG: database system is ready to accept connections
2022-05-25 21:56:29.420 UTC [30202] [unknown]@[unknown] LOG: incomplete startup packet
2022-05-25 21:56:29.940 UTC [30227] postgres@postgres FATAL: password authentication failed for user "postgres"
2022-05-25 21:56:29.940 UTC [30227] postgres@postgres DETAIL: Password does not match for user "postgres".
Connection matched pg_hba.conf line 85: "local all postgres md5"
2022-05-25 21:56:35.154 UTC [30286] [unknown]@[unknown] LOG: incomplete startup packet
この"terminating connection due to administrator command"について調べますと、以下の情報が見つかりました。
https://www.postgresql.org/message-id/5665.1202148155%40sss.pgh.pa.us#:~:text=Re%3A%20PGSQL%20ERROR%3A%20FATAL%3A%20terminating%20connection%20due%20to%20administrator%20command,-From%3A&text=This%20means%20that%20something%20sent%20the%20server%20process%20a%20SIGTERM%20signal.&text=not%20what's%20happening%20because%20the%20postmaster%20must%20still%20be%20there.&text=window%20are%20causing%20it.
プロセスがulimitの設定値を超えた際にSIGTERM サーバープロセスが該当のメッセージを出力するような記載があります。
このあたりの挙動についても、何か知見をお持ちでしたらご教示頂きたく、宜しくお願い致します。
※Zabbix Server ulimit参考
xxxxxxxxxx:~$ ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 15523
max locked memory (kbytes, -l) 65536
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 15523 .
- lsof_-i_-P_5432.txt (4.9 KB)
TNK - 投稿数: 4769
Zabbixでエラーを検知したのは、
2022-05-25 21:55:11
2022-05-25 21:56:28
どちらのタイミングですか?
そして、そのエラーを検知した時刻に、ZabbixサーバーやOSのログ
に何か出力されていないかや、Zabbixで監視設定されているのであ
れば、リソースや負荷状況がどのような状態であったのかを確認し
てください。
また、現時点で提示頂いている情報では、Zabbixの問題ではないよ
うに見受けられるので、PostgreSQLに詳しい方が参加されているよ
うなコミュニティで相談された方が良いと思います。
W-P - 投稿数: 15
Zabbix server内の時刻とメールでの受信時刻の同期の関係でいずれのタイミングかを特定することはできない状況です。
承知致しました。PostgreSQLのフォーラム等を探してそちらの方でも相談してみたいと思います。
ご回答頂き、ありがとうございました。