Getting started with Grafana for Ubuntu in Azure Cloud

Introduction

Grafana is an open-source tool you can use to visualize and analyze data. It's particularly well-suited for keeping track of how computer systems are performing. When building microservices or other types of applications you may need to analyze your log data, easily visualize it, or set up special alerts to be notified about some events happening in your system.

Here's why you may need Grafana

  1. Collects data: It can pull data from a variety of sources, including databases, cloud services, and monitoring tools. You can think about Grafana as a container of multiple data sources.
  2. Creates visualizations: It turns that data into graphs and charts, making it easier to spot trends and patterns.
  3. Allows for analysis: You can use Grafana to zoom in on specific data points and compare different metrics side-by-side.
  4. Sets up alerts: If something goes wrong, Grafana can send you notifications so you can take action.

Grafana helps you understand what's happening with your systems and data by turning raw numbers into clear and informative visuals.

How to install Grafana using Azure?

First things first, we have multiple options to install Grafana. You can install it directly to your computer for different OSs, or you can do it via Docker, or even better, you can use some cloud tools Like Aws, Azure, DigitalOcean, etc. to properly install Grafana to your cloud virtual machine.

In this tutorial, we’re going to install Grafana via Azure. First, go to portal.azure.com. Azure provides a free trial account to experiment and feel the beauty and power of Azure services. First, we need to create a virtual machine where we plan to install Grafana.

Here is what you need to do to run your Virtual Machine on Azure

  1. Go to portal.azure.com
  2. Create your free account, if you haven’t yet
  3. From the home segment, select “Virtual Machines” under Azure Services
  4. Click on the “Create” button in the middle and select “Azure Virtual Machine”
    No virtua machines
  5. You will be redirected to the Create a Virtual Machine - Microsoft Azure page where you need to fill in the inputs to create your virtual machine.
  6. To use your free account, select “free trial” for Subscription, and the “resource group” create a new one you haven’t specified any resource group yet
    Project details

Here is my instance information:

Instance details

You also need to provide size and administrator account information:

Administrator account information

Select SSH for authentication type and provide a “username” with the proper key pair name. You can click the “Next:disks” button but for now “Review+Create” will be enough for us. After validation passes successfully just hit the “Create” button.

A modal window will pop up with a suggestion to Download your private key and create a resource

Review and create

Then you need to wait a few seconds for Azure to prepare your resources.

Your deployment

Now we have a resource and also a private key in .pem format.

I use Putty to connect to our Azure resource using SSH. If you haven’t downloaded Putty yet, just go to Download Putty (0.81) for Windows, Linux and Mac - Install SSH in PuTTY (puttygen.com) and download it. We need the PuttyGen application also to convert our .pem key to the Putty understandable key.

Converting your key to the Putty key

To Connect to our Azure resource, we use Putty, but it requires a special key format, which is different than the .pem format. Open the PuttyGen application->Conversions-> Import key->find the key you have just downloaded, open it, select the “save private key” button, and save your key.

Connecting to Azure Resource

To connect to our Azure Resource(Ubuntu Virtual Machine) do the following:

  1. Open Putty
  2. In the Host name section type “your_azure_username”@your_public_ip_address. You can find your public IP address from the virtual machine section. For example, [email protected] and the port should remain 22
  3. Go to the SSH tab on the left of Putty select “Auth” and load your private key
    Select Auth
  4. Go back to “Session”, save it, and click open
    Go to back session

Before connecting, it would be better to check if a connection from your local machine is possible or not. Here is how you can check it

  1. Go to the Ubuntu virtual machine
  2. In the above, you have “Connect” ->” Connect”
  3. Select “native SSH” and wait for validation
    Switch local machine os

When clicking “Open” it should successfully connect to the Virtual machine. In case of any connection issuer, you can reset the SSH key or password.

After successfully connecting, you can run the following commands in the given order to install Grafana on your virtual machine

sudo apt-get install -y adduser libfontconfig1 musl
wget https://dl.grafana.com/enterprise/release/grafana-enterprise_11.0.0_amd64.deb
sudo dpkg -i grafana-enterprise_11.0.0_amd64.deb

After successful installation, we need to configure the firewall to allow us to connect to post number 3000. Here is how you can do it:

  1. Go to virtual machines
  2. Select your ubuntu
  3. Find networking settings
    Virtual machine

From the inbound port rule, create a rule to allow port 3000. You can find it below

Inbound port rule

Now open your browser, navigate to your_public_ip_address:3000, and hit enter. You should see Grafana’s login page and by typing “admin” for both login and password you can log in. For the second page, you can “Skip” or reset your password.

Home

Conclusion

There are multiple ways of installing Grafana. This article simply demonstrates how to install Grafana in Azure Cloud for Ubuntu OS.


Similar Articles