The zabbix3.0.3 monitoring system was deployed in the company IDC server, and in addition to the system resource monitoring templates such as the memory/bandwidth/cpu load, and the MySQL monitoring template, the next step is for Nginx, PHP, Memcache, Disk IO monitoring item configuration here to make a record, hoping to help the useful friends ~
Nginx Monitoring template: Zbx_nginx_templates.xml
PHP Monitoring template: Zbx_php-fpm_templates.xml
Memcache's monitoring template: Zbx_memcached_templates.xml
Low-level discovery monitoring Disk IO monitoring templates: template Linux diskio.xml
The template for the above four monitoring items: HTTP://PAN.BAIDU.COM/S/1GEAMZFL (extract password: zpyx)
--------------------------------------------------------------------------------------------------
First, the configuration of nginx monitoring
1) First add in the client's nginx configuration file:
[Email protected] ~]# vim www.world.huanqiu.conf
.......
Location/nginx_status {
Stub_status on;
Access_log off;
}
........
After adding, restart the Nginx service:
[Email protected] ~]#/usr/local/nginx/sbin/nginx-s Reload
2) Zabbix Monitor Nginx's custom key value
Add the nginx-status.sh file under the Monitor_scripts directory of the client's Zabbix and configure it as follows (this configuration can be used for nginx monitoring of other machines)
[Email protected] ~]# cd/usr/local/zabbix/monitor_scripts/
[[email protected] monitor_scripts] #cat nginx-status.sh
#!/bin/bash
##################################
# Zabbix Monitoring Script
#
# Nginx:
#-Anything available via Nginx stub-status module
#
##################################
# Contact:
# [Email protected]
##################################
# ChangeLog:
# 20100922 VV Initial creation
##################################
# Zabbix Requested parameter
Zbx_req_data= "$"
Zbx_req_data_url= "$"
# Nginx Defaults
Url= "Http://127.0.0.1/nginx_status"
Wget_bin= "/usr/bin/wget"
#
# Error Handling:
#-Need to being displayable in Zabbix (avoid not_supported)
#-Items need to is of type "float" (allow negative + float)
#
error_no_access_file= "-0.9900"
error_no_access= "-0.9901"
error_wrong_param= "-0.9902"
Error_data= " -0.9903" # either can not Connect/bad Host/bad port
# Save the Nginx stats in a variable for future parsing
nginx_stats=$ ($WGET _bin-q $URL-O-2>/dev/null)
# Error during retrieve
If [$?-ne 0-o-Z "$NGINX _stats"]; Then
Echo $ERROR _data
Exit 1
Fi
#
# Extract data from Nginx stats
#
Case $ZBX _req_data in
Active_connections) echo "$NGINX _stats" | head-1 | cut-f3-d ';
Accepted_connections) echo "$NGINX _stats" | Grep-ev ' [a-za-z] ' | Cut-f2-d ';
Handled_connections) echo "$NGINX _stats" | Grep-ev ' [a-za-z] ' | cut-f3-d ';
handled_requests) echo "$NGINX _stats" | Grep-ev ' [a-za-z] ' | Cut-f4-d ';
Reading) echo "$NGINX _stats" | Tail-1 | Cut-f2-d ';
Writing) echo "$NGINX _stats" | Tail-1 | Cut-f4-d ';
Waiting) echo "$NGINX _stats" | Tail-1 | Cut-f6-d ';
*) echo $ERROR _wrong_param; Exit 1;;
Esac
Exit 0
Distributed Monitoring System zabbix-3.0.3-Complete installation record (4)-Monitor nginx,php,memcache,low-level discovery disk IO