Managed Service for Grafana allows you to add data channels to virtual private clouds (VPCs). This way, you can access VPC data sources that are not available over the Internet in Grafana workspaces. This topic describes how to access VPC data sources in Managed Service for Grafana over a VPC data channel. In this topic, a self-managed Prometheus data source in a VPC is used as an example.
This topic is applicable to Grafana workspaces that were created before September 1, 2023.
You can manage VPC data channels only in Managed Service for Grafana Pro Edition and Advanced Edition. If you are using the Developer Edition, upgrade to the Pro Edition or Advanced Edition first.
Background information
A VPC may be inaccessible over the Internet for the following reasons:
Security: Exposure to the Internet increases the risk of attacks.
Costs: You must pay for elastic IP addresses (EIPs).
You can add VPC data channels in Managed Service for Grafana if the data sources are not suitable for Internet exposure or multiple VPC data sources need to be displayed in the same Grafana workspace.
(Optional) Step 1: Install a Prometheus data source in a VPC
If a data source is already installed in your VPC, skip this step.
In this example, a Prometheus data source is installed on an Elastic Compute Service (ECS) instance. You can install other data sources on the ECS instance based on your business requirements.
Log on to an ECS instance in the VPC.
Run the following commands to install Prometheus on the ECS instance:
# Download the Prometheus installation package. wget https://github.com/prometheus/prometheus/releases/download/v2.8.1/prometheus-2.8.1.linux-amd64.tar.gz # Decompress the Prometheus installation package. tar -zxvf prometheus-2.8.1.linux-amd64.tar.gz -C /usr/local/ # Rename the folder in which the installation package is located. cd /usr/local mv prometheus-2.8.1.linux-amd64/ prometheus cd prometheus/ # Check the Prometheus version. ./prometheus --version # Modify the prometheus.yml configuration file based on your business requirements. If you want to only test the VPC management feature of Grafana, you can skip this step. # Start Prometheus. ./prometheus &
Access Prometheus by using the following endpoint:
http://[Public IP address of the ECS instance]:9090/graph
Query the
up
metric in Prometheus. If the following page is displayed, Prometheus is installed.NoteThe
up
metric ofjob="prometheus"
is a metric that Prometheus uses to monitor its performance.
Step 2: Manage VPC data channels
- Log on to the ARMS console. In the left-side navigation pane, choose .
On the Workspace Management page, click the ID of the workspace that you want to manage. In the left-side navigation pane of the page that appears, click VPC Data Source Channel Management.
On the VPC Data Source Channel Management page, click Install Data Source Channel. In the dialog box that appears, configure the Region, VPC, Name, vSwitch, and Security Group parameters, and then click Install.
After the data channel is installed, you can view the data channel on the VPC Data Source Channel Management page.
Step 3: Add a data source in Grafana
On the VPC Data Source Channel Management page, click Configure Data Source in the Actions column of a data source to go to the Configuration page of Grafana.
On the Data Sources tab, click Add data source and then click Prometheus.
NoteYou can select a data source type based on your business requirements.
On the Settings page, configure the parameters based on your business requirements.
Set the Network Type parameter to the VPC data channel that is created in Step 2. Specify the URL parameter in the
http://[Primary private IP address of the ECS instance]:9090
format. For information about the other parameters, see the Grafana documentation.NoteYou can view the primary private IP address of an ECS instance on the Instance Details page. For more information, see the ECS documentation.
Click Save & test.
If the
Data source is working
message appears, the Prometheus data source is added to Grafana.
Verify the result
After you add a VPC data source, you can check whether you can use the data source to configure monitoring metrics on the Explore page of Grafana.
In the left-side navigation pane of the Grafana console, click the icon.
Select the data source that you added in Step 3 from the drop-down list in the upper part of the Explore page.
In the Metrics section, enter
up
in the text box and click Run query.If the Prometheus monitoring panel that is displayed in Grafana is the same as the monitoring panel on the Prometheus page in Step 1, the Prometheus data source is connected.