In this lab, you will be exploring the integration between NGINXaaS for Azure and Grafana for monitoring of the service. NGINX as a Service for Azure is a service offering that is tightly integrated into Microsoft Azure public cloud and its ecosystem, making applications fast, efficient, and reliable with full lifecycle management of advanced NGINX traffic services.
NGINXaaS is powered by NGINX Plus, so much of the configuration is similar to what you are already used to. We will use Grafana to create a dashboard in which we will monitor:
- HTTP requests
- HTTP Metrics
- Cache Hit Ratio
- SSL Metrics
- Upstream Response Time
- Health checks
The data for these will be based on the work done in previous labs.
NGINXaaS for Azure | Grafana |
---|---|
![]() |
![]() |
By the end of the lab you will be able to:
- Create a Grafana managed instance in Azure
- Create a Dashboard to monitor metrics in NGINXaaS for Azure
- Test the Grafana Server
- View the Grafana Dashboard
- You must be using NGINXaaS for Azure
- See
Lab0
for instructions on setting up your system for this Workshop - Have Docker installed to run workloads (for graph data)
- Familiarity with basic Linux commands and commandline tools
- Familiarity with basic HTTP protocol
- Familiarity with Grafana
- Ensure you are in the
lab10
folder. We will set two environment variables and then use these to create the Grafana Instance via the Azure CLI.
Please Note there is a charge associated with standing up a Managed Grafana instance in Azure and you should be sure to delete the resources when you are finished exploring the lab.
The resource group should be the same as the one you have been using for the whole workshop. If it is not set, do it here. The MY_GRAFANA variable is what the resource will be called when you are looking for it in Azure.
export MY_RESOURCEGROUP=a.currier-workshop
export MY_GRAFANA=grafanaworkshop
az grafana create --name $MY_GRAFANA --resource-group $MY_RESOURCEGROUP
- In the output of the above command, take note of the endpoint that has been created for you. It should be found in a key labelled endpoint.
Using the endpoint URL you can log into the Managed Grafana instance using your Microsoft Entra ID (that you have been using for these labs). If you forgot to grab the endpoint URL, you can retrieve it via the Azure CLI tool:
az grafana show --name $MY_GRAFANA --resource-group $MY_RESOURCEGROUP --query "properties.endpoint" --output tsv
Open a web browser and go to the endpoint address listed. You should see an Entra ID login which may or may not have your credentials pre-populated:
Once signed in, you will be taken to the default Grafana landing page.
From here we will want to click on the Dashboards Menu on the left hand side.
In the upper right of the page is a blue drop down button. We will select Import:
In Visual Studio Code, navigate to the Lab10 folder. Open the N4A-Dashboard.json file and inspect it.
This template file makes use of Grafana Variables to make it easier to customize to your environment. Let's retrieve the values we will need for the dashboard in the VS terminal by running the following commands:
export MY_RESOURCEGROUP=$(az resource list --resource-group a.currier-workshop --resource-type Nginx.NginxPlus/nginxDeployments --query "[].resourceGroup" -o tsv)
export MY_RESOURCENAME=$(az resource list --resource-group a.currier-workshop --resource-type Nginx.NginxPlus/nginxDeployments --query "[].name" -o tsv)
export MY_LOCATION=$(az resource list --resource-group a.currier-workshop --resource-type Nginx.NginxPlus/nginxDeployments --query "[].location" -o tsv)
export MY_AKSCluster1=n4a-aks1
export MY_AKSCluster2=n4a-aks2
export MY_WindowsVM=windowsvm
export MY_UbuntuVM=ubuntuvm
Confirm the values were set:
set | grep MY
MY_AKSCluster1=n4a-aks1
MY_AKSCluster2=n4a-aks2
MY_LOCATION=eastus
MY_RESOURCEGROUP=a.currier-workshop
MY_RESOURCENAME=nginx4a
MY_UbuntuVM=ubuntuvm
MY_WindowsVM=windowsvm
Now that we have these 7 values we can use them in the Dashboard template.
Copy the code from the N4A-Dashboard.json file. In the grafana import window, paste the code into the import field and then click the blue load button.
To get the Dashboards to load. Replace each variable field at the top (see image) with the values you retrieved for your lab:
- Start the WRK load generation tool. This will provide some traffic to the NGINXaaS for Azure instance, so that the statistics will be increasing.
docker run --rm williamyeh/wrk -t20 -d600s -c1000 https://cafe.example.com/
We now have a working dashboard displaying some key metrics of the NGINX for Azure service. As with most dashboards, you can adjust the time intervals, etc. to get a better look at the data. Feel free to explore each of the data panels.
There are many different metrics available to use and you have the option to create and build dashboards to suit your needs. For these pre-built ones, we added three sections. The first section highlights metrics for NGINXaaS. These are taken directly from the NGINXaaS Metrics page that you can find linked below. The next section is monitoring your Kubernetes clusters that you built in the previous labs. The final section adds a few metrics for the Virtual Machines that were previously created. Feel free to review each of these panels and explore adding panels of your own.
To delete the Managed Grafana instance, you can do so via the CLI using this command:
az grafana delete --name $MY_GRAFANA --resource-group $MY_RESOURCEGROUP --yes
If the
wrk
load generation tool is still running, then you can stop it by pressingctrl + c
.
This completes Lab 10.
- NGINX For Azure Metrics Catalog
- Azure Managed Grafana Docs
- Build a Grafana Dashboard
- NGINX Admin Guide
- NGINX Technical Specs
- Chris Akker - Solutions Architect - Community and Alliances @ F5, Inc.
- Shouvik Dutta - Solutions Architect - Community and Alliances @ F5, Inc.
- Adam Currier - Solutions Architect - Community and Alliances @ F5, Inc.