Background
This article will introduce how to view the metrics on Grafana for AWS BigAnimal hosted clusters.
Prerequisites
When creating the cluster, you need to fill in your client AWS Account ID(the AWS account Grafana server hosted at in this case) it will be used to access the metrics.
Step 1 Get the Metrics information from Monitoring & Logging
- Prometheus URL - http://p-xm9sbs62ej.metrics.pg.biganimal.io:8080
- Service Name - com.amazonaws.vpce.us-east-1.vpce-svc-090f31b93be280d93
Step 2 Login to the AWS account and create the endpoint
Goto AWS console -> VPC dashboard -> Endpoints, click "Create endpoint":
Input the Service name as copied from the step 1:
Input the VPC and subnets of the Grafana server. Check "Enable DNS name":
Select the security group with 8080 open, then click "Create endpoint":
Wait for the endpoint Status Available:
Step 3: Test the connection of the Prometheus URL
Firstly the Prometheus URL can be used from a VM at the same VPC:
Below command returns all the metrics names
curl http://p-xm9sbs62ej.metrics.pg.biganimal.io:8080/api/v1/series | jq .
Query one metrics:
curl -s --data-urlencode 'query=cnp_backends_waiting_total' http://p-xm9sbs62ej.metrics.pg.biganimal.io:8080/api/v1/query | jq .data.result
[
{
"metric": {
"__name__": "cnp_backends_waiting_total",
"aks_cluster_name": "dp-bahbiganimal-eks-useast1-1",
"cloud_provider": "aws",
"cluster": "p-xm9sbs62ej",
"container": "postgres",
"endpoint": "metrics",
"instance": "10.236.158.200:9187",
"job": "monitoring/pg-cluster",
"namespace": "p-xm9sbs62ej",
"pod": "p-xm9sbs62ej-1",
"prometheus": "monitoring/k8s",
"role": "primary",
"telegraf_scrape_interval": "2m"
},
"value": [
1697441950.413,
"0"
]
}
]
Step 4: Configure data source with Prometheus type on Grafana
Go to Grafana console and click Configuration - Data Sources from the navigation pane on the left:
Click "Add data source" then search Prometheus:
Input the Prometheus URL, leave all others as default then test the data source:
Step 5 Explore the metrics
Now you can explore the metrics in Grafana and create your dashboard.
If you need some dashboard templates, please contact BigAnimal Support