i set up a 3 consul servers and 1 nginx and linked them in one cluster and everything is ok on the web ui .
i would like to run a custom .JSON config file to run this command "ss -nlt" in order to see the number of connections to that server on the web .
i already done similar thing for nginx as the below JSON file :
{
"service": {
"name": "Nginx1-server",
"tags": [ "colourserver" ],
"port": 80,
"check": {
"id": "webserver_up_test",
"name": "Get Nginx Main Page",
"http": "http://localhost/index.html",
"interval": "3s",
"timeout": "1s"
}
}
}
2
Answers
I figured it out , i used a python script and called it from a json file and it worked !
this is my python file "test.py" :
and this is my json file :
and the results are :![enter image description here](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%200%200'%3E%3C/svg%3E)
A more reliable way to obtain the number of active connections to the web server would be to use nginx’s
stub_status
module. This module outputs the number of active connections being handled by the web server. Below is an example config:consul-config.json
nginx-connections.sh
nginx.conf
The number of active connections can then be seen in the output from the script check.