wget https://codeload.github.com/yaoweibin/nginx_upstream_check_module/zip/master
nginx-module-vts-master.zip # prometheus监控组件
nginx_upstream_check_module-master.zip
安装依赖的包
yum -y install gcc gcc-c++ make automake autoconf libtool zlib zlib-devel openssl openssl-devel pcre pcre-devel libxslt-devel libxml2-devel gd-devel perl-devel perl-ExtUtils-Embed gperftools unzip
yum install -y GeoIP-devel.x86_64
#解压nginx安装包,并进入解压目录
tar xf nginx-1.18.0.tar.gz
cd nginx-1.18.0
patch -p1 < /usr/local/nginx_upstream_check_module-master/check_1.16.1+.patch
#编译nginx,指定启动用户为nginx,安装路径为/usr/local/nginx,编译参数下面有详解
./configure --prefix=/apps/nginx --with-http_stub_status_module --without-http-cache --with-http_ssl_module --with-http_realip_module --with-stream --with-http_sub_module --add-module=/usr/local/nginx_upstream_check_module-master --add-module=/usr/local/nginx-module-vts-master --with-http_realip_module --with-http_geoip_module --with-http_gzip_static_module --with-http_v2_module --with-stream_ssl_module
#安装nginx
make && make install
#给目录授权
chown -R nginx:nginx /usr/local/nginx
#设置nginx启动命令为系统命令
echo “PATH=$PATH:/usr/local/nginx/sbin/” >> /etc/profile
#使命令生效
source /etc/profile
#启动nginx
-o objs/addon/src/ngx_http_vhost_traffic_status_display_json.o \
/usr/local/nginx-module-vts-master/src/ngx_http_vhost_traffic_status_display_json.c
/usr/local/nginx-module-vts-master/src/ngx_http_vhost_traffic_status_display_json.c: In function ‘ngx_http_vhost_traffic_status_display_set_upstream_group’:
/usr/local/nginx-module-vts-master/src/ngx_http_vhost_traffic_status_display_json.c:604:59: error: ‘ngx_http_upstream_rr_peer_t’ has no member named ‘check_index’
if (ngx_http_upstream_check_peer_down(peer->check_index)) {
^
make[1]: *** [objs/addon/src/ngx_http_vhost_traffic_status_display_json.o] Error 1
make[1]: Leaving directory `/usr/local/src/nginx-1.18.0’
make: *** [build] Error 2
patch -p1 < /root/nginx_upstream_check_module/check_1.17.1+.patch