Setting agent privileges#
デフォルトでは、PEMエージェントは、オペレーティングシステムホストのroot権限とデータベースサーバーのスーパーユーザー権限でインストールされます。これらの特権により、PEMエージェントは、システムの使用状況について監視対象ホストおよびデータベースサーバーで無制限のプローブを呼び出し、情報を取得してPEMサーバーに返すことができます。
rootユーザーと非rootユーザー#
完全な機能を実現するには、rootとしてPEMエージェントを実行します。 この表は、特権を制限した場合の影響の高レベルの概要を示しています。
Feature name |
Behavior with non-root user |
Works with remote PEM agent |
|---|---|---|
Audit Manager |
The Audit Log Manager might not be able to apply requested modifications if the service can't be restarted. The user running the PEM agent might be different from the user who owns the data directory of the database server. Thus the user running the PEM agent might not be able to change the configuration and also might not be able to restart the services of the database server. |
no |
Capacity Manager |
No functionality limitation. |
yes Note: There's no correlation between the database server and operating system metrics |
Log Manager |
The Log Manager might not be able to apply requested modifications if the service can't restart. The user running the PEM agent might be different from the user who owns the data directory of the database server. Thus the user running the PEM agent might not be able to change the configuration and also might not be able to restart the services of the database server. |
no |
Manage Alerts |
No functionality limitation. |
yes Note: When Run Alert Script on the database server is selected, it runs on the machine where the bound PEM agent is running and not on the actual database server machine. |
Manage Charts |
No functionality limitation. |
yes |
Manage Dashboards |
Some dashboards might not be able to show complete data. See the オペレーティングシステムの権限の制限によって影響を受ける機能 . |
Some dashboards might not be able to show complete data. For example, the operating system information of the database server doesn't appear as not available. |
Manage Probes |
Some PEM probes can't run, and some return incomplete data. See the オペレーティングシステムの権限の制限によって影響を受ける機能 . |
Some of the PEM probes don't return information, and some of the functionality might be affected. |
Scheduled Tasks |
Limited. See the オペレーティングシステムの権限の制限によって影響を受ける機能 . |
Scheduled tasks work only for the database server. Scripts run on a remote agent. |
System Reports |
No functionality limitation. |
yes |
Core Usage Reports |
No functionality limitation. |
The Core usage report doesn't show complete information. For example, the platform, number of cores, and total RAM aren't displayed. |
オペレーティングシステムの権限の制限によって影響を受ける機能#
非rootユーザーとしてPEMエージェントを実行する場合、機能のレベルはエージェントユーザーが持っている権限によって異なります。一部の操作はOSユーザーの権限の影響を受け、通常の操作には特定の権限が必要です。
プローブ#
Probe |
Operating system |
PEM functionality affected |
|---|---|---|
Session Information |
Linux/Windows |
The probe will be missing the following ‘per-process’ columns if the agent user isn't either root or the same user as Postgres: memory_usage_mb, swap_usage_mb, cpu_usage, io_read_bytes, io_write_bytes. |
Patroni Node Status |
Linux/Windows |
Requires permission to execute patronictl. No data is returned otherwise. |
Patroni Cluster Status |
Linux/Windows |
Requires permission to execute patronictl. No data is returned otherwise. |
PG HBA Conf |
Linux/Windows |
Requires permission to read pg_hba.conf. No data is returned otherwise. |
Data and Log File Analysis |
Linux/Windows |
Requires permission to read PGDATA. No data is returned otherwise. |
WAL Archive Status |
Linux/Windows |
Requires read access to the WAL directory. No data is returned otherwise. |
Failover Manager Node Status |
Linux/Windows |
Requires permission to execute efm. No data is returned otherwise. |
Failover Manager Cluster Info |
Linux/Windows |
Requires permission to execute efm. No data is returned otherwise. |
サービスの再起動#
Audit Log ManagerとServer Log Managerでは、PEMエージェントユーザーがPostgresサービスを再起動して、変更を有効にして機能を動作させる必要があります。エージェントユーザーには、サービスを再起動するための権限が必要です。通常、これにはルートアクセスが必要です。
バッチ/シェルタスク#
Windowsでは、エージェントユーザーが管理者権限を持っている場合にのみPEMエージェントはバッチタスクを実行します。
Linuxでは、PEMエージェントは、エージェントユーザーがagent.cfg
で指定されたbatch_script_user
になることができる場合にのみシェルタスクを実行できます。これは、
rootユーザーとbatch_script_user に常に当てはまります。
データベース特権の制限によって影響を受ける機能#
PEMエージェントが非スーパーユーザーアカウントを使用して監視対象データベースに接続する場合、使用可能な機能は、そのユーザーに付与された特権に基づいて制限されます。
PEMエージェントは、ほとんどのSQLベースのプローブのpg_catalogスキーマからデータを読み取ります。通常、 pg_monitorロールをエージェントユーザーに割り当てるだけで十分です。ただし、特定のカタログ機能とプローブは、pg_monitorを超える特権を必要とする場合があります。
また、エージェントユーザーは、プローブを実行する必要があるすべてのターゲットデータベースに接続できる必要があります。
エージェントがデータベースに接続できない場合、そのインスタンスではデータベースレベルのプローブは実行されません。このような場合、サーバーレベルのメトリックのみが使用できます。pg_stat_database
から収集されたものなど。
この表には、LinuxおよびWindowsオペレーティングシステムでpg_monitorに加えて権限を必要とするプローブがリストされています。
Probe |
Additional permissions required |
|---|---|
All PGD probes |
SELECT permission on tables and views, and EXECUTE permission on functions, in the bdr schema of the replicated database. |
Number of WAL Files |
EXECUTE on pg_ls_dir(). |
Streaming Replication Lag Time |
The ability to execute pg_last_xlog_receive_location(), pg_last_xlog_replay_location(), and pg_last_xact_replay_timestamp(). Provided by granting the pg_wal_monitor role. |
Streaming Replication |
The ability to execute pg_xlogfile_name_offset() and pg_xlog_location_diff(). This can be provided by granting the pg_wal_monitor role. |
System Waits & Session Waits |
SELECT permission on the system_waits and session_waits views respectively. |
SQL Protect |
SELECT on sqlprotect.edb_sql_protect_stats. |
User Information |
SELECT on pg_user. |
xDB Replication |
SELECT on EDB Replicator views. |
エラー処理#
プローブは、十分な権限なしでオペレーティングシステムを検索している場合、プローブはpermission denied
エラーを結果ことができます。プローブが十分な権限なしでデータベースを照会している場合、プローブはpermission denied
エラーを返すか、返されたデータを空の値としてPEMチャートまたはグラフに表示する場合があります。
プローブが失敗すると、プローブの名前、プローブが失敗した理由、問題の解決に役立つヒントを含むエントリがログファイルに書き込まれます。
サーバーで発生したプローブ関連のエラーをプローブログダッシュボードで表示したり、PEMワーカーログファイルのエラーメッセージを確認したりできます。 Linuxでは、ログファイルのデフォルトの場所は次のとおりです。
/var/log/pem/worker.log
Windowsでは、 Event Viewerでログ情報を利用できます。