Zabbix Monitoring Nginx Status
First, add the following code to the Nginx configuration file
server {Listen localhost:80; server_name Localhost;location/nginxstatus {stub_status on; Access_log off; Allow 127.0.0.1;allow 192.168.1.165; Deny all; } }
Restart Nginx after saving
Create a script in the Zabbix script directory to monitor the Zabbix status
#!/bin/bash # script to fetch nginx statuses for tribily Monitoring systems # set variables # functions to return nginx stats nginx=/data/zabbix/sbin/nginx.txtfunction active { curl "http://localhost/ Nginxstatus "&> $nginx && awk '/active/{print $3} ' $nginx}function reading { curl "Http://localhost/nginxstatus" &> $nginx && awk '/reading/{print $2 } ' $nginx}function writing { curl "Http://localhost/nginxstatus" &> $nginx && awk '/writing/{print $4} ' $nginx}function waiting { curl "Http://localhost/nginxstatus" &> $nginx && awk '/waiting/{print $6} ' $nginx}function accepts { curl "http://localhost/ Nginxstatus "&> $nginx && awk NR==6 $nginx | awk ' {print $1} '} function handled { curl "Http://localhost/nginxstatus" &> $nginx && awk nr==6 $nginx | awk ' {print $2} '}function requests { curl "Http://localhost/nginxstatus" &> $nginx  && AWK&NBsp nr==6 $nginx | awk ' {print $3} '}# run the requested function case "$" inactive) active ;; Reading) reading ;; Writing) writing ;; Waiting) waiting ;; Accepts) accepts ;; Handled) handled ;; Requests) requests ;; *) echo "usage: $0 {nginx_site_dicovery} " echo " usage: $0 {active [host] | reading [host] | writing [host] | waiting [ Host] | accepts [host] | handled [host] | requests [host]} "Esac
The owner and owner group of the file is then modified to be Zabbix and has execute permissions
Chown zabbix.zabbix/data/zabbix/sbin/nginx_status.sh
chmod 755/data/zabbix/sbin/nginx_status.sh
Create a Nginx.txt file, set the genus and the owner as Zabbix, with read and write permissions
Then add the following code in the zabbix_agentd.conf configuration file
Userparameter=nginx.accepts,/data/zabbix/sbin/nginx_status accepts Userparameter=nginx.handled,/data/zabbix/sbin /nginx_status handled Userparameter=nginx.requests,/data/zabbix/sbin/nginx_status requests UserParameter= Nginx.connections.active,/data/zabbix/sbin/nginx_status Active userparameter=nginx.connections.reading,/data/ Zabbix/sbin/nginx_status Reading Userparameter=nginx.connections.writing,/data/zabbix/sbin/nginx_status Writing Userparameter=nginx.connections.waiting,/data/zabbix/sbin/nginx_status Waiting
Once created, you can configure the item monitoring item on the Web page.
Zabbix monitoring MySQL Database status
Zabbix self-provided templates can monitor MySQL slow queries,mysqlversion,uptime,alive and so on.
1.Zabbix officially provides a template for monitoring MySQL templates appmysql, you can see the relevant items and keys.
2. Use the template templates App MySQL link to the relevant host and find that the status of item is not available because the value of key is viewed by MySQL user "ShowGlobal status" Information or use the Mysqladmin command to view the value of status or extended-status information.
Mysql> show global status; Mysql> Show status;
This article is from the "Start from the Heart" blog, please be sure to keep this source http://hao360.blog.51cto.com/5820068/1639927
Zabbix Monitoring nginx,mysqld,php Status