nginx_vts_status grafana graph
https://grafana.com/grafana/dashboards/9785-nginx-vts/
nginx_vts_status/status/format/prometheus grafana graph for: https://github.com/vozlt/nginx-module-vts.git
前端的 Dockerfile
# https://hub.docker.com/r/zhangqifeng/nginx_vts
FROM zhangqifeng/nginx_vts:v1.56
# 申明临时卷
VOLUME /logs
VOLUME /tmp
# 拷贝打包的资源
ADD nginx-vts.conf /usr/local/nginx/conf/nginx.conf
ADD dist/ /usr/local/nginx/html
nginx-vts.conf
user www www;
worker_processes auto;
worker_cpu_affinity auto;
worker_rlimit_nofile 65535;
pid /var/run/nginx.pid;
events {
use epoll;
worker_connections 65535;
multi_accept on;
}
http {
include mime.types;
default_type application/octet-stream;
vhost_traffic_status_zone;
vhost_traffic_status_filter_by_host on;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
server_names_hash_bucket_size 512 ;
client_header_buffer_size 128k;
large_client_header_buffers 8 64k;
client_max_body_size 500m;
log_format json '{"created_at":"$time_iso8601",'
'"remote_addr":"$remote_addr",'
'"method":"$request_method",'
'"request":"$request",'
'"status":"$status",'
'"size":$body_bytes_sent,'
'"referer": "$http_referer",'
'"http_host":"$http_host",'
'"response_time":$request_time,'
'"http_x_forwarded_for":"$http_x_forwarded_for",'
'"user_agent": "$http_user_agent"'
access_log /usr/local/nginx/logs/access.log json;
error_log /usr/local/nginx/logs/error.log;
server {
listen 80;
charset utf-8;
server_name_in_redirect off;
# 项目前端负载
location / {
root /usr/local/nginx/html/portal;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
# 提供 nginx 基于nginx_vts的运行指标采集接口,供 prometheus 软件采集
location /nginx_vts_status {
vhost_traffic_status_display;
vhost_traffic_status_display_format html;
}
# 提供 nginx 内置的运行指标采集接口
location /nginx_status {
stub_status on;
access_log off;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
作者:Jeebiz 创建时间:2023-02-21 10:31
最后编辑:Jeebiz 更新时间:2024-02-26 11:18
最后编辑:Jeebiz 更新时间:2024-02-26 11:18