(二)Prometheus监控Nginx服务

目录

一,部署环境准备

1,安装Nginx  下载地址

2,在Linux安装 nginx-module-vts  组件   下载地址 

3,在Linux安装nginx-vts-exporter   组件  下载地址

二,安装nginx以及组件 nginx-module-vts

1,安装Nginx

2,修改Nginx配置文件

3,启动Nginx服务  

4,启动nginx后访问http://IP地址/status   

三, 安装nginx-vts-exporter   组件

 1,安装 nginx-vts-exporter 用来收集 nginx 的 json 数据

2,启动nginx-vts-exporter 

3,另开一个窗口,查看端口

四,添加监控至 Prometheus服务器IP地址(192.168.100.12)

1,重启Prometheus服务

2,查看 Prometheus 网页状态 


通过上一篇文章,(一)Prometheus部署+node_exporter组件实例详解          

本篇继续搭建基于——Prometheus监控Nginx服务 

一,部署环境准备

Prometheus服务器 192.168.100.12
Nginx+MySQL服务器 192.168.100.13
grafana 服务器 192.168.100.12

1,安装Nginx  下载地址

https://nginx.org/download/nginx-1.22.1.tar.gz

2,在Linux安装 nginx-module-vts  组件   下载地址 

 nginx-module-vts组件:  Nginx的监控模块,能够提供JSON格式的数据产出

https://codeload.github.com/vozlt/nginx-module-vts/zip/refs/heads/master

3,在Linux安装nginx-vts-exporter   组件  下载地址

nginx-vts-exporter 组件:主要用于收集Nginx的监控数据,并给Prometheus提供监控接口,默认端口号9913

https://github.com/hnlq715/nginx-vts-exporter/releases/download/v0.10.3/nginx-vts-exporter-0.10.3.linux-amd64.tar.gz

二,安装nginx以及组件 nginx-module-vts

1,安装Nginx

[root@localhost ~]#  cd /opt/ ; mkdir nginx ; cd nginx
[root@localhost nginx]# pwd
/opt/nginx
[root@localhost nginx]# rz -E
rz waiting to receive.
[root@localhost nginx]# ls
nginx-1.22.1.tar.gz
[root@localhost nginx]# tar xf nginx-1.22.1.tar.gz  #解压包
[root@localhost nginx]# ls
nginx-1.22.1  nginx-1.22.1.tar.gz

#安装依赖

[root@localhost nginx]# yum -y install openssl-devel pcre-devel

#上传解压组件

[root@localhost nginx]# rz -E
rz waiting to receive.
[root@localhost nginx]# ls
nginx-1.22.1  nginx-1.22.1.tar.gz  nginx-module-vts-master.zip
[root@localhost nginx]# unzip nginx-module-vts-master.zip
[root@localhost nginx]# ls
nginx-1.22.1  nginx-1.22.1.tar.gz  nginx-module-vts-master  nginx-module-vts-master.zip
[root@localhost nginx]# mv nginx-module-vts-master /usr/local/
[root@localhost nginx]# cd nginx-1.22.1/
[root@localhost nginx-1.22.1]# ls
auto  CHANGES  CHANGES.ru  conf  configure  contrib  html  LICENSE  man  README  src
编译安装Nginx

[root@localhost nginx-1.22.1]# ./configure --prefix=/usr/local/nginx --add-module=/usr/local/nginx-module-vts-master/
checking for OS
 + Linux 3.10.0-1160.71.1.el7.x86_64 x86_64
checking for C compiler ... found
 + using GNU C compiler
 + gcc version: 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) 
checking for gcc -pipe switch ... found
checking for -Wl,-E switch ... found
checking for gcc builtin atomic operations ... found
checking for C99 variadic macros ... found
checking for gcc variadic macros ... found
checking for gcc builtin 64 bit byteswap ... found
checking for unistd.h ... found
checking for inttypes.h ... found
checking for limits.h ... found
checking for sys/filio.h ... not found
checking for sys/param.h ... found
checking for sys/mount.h ... found
checking for sys/statvfs.h ... found
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

机灵的小小子

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值