With Nginx + Telegraf + Influxb + Grafana build high b Nginx cluster grid monitoring system

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.

d09d3ca3faed41fcadc14e40be7f7965


Modify Nginx configuration file: Increase in Server section:

location /nginx-status {
       allow 127.0.0.1; // allowed IP
       deny all;
       stub_status on;
       access_log off;}

Reload restart Nginx, see Nginx-Status

ca778a22f9bb4849adac1cc1b7400156


Output Description information:

active connections - the number of active connections server accepts handled requests - handled a total of 11,989 connections, successfully created 11989 handshake, handled a total of 11,991 requests
reading — 读取客户端的连接数
writing — 响应数据到客户端的数量
waiting — 开启 keep-alive 的情况下,这个值等于 active – (reading+writing), 意思就是 Nginx 已经处理完正在等候下一次请求指令的驻留连接.


二、Telegraf安装配置Nginx监控

关于Telegraf的安装,请参考官方介绍

https://www.influxdata.com/time-series-platform/telegraf/

b2aeea679c294fa3bc861c6c60e8de59


wget https://dl.influxdata.com/telegraf/releases/telegraf-1.4.3-1.x86_64.rpmsudo yum localinstall telegraf-1.4.3-1.x86_64.rpm

然后,在配置文件teldgraf.conf中配置Influxdb连接

06f5fce045204597ab502ef9f51fdb4b


增加对Nginx的监控

4b90906e25324c989af0bd459240bedd


配置完成,重启telegraf服务即可。


三、Grafana集成Nginx监控

Grafana中支持Influxdb数据源,配置上上个步骤的Influxdb数据源之后,我们定制Nginx监控图表:

数据源:Influxdb

FROM:nginx

SELECT:field(accepts)

783dc1ebc54b46099b5df20f7cdd86e2


5c31ee9a1e97443fa63c6c90e0e1be79


展现效果:

477665faa6e4412aaa528528e42e2775


以上我们通过Nginx+Telegraf+Influxb+Grafana,实现了Nginx的监控,非常方便。

你们在日常实际生产环境对Nginx的状态监控使用的是何种技术?

最新整理的Java技术干货文档资料:【Java核心知识点整理】涵盖29个Java核心技术详解,JVM,Redis,Nginx,Spring Boot,Spring Cloud,Kafka,并发编程,Tomcat,MyBatis,BAT面试题,Java技术精讲视频等。转发+关注,加我VX【tkzl6666】即可获得免费领取方式。

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.


Guess you like

Origin blog.51cto.com/14480698/2483086