Enable monitoring
Monitoring your application’s performance is crucial for maintaining its reliability and efficiency. F5 NGINXaaS for Google Cloud (NGINXaaS) seamlessly integrates with Google Cloud services, allowing you to collect, correlate, and analyze metrics for a thorough understanding of your application’s health and behavior.
- Enable the Cloud Monitoring API.
- Configure Workload Identity Federation (WIF). See our documentation on setting up WIF for exact steps.
- Grant a project-level role or grant your principal access to the
roles/monitoring.viewer
role. See Google’s documentation on controlling access to Cloud Monitoring with IAM.
To enable sending metrics to your desired Google Cloud project, you must specify the project ID when creating or updating a deployment. To create a deployment, see our documentation on creating an NGINXaaS deployment for a step-by-step guide. To update the deployment, in the NGINXaaS console,
- On the navigation menu, select Deployments.
- Select the deployment you want to update and select Edit.
- Enter the project you want metrics to be send to under Metric Project ID.
- Select Update.
See the Metrics Catalog for a full list of metrics NGINXaaS provides.
Log in to your Google Cloud Console,
- Go to your metric project.
- Search for “Metrics Explorer”.
Refer to the Google’s Metrics Explorer documentation to learn how you can create charts and queries.
You can retrieve raw time series metrics from the Cloud Monitoring API.
For example, you can use projects.timeSeries.list
to list metrics matching filters from a specified time interval. The following curl
command lists nginx.http.requests
metrics from the time interval start_time
to end_time
in the given project_id
.
curl \
"https://monitoring.googleapis.com/v3/projects/{project_id}/timeSeries?filter=metric.type%3D%22workload.googleapis.com%2Fnginx.http.requests%22&interval.endTime={end_time}&interval.startTime={start_time}" \
--header "Authorization: Bearer $(gcloud auth print-access-token)" \
--header "Accept: application/json" \
--compressed
See Google’s documentation to authenticate for using REST for more information.
The following JSON shows an example response body:
{
"timeSeries": [
{
"metric": {
"labels": {
"nginxaas_deployment_location": "us-east1",
"nginxaas_deployment_object_id": "depl_AZjtL2OUdCeh-DROeCLp1w",
"nginxaas_account_id": "account-id",
"service_name": "unknown_service:naasagent",
"instrumentation_source": "naasagent",
"nginxaas_deployment_name": "test-deployment",
"nginxaas_namespace": "default"
},
"type": "workload.googleapis.com/nginx.http.requests"
},
"resource": {
"type": "generic_node",
"labels": {
"node_id": "",
"location": "global",
"namespace": "",
"project_id": "{project_id}"
}
},
"metricKind": "CUMULATIVE",
"valueType": "INT64",
"points": [
{
"interval": {
"startTime": "{start_time}",
"endTime": "{end_time}"
},
"value": {
"int64Value": "1405"
}
}
]
}
],
}
Many of NGINX Plus’s advanced statistics need to be enabled in the “nginx.conf” file before they will appear in the Metrics Explorer, for example “plus.http.request.bytes_*”. Refer to Gathering Data to Appear in Statistics to learn more.
To disable sending metrics to your Google Cloud project, update your NGINXaaS deployment to remove the reference to your project ID. To update the deployment, in the NGINXaaS console,
- On the navigation menu, select Deployments.
- Select the deployment you want to update and select Edit.
- Remove the project ID under Metric Project ID.
- Select Update.