- Learn Grafana 7.0
- Eric Salituro
- 2540字
- 2021-06-18 18:33:24
Learning to use the icons on Grafana's left sidebar
To the left of the dashboard itself is the left sidebar. These icons lead to some of the most powerful of Grafana's impressive features. For example, they enable you to do the following:
- Search for dashboards
- Create and import dashboards and folders
- Find dashboards
- Manage dashboards, dashboard playlists, and dashboard snapshots
- Explore data sources in a free-form fashion
- Manage alert rules and notification channels
- Configure data sources, users, and teams, download plugins, set preferences, and generate API keys
- Administer Grafana users and organizations and view the server settings and stats
- Return to the Home dashboard
- Set personal preferences
- Get help
Let's have a closer look at some of these features.
The Grafana logo
At the top-left corner of the sidebar, you'll find the Grafana logo:
The Grafana logo serves as the home button for the application. Clicking on the Grafana logo will take you to the Home dashboard, which can be set in the preferences.
Search
Selecting the search button has the same effect as the dashboard button mentioned earlier. It takes you to the dashboard search page. From here, you can do the following:
- Search for dashboards by name
- Filter the list of dashboards by tags
The display features a list of recent dashboards, as well as the content of the top-level (General) dashboard folder:
Create
The Create dropdown is indicated by the plus icon:
It functions as a link for quickly creating or importing dashboards and dashboard folders.
Dashboard
The Dashboard selection under the Create menu creates a brand new dashboard, containing a single panel to help get you started. While we're here, let's create a dashboard and see what happens! Click on Create | Dashboard; you should see a panel with two buttons:
The Add new panel button sets up a Graph panel and takes you directly to the Query pane, while Convert to row (obviously) converts the placeholder panel to a dashboard row. Rows are a powerful structure for dynamically building a dashboard page. Assign a special template variable to a row and Grafana will replicate appropriately configured panels on that row, each one reflecting the value of the template variable. We'll be taking a closer look at both rows and template variables in Chapter 8, Working with Advanced Dashboard Features.
Click on Add new panel to create a new graph panel. You'll be in Edit mode for the panel, so to get back to the dashboard, click on the big left arrow at the top left. You should now see a simple graph of some random data:
That was pretty easy, right?
You'll also notice some extra icons at the top right compared to the ones we saw earlier on the Home dashboard:
The following are the functions of these icons:
- Adds new panels to the dashboard
- Saves the dashboard
- Dashboard settings
- Cycles the view mode
- Sets the time range for the graph
- Zooms out the time range
- Refreshes the dashboard and sets the dashboard refresh rate
You'll typically find the last three controls anytime you have a time series-based panel on your dashboard. We will go into more detail about the Graph panel in Chapter 3, An Introduction to the Graph Panel. Feel free to experiment with dashboard creation. Create a new dashboard and populate it with any number of panels. Until you hook up a data source, you'll be somewhat limited to what you'll be able to display. If you accidentally delete your panel or convert it into a row, you can always create a new one with the Add Panel button.
Folder
The Create | Folder selection of the dropdown is a handy way to quickly create a folder so that you can group dashboards and keep things manageable. You'll find that once you've created a handful of dashboards, keeping up with them on the Dashboard drop-down page can get pretty cumbersome.
Import
Finally, the Create | Import selection will launch the Import interface. From here, you can import a dashboard stored at https://grafana.com/ or import a previously exported dashboard JSON file. This is one of the easiest ways to share a dashboard as JSON in a text file format, so you can evensend it in an email message.
Dashboards
The Dashboards dropdown is indicated by the paneled square icon:
Each selection functions as a link to a tab in the Dashboards management page, while the Dashboards | Homeselection leads to the Home dashboard.
Manage
Each selection in the Dashboards dropdown is simply a link to a tab on the Dashboards management page. The Dashboards| Manage selection leads to the Manage tab on the Dashboards page. The Manage tab is where dashboards can quickly be created and organized. Like the Create dropdown, the Manage tab provides the ability to create or import a dashboard or to create a dashboard folder. Similar to the dashboard dropdown, you can use the search box to find dashboards by name:
New Dashboard will create a new dashboard with a panel wizard, while New Folder and Import, like Create | New Folder and Create | Import, will execute their functions on the Manage tab.
Playlists
The Dashboards | Playlistsselection takes us to the Playlists tab, where you can create groupings of dashboards orchestrated to run in a particular sequence and timing:
Typically, you use playlists when you want to set up an automated Grafana-driven kiosk-type display. Setting up a playlist such as this in Grafana is easy:
- Click on Create Playlist.
- Name your playlist.
- Set the interval timing between playlists.
- Add dashboards to the list.
- Click Create.
Snapshots
The Snapshots tab, also accessed via the Dashboards | Snapshots selection, allows you to capture the state of a dashboard in what are called snapshots:
This displays your data sets, but without any way to access the original data sources and queries. Snapshots are a great way to share a live dashboard in scenarios where you need to demo your dashboards offline or can't share access to your data sources.
We'll be taking a closer look at the features of the Management page in Chapter 8, Working with Advanced Dashboard Features, and Chapter 11, Organizing Dashboards.
Explore
Explore is one of Grafana's most exciting features; it is a kind of data-driven scratchpad for exploring a data source prior to implementing it on a dashboard graph. It is integrated with Loki, Grafana's new system for ad hoc data exploration.
If you've ever worked with a dashboard-driven tool such as Grafana, you might have started with a dashboard, loaded up a graph panel, fed it the data, and then messaged queries or time frames looking for patterns. What if you could dispense with the overhead of building and configuring dashboard panels and go straight to the analysis? That is what Explore mode is for:
Explore gives you a fullscreen panel, so you can then immediately start exploring your data without concerning yourself with the panel or its appearance on a dashboard. With Loki, Explore takes things a step further. By integrating logging with your metrics, you can correlate metric indicators with significant logged events. If you've tried to troubleshoot a problem by repeatedly flipping back and forth between your graphs and logs, imagine working with them on the same interface!
We'll explore Explore and Loki in much more depth in Chapter 10, Exploring Logs With Grafana's Loki.
Alerting
A must-have for any time series-based data visualization application is Alerting:
Like the Dashboards dropdown, the Alerting dropdown is a set of links to tabs on the Alerting page.
Alert Rules
Alerting rules are the data thresholds that activate an alert. From this tab, you can manage the alerts created in various dashboard panels. Once an alert is triggered, you'll need some form of notification so that you can be made aware of the alert. The process of connecting an alert rule to some form of notification is easy:
- Establish one or more alerts on your dashboard panel.
- Configure a notification channel to be activated on an appropriate alert state.
- Set the alert to use one or more notification channels.
Notification channels
Notifications are stored in the next tab under the Notification channels tab. A notification channel can be as simple as an email address or as complex as an integration plugin, such as PagerDuty. Currently, there are nearly 20 notification integrations that support Grafana, and that number is constantly growing.
We'll look at how to set up alerting rules and to hook them up to notification channels in Chapter 9, Grafana Alerting.
Configuration
The Configurationpage is Grafana's administrative command center. While you can certainly use Grafana as an application solely for yourself, it is also designed to work as a full-featured data visualization server that supports hundreds of users. From the Configuration page, you can do this and more. Similar to the previous dropdowns, each Configuration dropdown links to a corresponding tab on the Configuration page.
Data Sources
The primary tab on the Configuration page is Data Sources, and for good reason. Setting up the data sources that back your graphs will most likely be your primary administrative function within Grafana. From this tab, you can create any number of data sources from the available data source plugins:
To set up a data source, typically, you will need to know a few things: the data source's server IP address and port, the correct authentication credentials to access it, and the name of the database on the server itself. There is one data source you can create that has no setup as it is an internal plugin to Grafana. The Test DB data source is a dummy data source that mimics the characteristics of a time-series database with random data. We will use the Test DB data source in the next chapter in order to get familiar with the Grafana panel before integrating it with a real data source.
We will take a detailed look at Data Sources in Chapter 4, Connecting Grafana to a Data Source.
Users
Selecting Configuration | Users takes you to the Users tab, where you can invite new users, set access levels for existing ones, or simply delete users entirely.
In the following example, clicking on theInvitebutton opens up a new user page where you can enter a new user's email address and an optional name. Click on the Invite button to add the new user with a role set in the dropdown. If theSend Invite Emailtoggle is enabled, an invitation will then go out to the user's email address:
Teams
Next to the Users tab is the Teams tab, accessed via Configuration | Teams. The Teams concept is relatively new to Grafana and is primarily used to establish UI settings for an entire group of users. Simply create a new team, then add users to the team. Default UI settings can then be established for all members of the team. A team can have its own Home dashboard, UI theme, or timezone setting. This feature is useful if you are managing Grafana for an organization of groups that each want their users to have a tailored Grafana experience.
More information on Users and Teams management will be covered in Chapter 12, Managing Permissions for Users and Teams.
Plugins
The Plugins page is an information page listing all the installed data sources and panel plugins. It also features a link to the plugins catalog on https://grafana.com/ where you can download and install more plugins:
Preferences
Preferences sets the global interface parameters for an organization. Notably, here is where the home dashboard is set. In order to be eligible for designation as the home dashboard, a dashboard must be starred. Besides the home dashboard, here is where the UI style (light or dark mode) and timezone are also set:
Organizations are Grafana's mechanism for supporting multiple independent Grafana sites from a single server. Each organization is completely independent of the others and has its own Configuration, Data Sources, Users, and Teams settings. While organizations are created and managed from the Server Admin page, the preferences for the current organization are set here. To set the preferences for another organization, you'll need to switch to that organization (see the following User button):
API Keys
Finally,API Keysis used by administrators on behalf of developers creating software applications that interact with Grafana using its REST API. An API key is a token used to authenticate an application bearing an issued key. An application bearing an API key will have access to all of Grafana, so you will need to be careful to create your API keys with the minimum necessary access and distribute them only to trusted developers.
Server Admin
The last of the middle set of sidebar icons is the Server Admin shield icon:
The Server Admin dropdown links to the Server Admin page and its tabs. The Server Admin pages are where you perform the more globally scoped administration tasks for your Grafana server. Here, you can add users and organizations and view the current server settings and statistics.
Users
The Users tab under Server Admin is similar to the Users tab under Configuration; however, in the Server Admin context, you have a great deal more control. Not only can you set up a new user, but you can also change the user's password, add them to various organizations, and even log them out of Grafana entirely. It's a pretty important page:
Here's a quick summary of the different sections under the Users tab:
- Edit User: Set a user's name, email, and username
- Change Password: Change a user's password
- Permissions: Enable admin permissions
- Organizations: Add users to organizations with specified roles
- Sessions: Review user logins and log out users
- User Stats: Enable/disable a user or delete a user
Orgs
As we discussed in the section on Configuration | Preferences, organizations are useful for creating entirely separate Grafana sites on one server. Go to the Orgs tab to add or delete an organization.
Creating or deleting an organization is simple (as shown):
- Clicking on the New orgbutton will take you to a page where you can set the name of a new organization.
- Click on the red × button to delete an organization:
Once you create an organization, however, you will need to populate it with users before anyone can access it. For now, we will work solely within the default organization created for you when you installed Grafana; however, if you wish to find out more, Chapter 12, Managing Permissions for Users and Teams, will cover user and organization management in more detail.
Settings
Server Admin | Settings displays the current settings for the Grafana server configuration as stored in the grafana.ini file. It is beyond the scope of this book to discuss configuring the Grafana server via grafana.ini. If you want to learn more about how to configure the Grafana server, check out the documentation at https://grafana.com/docs/installation/configuration.
Stats
If you want to get an idea of how many resources from users to dashboards to alerts have been created on your server, select the Stats tab on the Server Admin page for a list of potentially interesting statistics.