Nginx Integration
If you are running Nginx as your web server on any environment you need to keep track of how Nginx is working on your server. so we Xitoring added this feature so with a few easy steps you can have very useful and important statistics in the Xitoring app.
Supported platforms
The following guide is working on Linux and Windows servers but some details could be quite different based on the OS version.
Configuring Nginx
The first step you need to make sure that your Nginx has the stub_status_module
available. with the following command, you can be sure easily:
On Linux
nginx -V 2>&1| grep -o http_stub_status_module
The output should look like the following:
http_stub_status_module
On Windows
Navigate to the directory where Nginx is installed. This is typically C:\nginx
. Run the following command to check if stub_status_module
is available in Nginx:
nginx -V 2>&1| findstr /C:"http_stub_status_module"
The output should look like the following:
http_stub_status_module
Nginx Config file
After you make sure that you have stub_status_module
available, you have to add the following configuration to your Nginx server block as a location so the statistics will serve somewhere so Xitogent can collect them:
location /nginx-status {
stub_status;
access_log off;
server_tokens on;
allow 127.0.0.1;
deny all;
}
2
3
4
5
6
7
With this configuration Nginx will serve the statistics on http://127.0.0.1/nginx-status
only on localhost it will not expose the statistics on the internet.
Enable Nginx integration on Xitogent
Now that we get passed the hard part we just need to tell Xitogent to collect Nginx statistics and send them, it's a very easy duo to the Xitogent CLI easy integration setup.
You just need to execute the following command:
xitogent integrate
You will see something like below:
1) Mysql
2) Nginx
3) Apache
4) Supervisor
5) Php-fpm
6) Redis
7) Keydb
2
3
4
5
6
7
You will select Nginx which is number 2 from the list of available integrations and Xitogent CLI will prompt you for:
enter nginx status page URL (e.g. http://127.0.0.1:80/status):
Now you just have to enter the address on which your Nginx status is being served. in our example, it is:
http://127.0.0.1/nginx-status
If you have done everything right you will see the following output:
connection established
integration setup was successful and the config file updated
2
Now the configuration file is created in the /etc/xitogent/integrations/nginx_integration.conf
and the content of the config file is something like the below:
uri=http://127.0.0.1/nginx-status
Setup Triggers for Nginx integration
You can create triggers for the following parameters so you get incidents if any of the parameters exceed or go less than a specific value:
Active
Accepted
Handled
Reading
Writing
Waiting
Requests
2
3
4
5
6
7