vozlt/nginx-module-vts

server zones bug

hailiangchen opened this issue · 4 comments

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

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

@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.

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

@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

ok, i'll try