Configure Grafana to visualize metrics emitted from the managed instance cluster
When you deploy an Azure Managed Instance for Apache Cassandra cluster, the service provisions a server that hosts Prometheus which can be consumed by various client tools. Prometheus is an open-source monitoring solution. The managed instance will emit metrics and retains 10 minutes or 10 GB of data (whichever threshold reaches first). This article describes how to configure Grafana to visualize metrics emitted from the managed instance cluster. The following tasks are required to visualize metrics:
- Deploy a Ubuntu Virtual Machine inside the Azure Virtual Network where the managed instance is present.
- Install the open-source Grafana tool to build dashboards and visualize metrics emitted from Prometheus.
Deploy a Ubuntu server
Sign in to the Azure portal.
Navigate to the resource group where your managed instance cluster is located. Select Add and search for Ubuntu Server 18.04 LTS image:
Pick the image and select Create.
In the Create a virtual machine blade, enter values for the following fields, you can leave default values for other fields:
- Virtual machine name - Enter a name for you VM.
- Region - Select the same region where your Virtual Network has been deployed.
In the Networking tab, select the Virtual Network in which your managed instance is deployed:
Finally select Review + Create to create your Grafana server.
From the Azure portal, open the Virtual Network where you deployed the managed instance and the Grafana Server. You should see a virtual machine scale set instance named cassandra-jump (instance 0). This Prometheus metrics are hosted in this virtual machine scale set. Make a note of the IP address of this instance:
Connect to your newly created Ubuntu server by using Azure CLI or your preferred client tool to connect via SSH.
After connecting to the VM, you have to install and configure Grafana to connect to the virtual machine scale set where the metrics are hosted. Open a command prompt and enter the
nanocommand to open a Nano text editor. Paste the following script into the text editor, make sure to replace the
<prometheus IP address>with the IP address you recorded in the previous step:
#!/bin/bash echo "Installing Grafana..." if ! $SSH dpkg -s grafana prometheus > /dev/null; then echo "Installing packages." echo 'deb https://packages.grafana.com/oss/deb stable main' | $SSH sudo tee /etc/apt/sources.list.d/grafana.list > /dev/null curl https://packages.grafana.com/gpg.key | $SSH sudo apt-key add - $SSH sudo apt-get update $SSH sudo apt-get install -y grafana prometheus else echo "Skipping package installation" fi echo "Configuring grafana" cat <<EOF | $SSH sudo tee /etc/grafana/provisioning/datasources/prometheus.yml apiVersion: 1 datasources: - name: Prometheus type: prometheus url: https://<prometheus IP address>:9443 jsonData: tlsSkipVerify: true EOF echo "Restarting Grafana" $SSH sudo systemctl enable grafana-server $SSH sudo systemctl restart grafana-server echo "Installing Grafana plugins" $SSH sudo grafana-cli plugins install natel-discrete-panel $SSH sudo grafana-cli plugins install grafana-polystat-panel $SSH sudo systemctl restart grafana-server
ctrl + Xto save the file. You can name the file
./grafana.shcommand in the command prompt to install Grafana.
After installation is complete, Grafana will be available at port 3000 in the server's IP address as shown in the following screenshot:
You can choose from open-source dashboards created for Apache Cassandra in Grafana such as the cluster-overview JSON file. Download and import the dashboard's JSON definition into Grafana:
You can then monitor your cassandra managed instance cluster with the chosen dashboard:
In this article, you learned how to configure dashboards to visualize metrics in Prometheus using Grafana. Learn more about Azure Managed Instance for Apache Cassandra with the following articles: