Grafana – An Open Source Software for Analytics and Monitoring

Grafana is an open source, feature rich, powerful, elegant and highly-extensible analytics and monitoring software that runs on Linux, Windows and MacOS. It is a de facto software for data analytics, being used at Stack Overflow, eBay, PayPal, Uber and Digital Ocean – just to mention but a few.

It supports 30+ open source as well as commercial databases/data sources including MySQL, PostgreSQL, Graphite, Elasticsearch, OpenTSDB, Prometheus and InfluxDB. It allows you to dig deeply into large volumes of real-time, operational data; visualize, query, set alerts and get insights from your metrics from different storage locations.

Read Also: How to Install Piwik (Google Analytics) Software in Linux

Importantly, Grafana allows for setting up multiple, independent organizations with each having their own usage environment (admins, data sources, dashboards and users).

Grafana Analytics Monitoring Software
Grafana Analytics Monitoring Software

Grafana Features:

  • Elegant graphics for data visualization.
  • Fast and flexible graphs with numerous options.
  • Dynamic and reusable dashboards.
  • It’s highly extensible using hundreds of dashboards and plugins in the official library.
  • Supports power user preferences.
  • Supports multi tenancy, setup multiple independent organizations.
  • Supports authentication via LDAP, Google Auth, Grafana.com, and Github.
  • Supports notifications via Slack, PagerDuty, and more.
  • Remarkably supports collaboration by allowing sharing of data and dashboards across teams and so much more.

An online demo is available for you to try before installing Grafana on your Linux distribution.

Demo URL: http://play.grafana.org/

In this article, we will explain how to install Grafana – Data Visualization & Monitoring software on CentOS, Debian and Ubuntu distributions.

Install Grafana in Linux Systems

1. We will install Grafana from its official YUM or APT repositories, so that you can update it using your default package manager.

Install Grafana on Debian and Ubuntu

$ echo "deb https://packagecloud.io/grafana/stable/debian/ stretch main" | sudo tee -a /etc/apt/sources.list
$ curl https://packagecloud.io/gpg.key | sudo apt-key add -
$ sudo apt-get update
$ sudo apt-get install grafana

Install Grafana on CentOS, RHEL and Fedora

# echo "[grafana]
name=grafana
baseurl=https://packagecloud.io/grafana/stable/el/7/$basearch
repo_gpgcheck=1
enabled=1
gpgcheck=1
gpgkey=https://packagecloud.io/gpg.key https://grafanarel.s3.amazonaws.com/RPM-GPG-KEY-grafana
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt" | sudo tee /etc/yum.repos.d/grafana.repo

# yum install grafana

2. After installing Grafana, you can find important files in the following locations:

  • Installs binary to /usr/sbin/grafana-server
  • Installs Init.d script to /etc/init.d/grafana-server
  • Creates default file (environment vars) to /etc/default/grafana-server
  • Installs configuration file to /etc/grafana/grafana.ini
  • Installs systemd service name grafana-server.service
  • The default configuration sets the log file at /var/log/grafana/grafana.log
  • The default configuration specifies an sqlite3 db at /var/lib/grafana/grafana.db
  • Installs HTML/JS/CSS and other Grafana files at /usr/share/grafana

3. Next, start the Grafana service, check if it is up and running, then enable it to auto-start at boot time as follows. By default, the process is run as the grafana user (created during the installation process), and listens on HTTP port 3000.

Start Grafana Server (via Systemd)

# systemctl daemon-reload
# systemctl start grafana-server
# systemctl status grafana-server
# systemctl enable grafana-server

Start Grafana Server (via init.d)

# service grafana-server start
# service grafana-server status
# sudo update-rc.d grafana-server defaults  [On Debian/Ubuntu]
# /sbin/chkconfig --add grafana-server      [On CentOS/RHEL/Fedora]

4. If your system has a firewall enabled by default, you need to open the port 3000 in the firewall to allow client requests to the grafana process.

-----------  [On Debian/Ubuntu] -----------
$ sudo ufw allow 3000/tcp
$ sudo ufw reload

-----------  [On CentOS/RHEL/Fedora] -----------  
# firewall-cmd --permanent --add-port=3000/tcp
# firewall-cmd --reload

5. Now use the following URL to access the Grafana, which will redirect to the login page, user credentials as username: admin and password: admin)

http://Your-Domain.com:3000
OR
http://IP-Address:3000
Grafana Admin Login
Grafana Admin Login

6. After login, you will access the home dashboard, as shown in the screenshot below.

Grafana Home Dashboard
Grafana Home Dashboard

7. Next, add a database or data source, click on “Add Data Source”. For example we will add a MySQL database; specify the data source name, type, and connection parameters. Then click on Save & Test.

Add Grafana Data Source
Add Grafana Data Source

You will be notified if the database connection is successful or it has failed, as shown in the screenshot. Then go back to the home dashboard to add a new dashboard.

Grafana Data Source Connection
Grafana Data Source Connection

8. From the Home dashboard, click on New dashboard to add a new panel for visualizing metrics from your data source.

Add Grafana New Dashboard
Add Grafana New Dashboard

From here, you can add more data sources, dashboards, invite your team members, install apps and plugins to extend the default functionalities, and do more.

You can find more information from the Grafana Homepage: https://grafana.com/

Grafana is an elegant software for real-time data analytics and monitoring. We hope that you successfully installed Grafana on your Linux system, otherwise, use the feedback form below to ask any questions or share your thoughts about it.

Hey TecMint readers,

Exciting news! Every month, our top blog commenters will have the chance to win fantastic rewards, like free Linux eBooks such as RHCE, RHCSA, LFCS, Learn Linux, and Awk, each worth $20!

Learn more about the contest and stand a chance to win by sharing your thoughts below!

Aaron Kili
Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.