vozlt / nginx-module-vts

Nginx virtual host traffic status module
BSD 2-Clause "Simplified" License
3.22k stars 459 forks source link

server zones bug #263

Closed hailiangchen closed 1 year ago

hailiangchen commented 1 year ago

I configured tow sites, both using localhost, but with different ports.

Problem: You cannot distinguish two sites in the server zones list. image

u5surf commented 1 year ago

@hailiangchen Thanks reporting. We tend to investigate deeply such the behavior, can you let us your nginx(if you have third party fork such as openresty, tengine and so on) version and configuration.

hailiangchen commented 1 year ago

Tengine version: Tengine/2.3.3 nginx version: nginx/1.18.0

u5surf commented 1 year ago

@hailiangchen You mean you'd like to serve the different port and get their metrics separately. How about using vhost_traffic_status_filter_by_set_key like this?

http {
    include       mime.types;
    default_type  application/octet-stream;

    #vhost_traffic_status_zone shared:vhost_traffic_status:32m;
    vhost_traffic_status_zone;
    upstream backend {
            server localhost:8080;
    }

    vhost_traffic_status_filter_by_set_key $server_port server::ports::$server_addr;
    server {
        listen 8081;
        location /backend {
            proxy_pass http://backend;
        }
        location /status {
            check_status;
            vhost_traffic_status_display;
            vhost_traffic_status_display_format html;

            access_log off;
        }
    }
    server {
        listen 8082;
        location /backend {
            proxy_pass http://backend;
        }
    }
    server {
        listen 8083;
        location /backend {
            proxy_pass http://backend;
        }
    }
スクリーンショット 2023-04-10 22 07 40
hailiangchen commented 1 year ago

ok, i'll try