This is a translation of the original English documentation page. Help us make it better.

9 rootユーザーでのエージェントの実行

バージョン5.0.0以降、公式パッケージのZabbixエージェントのsystemdサービスファイルが更新され、ユーザーグループのディレクティブが明示的に含まれるようになりました。どちらもzabbixに設定されています。

これは、zabbix_agentd.confファイルを介してどのユーザーZabbixエージェントを実行するかを構成する古い機能がバイパスされ、エージェントが常にsystemdサービスファイルで指定されたユーザーとして実行されることを意味します。

この新しい動作を上書きして旧来のようにrootで実行するには、次の内容で/etc/systemd/system/zabbix-agent.service.d/override.confファイルを作成します。

[Service]
       User=root
       Group=root

次にデーモンをリロードし、zabbix-agentサービスを再起動します。

systemctl daemon-reload
       systemctl restart zabbix-agent

Zabbixエージェント2の場合、これで実行されるユーザーを決定します。

古いエージェントの場合、上記だけではzabbix_agentd.confファイルでのユーザー設定する機能のみを再度有効にするだけなので、zabbixエージェントをrootとして実行するには、エージェント構成ファイルを編集し、User=rootAllowRoot=1オプションを追加で指定する必要があります。

Zabbix agent

To override the default user and group for Zabbix agent, run:

systemctl edit zabbix-agent

Then, add the following content:

[Service]
       User=root
       Group=root

Reload daemons and restart the zabbix-agent service:

systemctl daemon-reload
       systemctl restart zabbix-agent

For Zabbix agent this re-enables the functionality of configuring user in the zabbix_agentd.conf file. Now you need to set User=root and AllowRoot=1 configuration parameters in the agent configuration file.

Zabbix agent 2

To override the default user and group for Zabbix agent 2, run:

systemctl edit zabbix-agent2

Then, add the following content:

[Service]
       User=root
       Group=root

Reload daemons and restart the zabbix-agent service:

systemctl daemon-reload
       systemctl restart zabbix-agent2

For Zabbix agent2 this completely determines the user that it runs as. No additional modifications are required.