You can access metrics in a Prometheus format if you have the custom monitoring and logging feature enabled.
- If the Cloud Provider for your BigAnimal cluster is AWS, the metrics data are stored in your Amazon S3.
- If the Cloud Provider for your BigAnimal cluster is Azure, the metrics data are stored in your Azure Storage.
With Grafana you can create, explore the metrics through beautiful, flexible dashboards. In this article, we’ll walk you through how to configure Grafana to access the BigAnimal metrics endpoint and view metrics on the Grafana dashboard. The solution is about BigAnimal AWS BYOA, you can refer to this article for the solution of BigAnimal Azure.
- The cloud provider is AWS for BigAnimal cluster;
- The custom monitoring and logging feature is enabled on BigAnimal;
- Grafana is running on a AWS EC2 instance in the same region with BigAnimal cluster.
There are the main steps to implement the solution:
- Set up the access to the metrics endpoint from the Grafana server;
- Configure data source with Prometheus type on Grafana;
- Explore the metrics and create the dashboard.
Step 1: Set up the access to the metrics endpoint from the Grafana server
You can get the metrics endpoint from the Monitoring & Logging tab on Cluster page at BigAnimal portal In this example, below is the Prometheus URL:
There are two options to access the Prometheus URL on Grafana server:
a. AWS VPC peering(recommended)
As the metrics endpoint is set up at private network on BigAnimal managed AWS VPC, you can refer to the article to set up the VPC peering between BigAnimal VPC and the VPC of Grafana server, then move to Step 2: Configure data source with Prometheus type on Grafana
b. AWS VPC endpoint
Please follow the steps to set up the endpoint service and endpoint:
Step 1. Get the the load balancer of the metrics endpoint.
- Open the Amazon EC2 console. Ensure that the correct region, where your cluster is deployed.
- Identify the load balancer that is tagged with `kubernetes.io/service-name: monitoring/thanos-query` at the page of "Load balancers":
Step 2. Create the Endpoint service for the load balancer
- Open the Amazon VPC console
- From the navigation pane on the left, select Endpoint Services under Virtual Private Cloud, and then select Create endpoint service.
- Enter a suitable name for the endpoint service.
- Select Network for the load balancer type.
- Under Available load balancers, select the network load balancer you have got on previous step;
- Leave all the other fields with their default values and select Create.
Under Details, note the Service name of the created endpoint service (for example, com.amazonaws.vpce.us-east-1.vpce-svc-0164eb4d65c23ef39). You will need the service name while creating a VPC endpoint.
In the navigation pane, select Endpoint Services.
Select your endpoint service from the Actions list, and select Allow principals.
Add the AWS account with which you want to connect to the endpoint service by specifying the ARN for the principal. See AWS documentation about ARNs for AWS principals.
Step 3. Create the Endpoint for the VPC of Grafana server
Open the Amazon VPC console.
Ensure that the same region, where your BigAnimal cluster is deployed, is selected in the upper-right corner of the console.
From the navigation pane on the left, select Endpoints under Virtual Private Cloud, and then select Create endpoint.
Enter a suitable name for the endpoint.
Under Service category, select Other endpoint services.
- Under Service Name, enter the name of the endpoint service that you created earlier (com.amazonaws.vpce.us-east-1.vpce-svc-0164eb4d65c23ef39). Verify whether you have successfully allowed access to the endpoint by selecting Verify service.
- Under VPC, select the VPC of Grafana in which to create the endpoint.
- Under Subnets, select the subnets (availability zones) in which to create the endpoint network interfaces. Enable the endpoint in all availability zones used by your application.
- Select Create endpoint.
- Under Details, note the DNS names of the created endpoint (for example, vpce-067a33ac9d7a2cd27-nofv6jwq.vpce-svc-0164eb4d65c23ef39.us-east-1.vpce.amazonaws.com). You will need the endpoint DNS name while configure Grafana.
Step 4. Accept the endpoint connection
In your AWS account connected to BigAnimal, select VPCs and then select Endpoint services.
Select the endpoint service instance you created previously and accept the endpoint connection request under Endpoint connections.
Step 2: Configure data source with Prometheus type on Grafana
1. Go to your Grafana web console and click Configuration - Data Sources from the navigation pane on the left.
2. Click "Add data source" then search Prometheus.
3. Configure the Prometheus data source.
a. If you are using AWS VPC peering to connect to the metrics endpoint:
Input the Prometheus URL(for example, https://m-awsuseast1-7.xgv7pbgfawhhnakq.biganimal.io:10902). Leave all the other fields with their default values.
b. If you are using AWS VPC endpoint to connect to the metrics endpoint:
Replace the hostname at Prometheus URL with the endpoint DNS name you created previously(for example, https://vpce-067a33ac9d7a2cd27-nofv6jwq.vpce-svc-0164eb4d65c23ef39.us-east-1.vpce.amazonaws.com:10902). Then input the URL in the HTTP URL on Grafana and check Skip TLS Verify as there is host name changed.
4. Test the data source
Select Save & Test, "Data source is working" is shown if the connection test is successful.
Step 3: Explore the metrics and create the dashboard
Now you can explore the metrics in Grafana and create your dashboard.
To get dashboard template, please contact BigAnimal Support