Zabbix monitors Nginx, PHP, and Memcached statuses
Create a sub-configuration file for zabbix_agentd
Create a sub-configuration file associated with nginx status and php-fpm status in/etc/zabbix/zabbix_agentd.d/, or add it to an existing configuration file, I will create a configuration file for them here, and the file name can be customized. Just make sure that all the contents of this folder are included in zabbix_agentd.conf (include.
The custom key of the zabbix-agent configuration file:
- Userparameter_nginx.conf
[Root @ spark ~] # Cat/etc/zabbix/zabbix_agentd.d/userparameter_nginx.conf
#/Usr/local/zabbix/bin/nginx_status.sh
# UserParameter = nginx. status [*],/etc/zabbix/scripts/nginx_status.sh $1
# This method is concise. See userparameter_examples.conf in zabbix 3.2.4.
UserParameter = nginx. version,/usr/sbin/nginx-v
# UserParameter = nginx. accepts,/etc/zabbix/scripts/check_nginx_status.sh accepts
# UserParameter = nginx. handled,/etc/zabbix/scripts/check_nginx_status.sh handled
# UserParameter = nginx. requests,/etc/zabbix/scripts/check_nginx_status.sh requests
# UserParameter = nginx. connections. active,/etc/zabbix/scripts/check_nginx_status.sh active
# UserParameter = nginx. connections. reading,/etc/zabbix/scripts/check_nginx_status.sh reading
# UserParameter = nginx. connections. writing,/etc/zabbix/scripts/check_nginx_status.sh writing
# UserParameter = nginx. connections. waiting,/etc/zabbix/scripts/check_nginx_status.sh waiting
Userparameter_php-fpm.conf
[Root @ spark ~] # Cat/etc/zabbix/zabbix_agentd.d/userparameter_php-fpm_status.conf
# UserParameter = idle. processe,/etc/zabbix/scripts/php-fpm_status.sh idle
# UserParameter = total. processes,/etc/zabbix/scripts/php-fpm_status.sh total
# UserParameter = active. processes,/etc/zabbix/scripts/php-fpm_status.sh active
# UserParameter = max. active. processes,/etc/zabbix/scripts/php-fpm_status.sh mactive
# UserParameter = listen. queue. len,/etc/zabbix/scripts/php-fpm_status.sh listenqueuelen
# UserParameter = listen. queue,/etc/zabbix/scripts/php-fpm_status.sh listenqueue
# UserParameter = start. since,/etc/zabbix/scripts/php-fpm_status.sh since
# UserParameter = accepted. conn,/etc/zabbix/scripts/php-fpm_status.sh conn
UserParameter = max. children. reached,/etc/zabbix/scripts/php-fpm_status.sh reached
UserParameter = slow. requests [],/Etc/zabbix/scripts/php-fpm_status.sh requests
#/Usr/local/zabbix/bin/php_fpm_status.sh
UserParameter = php-fpm.status [],/Etc/zabbix/scripts/php-fpm_status.sh $1
UserParameter = php-fpm.version,/usr/local/php56/sbin/php-fpm-v | awk 'nr = 1 {print $0 }'
# Obtain the php-fpm version information
- Make sure that the sub-configuration file is included in the zabbix_agentd configuration file.
Check whether/usr/local/zabbix/etc/zabbix_agentd.conf contains: Include =/usr/local/zabbix/etc/zabbix_agentd.conf.d/, which is not commented out.
Zabbix server get value
[Root @ mha ~] # Zabbix_get-s 192.168.198.131-k 'nginx. status [ping]'
1
Zabbix page:
Nginx:
Add an nginx status monitoring template
Create an nginx status Template
Define the nginx status Template
Create nginxApplication
Define nginx status items. Here I use passive control.
Adds the nginx status code ing.
Nginx trigger Definition
Define nginx monitoring view
Add a php-fpm status monitoring template
The steps for adding a php-fpm status template are the same as those described above.
1. Select the template associated with the corresponding host or host Group
- Display of actual monitoring results (I don't know why my latest data has no data)
To view the Monitoring results, you can filter out the corresponding host and application names by checking Monitoring ----> Latest data and view the Monitoring results of the Latest items, items that are monitored data will display data. If the item is dimmed, the data is not monitored. You need to check the cause. As follows:
Nginx metric data
You can also view the monitoring results through the defined Graphs:
Nginx status monitoring view
Nginx request monitoring view
Php Monitoring Data
Memcached metric data
Add memcached to zabbix-agent Configuration
Add the following content to/usr/local/zabbix/conf/zabbix_agentd.conf on the client:
UserParameter = memcached_stats [*], (echo stats; sleep 1) | telnet 127.0.0.1 $1 2> & 1 | awk '/STAT $2/{print $ NF }'
Restart memcached and nginx after saving
The memcached monitoring template can be downloaded from the help house resource station:
------------------------------------------ Split line ------------------------------------------
Free in http://linux.bkjia.com/
The username and password are both www.bkjia.com
The specific download directory is in/July 6,/July 7,/Zabbix to monitor Nginx, PHP, and Memcached statuses/
For the download method, see
------------------------------------------ Split line ------------------------------------------
This article permanently updates link: https://www.bkjia.com/Linux/2018-03/151241.htm