mirror of
https://github.com/rvalitov/zabbix-php-fpm.git
synced 2023-11-05 03:30:27 +01:00
[add,fix] more info how to use zabbix_get, correct command syntax for php-fpm.discover
This commit is contained in:
parent
7f1621a72c
commit
68e5a4d377
47
README.md
47
README.md
@ -511,40 +511,51 @@ Then check the Zabbix server log, for Debian/Ubuntu it's located at `/var/log/za
|
||||
|
||||
## Test with `zabbix_get`
|
||||
Please, use the [`zabbix_get`](https://www.zabbix.com/documentation/4.4/manual/concepts/get) utility from your Zabbix Server to test that you can get the data from the Zabbix Agent (host).
|
||||
|
||||
### Installation
|
||||
Please, install this utility first, because usually it's not installed automatically:
|
||||
|
||||
```console
|
||||
apt-get install zabbix-get
|
||||
```
|
||||
|
||||
Example how to discover PHP-FPM pools:
|
||||
### Command examples
|
||||
In the examples below we use the following parameter names:
|
||||
|
||||
```console
|
||||
root@server:/# zabbix_get -s 127.0.0.1 -p 10050 -k php-fpm.discover POOL_PATH
|
||||
{"data":[{"{#POOLNAME}":"www","{#POOLSOCKET}":"/run/php/php7.3-fpm.sock"},{"{#POOLNAME}":"www2","{#POOLSOCKET}":"localhost:9001"}]}
|
||||
```
|
||||
|
||||
To get status of the required pool, use the following command:
|
||||
|
||||
```console
|
||||
zabbix_get -s 127.0.0.1 -p 10050 -k php-fpm.discover.status[POOL_URL,POOL_PATH]
|
||||
```
|
||||
|
||||
In the above examples we use the following values:
|
||||
|
||||
- `127.0.0.1` is the IP address of the host where the Zabbix Agent is installed and where the PHP-FPM is running
|
||||
- `10050` is the port of the Zabbix Agent
|
||||
- `ZABBIX_HOST_IP` is the IP address of the host where the Zabbix Agent is installed and where the PHP-FPM is running, for example `127.0.0.1`
|
||||
- `ZABBIX_HOST_PORT` is the port of the Zabbix Agent, for example `10050`
|
||||
- `POOL_URL` is the socket of the pool or IP and port combination, example: `/var/lib/php7.3-fpm/web1.sock` or `127.0.0.1:9000`
|
||||
- `POOL_PATH` is the status path of PHP-FPM that you set in [`pm.status_path`](https://github.com/rvalitov/zabbix-php-fpm#16-adjust-php-fpm-pools-configuration), the default value is `/php-fpm-status`.
|
||||
|
||||
Example:
|
||||
All commands should return valid JSON data. If any error happens then it will be displayed.
|
||||
|
||||
#### 1. Discover PHP-FPM pools
|
||||
Command syntax:
|
||||
|
||||
```
|
||||
zabbix_get -s ZABBIX_HOST_IP -p ZABBIX_HOST_PORT -k php-fpm.discover["POOL_URL"]
|
||||
```
|
||||
|
||||
Command output example:
|
||||
```console
|
||||
root@server:/# zabbix_get -s 127.0.0.1 -p 10050 -k php-fpm.discover["/php-fpm-status"]
|
||||
{"data":[{"{#POOLNAME}":"www","{#POOLSOCKET}":"/run/php/php7.3-fpm.sock"},{"{#POOLNAME}":"www2","{#POOLSOCKET}":"localhost:9001"}]}
|
||||
```
|
||||
|
||||
#### 2. Get status of required pool
|
||||
Command syntax:
|
||||
|
||||
```console
|
||||
zabbix_get -s ZABBIX_HOST_IP -p ZABBIX_HOST_PORT -k php-fpm.discover.status["POOL_URL","POOL_PATH"]
|
||||
```
|
||||
|
||||
Command output example:
|
||||
|
||||
```console
|
||||
root@server:/# zabbix_get -s 127.0.0.1 -p 10050 -k php-fpm.status["localhost:9001","/php-fpm-status"]
|
||||
{"pool":"www2","process manager":"static","start time":1578093850,"start since":149,"accepted conn":3,"listen queue":0,"max listen queue":0,"listen queue len":511,"idle processes":4,"active processes":1,"total processes":5,"max active processes":1,"max children reached":0,"slow requests":0}
|
||||
```
|
||||
|
||||
All commands should return valid JSON data. If any error happens then it will be displayed.
|
||||
Most common problems of testing the `php-fpm.discover` key:
|
||||
|
||||
- The resulting JSON data is empty, but the discovery script started manually works. Then it's a problem of insufficient privileges of Zabbix agent. Please, check again section "Root privileges" of this document.
|
||||
|
Loading…
Reference in New Issue
Block a user