Grafana is an open-source, nightly built dashboarding, analytics, and monitoring platform that is tinkered for connection with a variety of sources like Elasticsearch, Influxdb, Graphite, Prometheus, AWS Cloud Watch, and many others.

One of the biggest highlights of Grafana is the ability to bring several data sources together in one dashboard with adding rows that will host individual panels (each with visual type).

Among the other pros are:

Nice design of the visuals and interface;

Comfortable to work on several sources;

Easy to connect to the sources.

However, Grafana also has some cons:

It takes a bit of time to figure out where filters go and how to compose certain visuals;

Some of the stuff is abstracted away unnecessarily — there is no way to send raw queries to the data source from Grafana;

Plugin installation — default install has only a few visual types, and you will most likely end up installing plugins (even for pie chart). Grafana may have few problems during installing plugins, which are not easy to debug.

Installing Grafana on centos Linux and its sisters

First, add rpm repo:

Bash:

sudo cat > /etc/yum.repos.d/grafana.repo <<- repoconf [grafana] name=grafana baseurl=https://packagecloud.io/grafana/stable/el/6/$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 repoconf

Then, install using yum:

Bash:

sudo yum install grafana

Installing via repo adds system unit for running in daemon mode.

To run as daemon, do the following:

Bash:

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

If you want to enable auto-startup on the boot, run:

Bash:

sudo systemctl enable grafana-server.service

Configuration

All defaults for running are configured in environment variables in /etc/sysconfig/grafana-server:

GRAFANA_USER=grafana

GRAFANA_GROUP=grafana

GRAFANA_HOME=/usr/share/grafana

LOG_DIR=/var/log/grafana

DATA_DIR=/var/lib/grafana

MAX_OPEN_FILES=10000

CONF_DIR=/etc/grafana

CONF_FILE=/etc/grafana/grafana.ini

RESTART_ON_UPGRADE=true

PLUGINS_DIR=/var/lib/grafana/plugins

As to Grafana configurations, everything is listed (including defaults) in /etc/grafana/grafana.ini.

If you want to access Grafana from outside (not localhost only) set http_addr config to bind to all interfaces explicitly or leave it blank to do the same thing implicitly.

If Grafana is still inaccessible, make sure that the firewall does not block traffic on Grafana’s port.

To add a port to allowed, use:

Bash:

GRAFANA_USER=grafanafirewall-cmd — zone=public — add-port=3000/tcp — permanent firewall-cmd — reload

Then, check it in:

Bash:

iptables-save | grep 3000

Installing plugins

Installation of plugins may cause several troubles due to incompatibilities of Grafana versions. The most common problem is that the plugin is installed but not detected and thus not usable. To avoid such situation, it is better to follow the next steps to install a plugin.

First, make sure that `/var/lib/grafana/` folder is owned by Grafana user and has all permissions. If not, then run:

Bash:

sudo chown -R grafana /var/lib/grafana/ sudo chmod -R 700 /var/lib/grafana/

Stop Grafana:

Bash:

systemctl stop grafana-server

Make sure to clear cache in the browser, from which you access Grafana.

Then, install a plugin using the cli utility:

Bash:

grafana-cli plugins install

Check that your plugin installed successfully:

Bash:

grafana-cli plugins ls

After that, start Grafana up again:

Bash:

systemctl stop grafana-server

Check your installation in a browser.

Beginning to work

First, you will need to log in. By default, Grafana creates an admin user with admin password on startup (maybe changed in /etc/grafana/grafana.ini).