Setting up 24*7 monitoring dashboards using Grafana
Here in this blog, you’ll get to know how to install Grafana on Ubuntu and CentOS. Before installing Grafana let’s know some facts about this amazing visualization tool. Here are few things you need to know about Grafana before installing it.
- Grafana is just a visualization tool. It doesn’t store any kind of data
- You can connect various datasources like Prometheus, InfluxDB, Elacsticsearch and traditional relational database engines.
- You can create complex and informational dashboards using Grafana
- Grafana has a wide range of visualization components like various graphs, heat maps and histograms.
- Best part is you can use Grafana to trigger notifications and email alerts for certain threshold.
System Requirements:
- Ubuntu Server 16.04 or CentOS 7.
- Root privileges
System check done, Now it’s time to install Grafana on ubuntu.
Installing Grafana on ubuntu:
- First and forward update and install pre-requisite packages
sudo apt-get install -y apt-transport-httpssudo apt-get install -y software-properties-common wgetwget -q -O — https://packages.grafana.com/gpg.key | sudo apt-key add
2. Add Stable grafana apt repo by using below command
echo “deb https://packages.grafana.com/enterprise/deb stable main” | sudo tee -a /etc/apt/sources.list.d/grafana.list
3. After adding apt repos we need to update and install grafana below are the commands to update repos and install grafana
sudo apt-get updatesudo apt-get install grafana-enterprise
Note: Grafana Enterprise is the recommended and default edition. It is available for free and includes all the features of the OSS Edition. You can also upgrade to the full Enterprise feature set and has support for Enterprise plugins.
4. Start the grafana service by running below commands
sudo systemctl daemon-reloadsudo systemctl start grafana-server
Verify grafana is running or not by using below command
sudo systemctl status grafana-server
Step 5: Enable grafana to run at boot time by using below command
sudo systemctl enable grafana-server.service
And We are done installing Grafana on Ubuntu, If you’re using CentOS the below process is for you. If you’re using Ubuntu you’ve already installed Grafana, So head down to connect a datasource(Promotheus) to visualize the data.
Steps for Installing Grafana- on centOS
Step 1: Create a repo file and add content
Create a repo file by using vim
vim /etc/yum.repos.d/grafana.repo
Add the following contents to file:
[grafana]name=grafanabaseurl=https://packages.grafana.com/oss/rpmrepo_gpgcheck=1enabled=1gpgcheck=1gpgkey=https://packages.grafana.com/gpg.keysslverify=1sslcacert=/etc/pki/tls/certs/ca-bundle.crt
Step 2: Install Grafana
Enter the following command to install grafana
sudo yum install grafana
Step 3: Enable Grafana Service
Check the status of the service.
systemctl status grafana-server
If service is not active, start it using the following command:
systemctl start grafana-server
Enable Grafana service on system boot
systemctl enable grafana-server.service
- Access the Grafana Dashboard using http://IP_ADDRESS:3000/login
- The default login Username: Password for accessing the Grafana dashboard is admin: admin
- Change the default admin password after the login.
We have done installing Grafana on Ubuntu and CentOS. Now it’s time to connect a datasource to visualize. If you haven’t installed prometheus and looking to install here’s our guide to do that.
Create a Prometheus Datasource inside Grafana Dashboard
- Goto your Grafana Dashboard and click on Gear(Settings Icon)->Data Sources
2. Click on add Data Source
Add datasource in grafana
3.Select the Prometheus as preferred data source
4. Enter the hostname or IP address of the prometheus server
5. Save and test data source
We are done setting up a datasource as promotheus. It’s time to visualize the data using some inbuilt dashboard templates.
- Now after settings the data source we can import pre-existing opensource dashboard from Grafana Labs using the Dashboard ID.
- Goto Grafana Dashboard and search for your Dashboard Exapmle kubernetes cluster
dashboard templates
2. Select appropriate board and copy the id of dashboard
copyID for dashboard
3. Go to you grafana url Click on + button and select import
Import data to grafana from promotheus
4. Pass you Dashboard and click on load
5. Click load and then select the data source as Prometheus
6. Finally Click on Import
7. You should be able to see the Kubernetes dashboard
If you have some patience and need grafana labs have many such prebuilt dashboard templates give them a try. If you’re looking for such services for your application. Reach out to fourninecloud.com . For more such intresting and insightful stories do follow us on medium.