Reader small image

You're reading from  Building IoT Visualizations using Grafana

Product typeBook
Published inJul 2022
PublisherPackt
ISBN-139781803236124
Edition1st Edition
Right arrow
Author (1)
Rodrigo Juan Hernández
Rodrigo Juan Hernández
author image
Rodrigo Juan Hernández

Rodrigo Juan Hernández is an electronic engineer passionate about IoT even before it existed. He has been working on tech for more than 18 years until now. For several years he has been focusing on the IoT ecosystem. He is currently giving consultation about IoT systems to clients around the world. He also produces content online about IoT and related subjects and the content is available on his blog, Youtube channel, and social networks - mainly LinkedIn. He also writes for companies that need good quality content about their products and services. His main objective nowadays is helping others to understand and implement IoT solutions.
Read more about Rodrigo Juan Hernández

Right arrow

Initial configuration of Grafana

You can configure Grafana whether editing the grafana.ini file or by specifying environment variables.

In this section, you will learn how to do it both ways.

Configuration files

Grafana comes with a default configuration file that you should not edit: defaults.ini.

To override the settings in this file, you must edit grafana.ini. This file is located – in Linux systems – in the /etc/grafana/grafana.ini directory.

You can find the locations for different operating systems at https://grafana.com/docs/grafana/latest/administration/configuration/#config-file-locations.

All configuration options are shown here: https://grafana.com/docs/grafana/latest/administration/configuration/.

We will explore some basic options to start using Grafana. In later chapters, you will learn about some other specific configuration settings.

The app_mode variable accepts two options: development and production. The default option is production and you must keep it unless you are planning to do some development:

app_mode  production

In the date_formats section, you can set date and time formats used in graphs and date-time boxes. In this section, you will find several options.

full_date is used to show a full date format where it is applicable.

Here’s an example:

full_date YYYY-MM-DD HH:mm:s

interval options are used in the graph to show partial dates or times.

The default options are as follows:

interval_second = HH:mm:ss
interval_minute = HH:mm
interval_hour = MM/DD HH:mm
interval_day = MM/DD
interval_month = YYYY-MM
interval_year = YYYY

use_browser_locale allows us to use date formats derived from the browser location. It is set to false by default.

With default_timezone, you can set your own time zone, or set it to use the browser location. The default option is the browser.

In the security section, you can set the administration user and security-related options. Some of these options, such as admin username and password, can be edited from the web interface.

In the paths section, you can see the paths that Grafana is using in your system.

In a Linux system, these paths are as follows:

data       /var/lib/grafana
logs       /var/log/grafana
plugins          /var/lib/grafana/plugins
provisioning    /etc/grafana/provisioning

Important Note

If you are using Docker to deploy Grafana, these paths cannot be modified in the configuration file. Instead, you will have to use environment variables.

You have now learned to use the configuration file to modify the behavior of Grafana. You also have seen the paths to important Grafana files.

In the next section, you will learn how to configure Grafana using environment variables.

Environment variables

In the previous section, you learned how to use environment variables with Docker. Now, you will see how to do this in the Linux host.

You can override any option in the configuration file using environment variables.

The syntax is as follows:

GF_<SectionName>_<KeyName>

So, if you want to change the admin user, you must type the following in the console:

export GF_SECURITY_ADMIN_USER=newadminuser

The same applies to every other option.

Note

You will have to restart Grafana for any configuration change to take effect.

Until here, you have learned how to install Grafana on-premises using different deployment options.

In the next section, you will learn how to use the Grafana Cloud service to avoid the installation and management process.

Previous PageNext Page
You have been reading a chapter from
Building IoT Visualizations using Grafana
Published in: Jul 2022Publisher: PacktISBN-13: 9781803236124
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime

Author (1)

author image
Rodrigo Juan Hernández

Rodrigo Juan Hernández is an electronic engineer passionate about IoT even before it existed. He has been working on tech for more than 18 years until now. For several years he has been focusing on the IoT ecosystem. He is currently giving consultation about IoT systems to clients around the world. He also produces content online about IoT and related subjects and the content is available on his blog, Youtube channel, and social networks - mainly LinkedIn. He also writes for companies that need good quality content about their products and services. His main objective nowadays is helping others to understand and implement IoT solutions.
Read more about Rodrigo Juan Hernández