Welcome! Log In Create A New Profile

Advanced

How to query current configuration ?

Posted by maestropastelero 
How to query current configuration ?
February 13, 2020 01:40PM
I am automating a script for collecting some info, given a specific URL and returning all the server in the upstream Pool for that URL in a running NGINX+ instance.

My goal is to have something that I can query on web, or a script that I can run hourly basis and create an HTML with it that I can query later with my script.

I was planning to extract the info from the dashboard upstreams, but unfortunately the zones aren't descriptive enough and couldn't show all the matching URL in the regex definition for server_name on the config files.

From this running config :

server {
listen 443 ssl http2;
listen[::]:443 ssl http2;
server_name ~^(www|www2|www3).mycompany.com$;
status_zone www.mycompany.com;
.... ....

}

upstream www {
least_time header; zone area1 128k;
server server1.mycompany.com:443 max_fails=3 fail_timeout=30s;
server server2.mycompany.com:443 max_fails=3 fail_timeout=30s;
server server3.mycompany.com:443 max_fails=3 fail_timeout=30s;

}

Want to get from this Input URL : www2.mycompany.com

these Output Servers: server1, server2, server3


any thoughts?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 169
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready