3
0
mirror of https://github.com/rvalitov/zabbix-php-fpm.git synced 2023-11-05 03:30:27 +01:00

[add] method how to grant previliges without root #7

This commit is contained in:
Ramil Valitov 2019-11-28 12:13:04 +03:00
parent 80401be1f2
commit fc5b1d583c
No known key found for this signature in database
GPG Key ID: 645768E8FD0E18C7

View File

@ -157,8 +157,13 @@ chmod +x /etc/zabbix/zabbix_php_fpm_discovery.sh
chmod +x /etc/zabbix/zabbix_php_fpm_status.sh chmod +x /etc/zabbix/zabbix_php_fpm_status.sh
``` ```
#### 1.3. Allow root for Zabbix Agent #### 1.3. Root previliges
Automatic detection of sockets used by pools requires root previliges. Edit Zabbix agent configuration file `/etc/zabbix/zabbix_agentd.conf`, find `AllowRoot` option and enable it: Automatic detection of pools requires root previliges. You can achieve it using one of the methods below.
##### 1.3.1 Root previliges for Zabbix Agent
This method sets root previliges for Zabbix Agent, i.e. the Zabbix Agent will run under `root` user, as a result all user scripts will also have the root access rights.
Edit Zabbix agent configuration file `/etc/zabbix/zabbix_agentd.conf`, find `AllowRoot` option and enable it:
``` ```
### Option: AllowRoot ### Option: AllowRoot
@ -172,7 +177,28 @@ Automatic detection of sockets used by pools requires root previliges. Edit Zabb
# Default: # Default:
# AllowRoot=0 # AllowRoot=0
AllowRoot=1 AllowRoot=1
``` ```
##### 1.3.2 Grant previliges to the PHP-FPM autodiscovery script only
If you don't want to run Zabbix Agent as root, then you can configure the previliges only to our script. In this case you need to have `sudo` installed:
```console
apt-get install sudo
```
Now edit the `/etc/sudoers` file by running command:
```console
visudo
```
Add the following line to this file:
```
zabbix ALL = NOPASSWD: /etc/zabbix/zabbix_php_fpm_discovery.sh
```
Here we specified `zabbix` as the user under which the Zabbix Agent is run. This is the default name, but if you have a custom installation with different name, then please, change it accordingly. Save and exit the editor. Your modifications will be applied.
#### 1.4. Linux Tuning (optional) #### 1.4. Linux Tuning (optional)
Usually PHP-FPM [backlog option](https://www.php.net/manual/en/install.fpm.configuration.php#listen-backlog) is limited by Linux kernel settings and equals to `128` by default. Usually PHP-FPM [backlog option](https://www.php.net/manual/en/install.fpm.configuration.php#listen-backlog) is limited by Linux kernel settings and equals to `128` by default.