CentOS Debian Mint openSUSE Red Hat Ubuntu

Monitor your NGINX web/proxy server using Amplify

Monitor your NGINX web/proxy server using Amplify

As Nginx is one of the most widely used open source web servers, it is better to monitor such servers. Amplify is one such capable monitoring tool which has a great role for the better handling of the server. It is based on a SaaS (Software as a Service) monitoring platform. It also has support for Nginx Plus, php-fpm and other components of the underlying operating system.

It has support for all Linux distributions such as Ubuntu, Debian, Fedora, Centos, RHEL, and so on. It has great monitoring capabilities for almost all the things involved on the Nginx server like Network traffic, Memory Usage, CPU Usage, HTTP errors, HTTP version, Nginx traffic.

In this article, we are going to discuss and show the installation process and use cases with its feature of the Web user interface where you can see all the reports and statistics involved on the Nginx server.

Creating an Account on Nginx Amplify Website and download amplify agent script

First, let’s visit the Nginx Amplify website then create an account. After creating the account, you will receive an email to verify the account.

Nginx Amplify Site
https://amplify.nginx.com/

After verifying the account, connect to your server through ssh where you have installed nginx. Then you are good to download the amplify agent script with the link given below.

$ wget https://github.com/nginxinc/nginx-amplify-agent/raw/master/packages/install.sh

Or you can also download with curl command as follows:

$ curl -L -O https://github.com/nginxinc/nginx-amplify-agent/raw/master/packages/install.sh

Installing the Amplify Agent Script

Now run the below command with the sudo user to install the amplify agent script on the server.

$ sudo API_KEY='4ddc68e6077eaa0b08b5c1ef50c760e0' sh ./install.sh

Note: API_KEY might be different in your case.

You can click on continue on the amplify site after the successful installation of nginx-amplify-agent package. See the picture below for the details.

Stub_status Configuration for Nginx

Next, add the stub_status configuration file on nginx Which builds the key graphs for Nginx.

First, navigate to the nginx directory with the following command.

$ cd /etc/nginx

Now add the stub_status configuration file for Nginx as below command.

$ sudo vim conf.d/sub_status.conf

Add the configuration as shown on the screenshot below.

server {

listen 127.0.0.1:80;

server_name 127.0.0.1;

location /nginx_status {

stub_status on;

allow 127.0.0.1;

deny all;

}

}

Now to activate the configuration module stub_status, restart the Nginx service with the following command.

$ sudo systemctl restart nginx.service

You can click on continue on the amplify site after the successful configuration of stub_status module.

Setup Additional Nginx metrics

Let’s set up additional Nginx metrics for better monitoring. You can add and set up the files like access_log, error_log and log_format. Edit your main nginx configuration file /etc/nginx/nginx.conf file as follows.

Access_log and error_log

$ sudo vim nginx.conf
access_log /var/log/nginx/access.log main_ext;

error_log /var/log/nginx/error.log warn;

Log_format

Add the configurations as shown on below screenshot for the log_format

log_format main_ext '$remote_addr - $remote_user [$time_local] "$request" '

'$status $body_bytes_sent "$http_referer" '

'"$http_user_agent" "$http_x_forwarded_for" '

'"$host" sn="$server_name" ' 'rt=$request_time '

'ua="$upstream_addr" us="$upstream_status" '

'ut="$upstream_response_time" ul="$upstream_response_length" '

'cs=$upstream_cache_status' ;

Restart the Nginx server with the following command.

$ sudo systemctl restart nginx.service

Amplify Agent for monitoring Nginx web server

Now, you can monitor Nginx web server with the Amplify Agent by watching the results and reports on the amplify dashboard Web UI portal as the screenshot below.

For a more clear view of the reports on Nginx web server, go through the Overview section as follows screenshot.

Conclusion

Amplify is an important monitoring tool having a significant role for the better handling of the server that is based on a SaaS monitoring platform. Its support for Nginx Plus, php-fpm and other components of the underlying operating system is a great advantage for the Nginx users to monitor all the involved systems through a WEB UI portal. Thank you!

Similar Posts