Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module bug #285

Open
forolo opened this issue Dec 22, 2023 · 4 comments
Open

Module bug #285

forolo opened this issue Dec 22, 2023 · 4 comments

Comments

@forolo
Copy link

forolo commented Dec 22, 2023

When i modify paramerters like paragraph title , preselect update intervale and CSS style I cannot obtain data poling of traffics status . What can i do that to resolve that issues

@u5surf
Copy link
Collaborator

u5surf commented Dec 23, 2023

@forolo Hi, Thanks reporting. To clarify what happened on your pages, let us tell the detail of your site's code.

@Lecyd
Copy link

Lecyd commented Dec 23, 2023

(Debian Bullseye)
When I modify status.template.html and copy it to nginx root folder nothing apear on status page (with Nginx vhost traffic status customization when it activated).
Would you like to explain to us step by step with détails the status customization :
-Change update intervale from 1sec to 8sec or 10sec.
-modify CSS style

@u5surf
Copy link
Collaborator

u5surf commented Dec 31, 2023

When I modify status.template.html and copy it to nginx root folder nothing apear on status page (with Nginx vhost traffic status customization when it activated).

@Lecyd
Have you customized the template.html following the page below?
https://github.com/vozlt/nginx-module-vts#to-customize-after-the-module-installed

@u5surf
Copy link
Collaborator

u5surf commented Dec 31, 2023

@Lecyd
Can you customized the template.html and nginx.conf following that.

vtsStatusURI is the endpoint of fetching the vts data by the json format.

The below example refers that the endpoint is prepared by location /status on nginx.conf.

function vtsGetData() {
var monitor = document.getElementById('monitor');
var request = new XMLHttpRequest;
request.onload = function() {
if (this.status != 200) {
return;
}
monitor.innerHTML = template(JSON.parse(this.responseText));
}
request.open('GET', vtsStatusURI);
request.send();
};

share/status.template.html (Change update intervale from 1sec to 8sec)

diff --git a/share/status.template.html b/share/status.template.html
index 68f771a..89c2b98 100644
--- a/share/status.template.html
+++ b/share/status.template.html
@@ -386,7 +386,7 @@
                 });
             };

-            var vtsStatusURI = "{{uri}}/format/json", vtsUpdateInterval = 1000, vtsUpdate;
+            var vtsStatusURI = "http://{{yourhostname}}:8081/status", vtsUpdateInterval = 8000, vtsUpdate;

             var vtsStatusVars = {
                 titles: {

nginx.conf

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

    vhost_traffic_status_zone shared:vhost_traffic_status:32m;
    vhost_traffic_status_zone;

    upstream backend {
        zone backend 64k;
        server localhost:8080;
    }
    server {
        root /usr/local/nginx/html;
        listen 8081;
        location /backend {
            proxy_pass http://backend;
        }
        location / {
                return 301 /status.html;
        }
        location /status.html {}
        location /status {
            vhost_traffic_status_display;
            vhost_traffic_status_display_format json;

            access_log /usr/local/nginx/logs/access.log;
        }
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants