9 Executando agente como root
A partir da versão 5.0.0 o arquivo de serviço systemd para Zabbix
agente em oficial pacotes
foi atualizado para incluir explicitamente diretivas para User e Group.
Ambos estão configurados para zabbix.
Isso significa que a antiga funcionalidade de configurar qual usuário Zabbix
agente é executado como via arquivo zabbix_agentd.conf é ignorado e o agente irá
sempre executado como o usuário especificado no arquivo de serviço systemd.
Para substituir esse novo comportamento, crie um
arquivo /etc/systemd/system/zabbix-agent.service.d/override.conf com o
seguinte conteúdo:
[Serviço]
usuário=raiz
Grupo=raiz
Recarregue os daemons e reinicie o serviço zabbix-agent:
systemctl daemon-reload
systemctl reinicie zabbix-agent
Para Zabbix agent2, isso determina completamente o usuário que ele executa Como.
Para o antigo agente, isso só reativa a funcionalidade de configuração
usuário no arquivo zabbix_agentd.conf. Portanto, para executar o zabbix
agente como root você ainda tem que editar o agente configuração
file e especifique User=root como
bem como opções AllowRoot=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.