0
0
Nginxdevops~30 mins

Nginx Plus monitoring - Mini Project: Build & Apply

Choose your learning style9 modes available
Nginx Plus Monitoring Setup
📖 Scenario: You are a system administrator responsible for monitoring the health and performance of your web servers. You use Nginx Plus, which provides a built-in API for monitoring server status and metrics.To keep track of your server's health, you want to enable the Nginx Plus status API and configure it to be accessible on a specific URL path.
🎯 Goal: In this project, you will configure Nginx Plus to enable its built-in status monitoring API. You will set up the configuration to expose the status on the /status URL path and then verify that the status page is accessible.
📋 What You'll Learn
Create an Nginx configuration snippet to enable the status API
Add a location block for /status to serve the status
Configure the status to show JSON output
Verify the status page is accessible by printing the curl command output
💡 Why This Matters
🌍 Real World
Nginx Plus provides a built-in API to monitor server health and performance. Enabling this API helps system administrators keep track of server status in real time.
💼 Career
Knowing how to configure and monitor Nginx Plus is valuable for DevOps engineers and system administrators managing web infrastructure.
Progress0 / 4 steps
1
Create the Nginx status configuration block
Create an Nginx configuration snippet that defines a status block with zone=status_zone and interval=5s inside the http context.
Nginx
Need a hint?

The status directive enables the Nginx Plus status zone. It must be inside the http block.

2
Add a location block for /status
Inside the http block, add a server block with a location /status that uses status; to enable the status API endpoint.
Nginx
Need a hint?

The status; directive inside the location /status block enables the status API endpoint.

3
Configure status to show JSON output
Inside the location /status block, add the directive status_format json; to configure the status output format as JSON.
Nginx
Need a hint?

The status_format json; directive tells Nginx Plus to output the status in JSON format.

4
Verify the status page is accessible
Run the command curl -s http://localhost:8080/status and print its output to verify the JSON status is returned.
Nginx
Need a hint?

Use Python's subprocess.check_output to run the curl command and print the JSON output.