After a routine production environment build Nginx cluster, we need to continue in-depth study is the daily monitoring of Nginx.
How Nginx monitor? I believe Baidu can be found: nginx-status
By Nginx-status, real-time access to the monitoring data Nginx, and how existing monitoring systems integration? A good solution:
INX + Telegraf + Influxdb + Grafana
I.e., monitoring the timing Telegraf collected by monitoring status of Nginx widget, stored in the database Influxdb sequence, and then to show by Grafana.
A, Nginx nginx-status function is enabled
Nginx source compiler installed, you need to add corresponding module at compile time
./configure --with-http_stub_status_module
Use ./configure --help to see more support module. Then you can compile and install.
If you are directly installed apt-get install nginx, then use the command to see if support stub_status this module.
The following command: nginx -V to see if there --with-http_stub_status_module this module.
Modify Nginx configuration file: Increase in Server section:
location /nginx-status {
allow 127.0.0.1; //允许的IP
deny all;
stub_status on;
access_log off;
}
Reload restart Nginx, see Nginx-Status
Output Description information:
active connections – 活跃的连接数量
server accepts handled requests — 总共处理了11989个连接 , 成功创建11989次握手, 总共处理了11991个请求
reading — 读取客户端的连接数
writing — 响应数据到客户端的数量
waiting — 开启 keep-alive 的情况下,这个值等于 active – (reading+writing), 意思就是 Nginx 已经处理完正在等候下一次请求指令的驻留连接.
Two, Telegraf install Nginx configuration monitoring
About installation Telegraf, please refer to the official introduction
https://www.influxdata.com/time-series-platform/telegraf/
wget https://dl.influxdata.com/telegraf/releases/telegraf-1.4.3-1.x86_64.rpm
sudo yum localinstall telegraf-1.4.3-1.x86_64.rpm
Then, Influxdb arranged in connection profile teldgraf.conf
Increased monitoring of the Nginx
Configuration is complete, restart telegraf the service.
Three, Grafana integrated Nginx monitoring
Grafana support Influxdb data sources, data source after Influxdb on the steps of the configuration, monitoring our custom Nginx chart:
Data source: Influxdb
FROM:nginx
SELECT:field(accepts)
To show the effect of:
Above us by Nginx + Telegraf + Influxb + Grafana, realized Nginx monitoring, very convenient.
You state in the daily monitoring of actual production environment Nginx's use of what technology?
The latest finishing Java technology Dry Documentation: [Java core knowledge points finish] covering 29 core Java technology explain, JVM, Redis, Nginx, Spring Boot, Spring Cloud, Kafka, concurrent programming, Tomcat, MyBatis, BAT face questions, Java technical succinctly and video. + Forwarding concern, private letter reply "dry" to get free to receive mode.
With this knowledge point, the interview of the candidates but also a lot of eye-catching, crit 9999 points. Opportunities are reserved for those who are prepared, only adequate preparation before they can make themselves stand out among the candidates.