Session 4 Deep Dive Into Grafana

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 39

Session 4.

Deep Dive into Grafana


Ram N Sangwan
Agenda
• Graph
• Singlestat
• Gauge, Bargauge
• Dashboard list
• Heatmap
• Textpanel, Tablepanel
• Plugin panels, Manipulating panels
• Templating with variables
• Dynamic panels based on variables

2
Graph
• This visualization is the most-used in the Grafana ecosystem.
• It can render as a line, a path of dots, or a series of bars.
• This type of graph is versatile enough to display almost any time-series data.

3
Data and field options
• Graph visualizations allow you to apply:
• Data transformations
• Alerts - This is the only type of visualization that allows you to set alerts.
• Thresholds

4
Display options
• Bars - Display values as a bar chart.
• Lines - Display values as a line graph.
• Line width - The width of the line for a series. (default 1).
• Staircase - Draws adjacent points as staircase.
• Area fill - Amount of color fill for a series. (default 1, 0 is none)
• Fill gradient - Degree of gradient on the area fill. (0 is no gradient, 10 is a
steep gradient. Default is 0.)
• Points - Display points for values.
• Point radius - Controls how large the points are.
• Alert thresholds - Display alert thresholds and regions on the panel.

5
Stacking and null value
• Stack - Each series is stacked on top of another.
• Percent - Available when Stack is selected. Each series is drawn as a
percentage of the total of all series.
• Null value - How null values are displayed:
• connected - If there is a gap in the series, meaning a null value or values, then the line will
skip the gap and connect to the next non-null value.
• null - (default) If there is a gap in the series, meaning a null value, then the line in the
graph will be broken and show the gap.
• null as zero - If there is a gap in the series, meaning a null value, then it will be displayed
as a zero value in the graph panel.

6
Hover Tooltip
Use these settings to change the appearance of the tooltip that appears when
you hover your cursor over the graph visualization.
• Mode
• All series - The hover tooltip shows all series in the graph. Grafana highlights the series
that you are hovering over in bold in the series list in the tooltip.
• Single - The hover tooltip shows only a single series, the one that you are hovering over
on the graph.
• Sort order - Sorts the order of series in the hover tooltip if you have
selected All series mode. When you hover your cursor on a graph, Grafana
displays the values associated with the lines.

7
Series overrides
• Series overrides allow a series in a graph panel to be rendered differently from
the others.
• You can customize display options on a per-series bases or by using regex
rules.
• For example, one series can have a thicker line width to make it stand out or
be moved to the right Y-axis.

8
Singlestat Panel - Native Plugin
• The Singlestat Panel is included with Grafana.
• It allows you to show the one main summary stat of a SINGLE series.
• It reduces the series into a single number (by looking at the max, min,
average, or sum of values in the series).
• Singlestat also provides thresholds to color the stat or the Panel background.
• It can also translate the single number into a text value, and show a sparkline
summary of the series.
• The Stat panel shows a one large stat value with an optional graph sparkline.
You can control the background or value color using thresholds.

9
Gauge panel
• Gauge is a single value panel that can repeat a gauge for every series,
column or row.

10
Data and field options
• Gauge visualizations allow you to apply:
• Data transformations
• Field options and overrides
• Thresholds

11
Display options
• Show - Choose how Grafana displays your data.
• Calculate - Show a calculated Value based on all rows.
• All values - Show a separate stat for every row. If you select this option, then you can also
select a Limit, or the maximum number of rows to display.
• Orientation - Choose a stacking direction.
• Auto - Grafana selects what it thinks is the best orientation.
• Horizontal - Bars stretch horizontally, left to right.
• Vertical - Bars stretch vertically, top to bottom.
• Show threshold labels - Controls if threshold values are shown.
• Show threshold markers - Controls if a threshold band is shown outside the
inner gauge value band.

12
Bar Gauge panel
• The bar gauge simplifies your data by reducing every field to a single value.
You choose how Grafana calculates the reduction.
• This panel can show one or more bar gauges depending on how many series,
rows, or columns your query returns.

13
Data and Field options
• Bar gauge visualizations allow you to apply:
• Data transformations
• Field options and overrides
• Thresholds

14
Bar Gauge Display options
• Show - Choose how Grafana displays your data.
• Calculate - Show a calculated value based on all rows.
• All values - Show a separate stat for every row.
• Value - Select a reducer function that Grafana will use to reduce many fields to a single value. Click
the Value list to see functions and brief descriptions.
• Orientation - Choose a stacking direction.
• Auto - Grafana selects what it thinks is the best orientation.
• Horizontal - Bars stretch horizontally, left to right.
• Vertical - Bars stretch vertically, top to bottom.
• Display mode - Choose a display mode.
• Gradient - Threshold levels define a gradient.
• Retro LCD - The gauge is split into small cells that are lit or unlit.
• Basic - Single color based on the matching threshold.
• Show unfilled area - To render the unfilled region of the bars as dark gray. Not applicable to Retro LCD
display mode.

15
Dashboard list panel
• The dashboard list panel allows you to display dynamic links to other
dashboards.
• The list can be configured to use starred dashboards, recently viewed
dashboards, a search query, and dashboard tags.

16
Dashboard List Options
On each dashboard load, this panel queries the dashboard list, always
providing the most up-to-date results.
• Starred - Display starred dashboards in alphabetical order.
• Recently viewed - Display recently viewed dashboards in alphabetical order.
• Search - Display dashboards by search query or tags. Requires you to enter
at least one value in Query or Tags.
• Show headings - The chosen list selection (Starred, Recently viewed,
Search) is shown as a heading.
• Max items - Sets the maximum number of items to list per section.
For example, if you left this at the default value of 10 and displayed Starred and Recently
viewed dashboards, then the panel would display up to 20 total dashboards, ten in each
section.

17
Search
These options only apply if the Search option is selected.
• Query - Enter the query you want to search by. Queries are case-insensitive,
and partial values are accepted.
• Folder - Select the dashboard folders that you want to display.
• Tags - Here is where you enter your tags you want to search by. Note that
existing tags will not appear as you type, and they are case sensitive.

18
Heatmap
• The Heatmap panel visualization allows you to view histograms over time.

19
Axes Options - Y Axis
• Unit - The display unit for the Y axis value
• Scale - The scale to use for the Y axis value.
• linear - Linear scale.
• log (base 2) - Logarithmic scale with base 2.
• log (base 10) - Logarithmic scale with base 10.
• log (base 32) - Logarithmic scale with base 32.
• log (base 1024) - Logarithmic scale with base 1024.
• Y-Min - The minimum Y value (default auto).
• Y-Max - The maximum Y value (default auto).
• Decimals - Number of decimals to render Y axis values with (default auto).

20
Buckets
Note: If the data format is Time series buckets, then this section will not be
available.
• Y Axis Buckets - Number of buckets Y axis will be split into.
• Size - (Only visible if Scale is linear). Size of each Y axis bucket. This option
has priority over Y Axis Buckets.
• Split Factor - This option allows to split each default bucket into specified
number of buckets.
• X Axis Buckets - Number of buckets X axis will be split into.
• Size - Size of each X axis bucket. Number or time interval (10s, 5m, 1h, etc).
Supported intervals: ms, s, m, h, d, w, M, y. This option has priority over X
Axis Buckets.

21
Text panel
• The text panel lets you make information and description panels for your
dashboards.
• In Mode, select whether you want to use markdown or HTML to style your
text, then enter content in the box below.
• Grafana includes a title and paragraph to help you get started, or you can
paste content in from another editor.

22
Table panel
• The table panel is very flexible, supporting multiple modes for time series and
for tables, annotation, and raw JSON data.
• This panel also provides date formatting, value formatting, and coloring
options.

23
Table Panel

24
Data and field options
• Table visualizations allow you to apply:
• Data transformations
• Field options and overrides
• Thresholds

25
Table Panel - Display Options
• Show header - Show or hide column names imported from your data source.
• Field display options
• In the Field tab you can set table specific display options that will affect all columns.
• Column width
• Column alignment
• Cell display mode
• Column alignment
• This custom field option applies only to table visualizations.
• Choose how Grafana should align cell contents:
• Auto (default)
• Left
• Center
• Right

26
Templates and Variables
• A variable is a placeholder for a value.
• You can use variables in metric queries and in panel titles.
• So when you change the value, using the drop-down list at the top of the
dashboard, your panel’s metric queries will change to reflect the new value.
• Variables allow you to create more interactive and dynamic dashboards.
• Variables are displayed as drop-down lists at the top of the dashboard.
• These drop-downs make it easy to change the data being displayed in your
dashboard.

27
Templates and Variables
• These can be especially useful for administrators who want to allow Grafana
viewers to quickly adjust visualizations but do not want to give them full editing
permissions.
• Grafana Viewers can use variables.
• Variables and templates also allow you to single-source dashboards.
• If you have multiple identical data sources or servers, you can make one
dashboard and use variables to change what you are viewing.
• This simplifies maintenance and upkeep enormously.

28
Templates
A template is any query that contains a variable.
• For example, if you were administering a dashboard to monitor several
servers, you could make a dashboard for each server.
• Or you could create one dashboard and use panels with template queries like
this one:
wmi_system_threads{instance=~"$server"}
• Variable values are always synced to the URL using the syntax var-
<varname>=value.

29
Examples of Templates and Variables
• Variables are listed in drop-down lists across the top of the screen.
• Select different variables to see how the visualizations change.
• To see variable settings, navigate to Dashboard Settings > Variables.
• Click a variable in the list to see its settings.
• Variables can be used in titles, descriptions, text panels, and queries.
• Queries with text that starts with $ are templates.
• Not all panels will have template queries.

30
Variable Syntax
Panel titles and metric queries can refer to variables using two different
syntaxes:
• $varname : Easy to read, but it does not allow you to use a variable in the
middle of a word. Example: apps.frontend.$server.requests.count
• ${var_name} Use this syntax when you want to interpolate a variable in the middle of an expression.

• ${var_name:<format>} This format gives you more control over how Grafana
interpolates values.

31
Variables and Interpolation
• Before queries are sent to your data source the query is interpolated,
meaning the variable is replaced with its current value.
• During interpolation, the variable value might be escaped in order to conform
to the syntax of the query language and where it is used.
• For example, a variable used in a regex expression in an InfluxDB or
Prometheus query will be regex escaped.

32
Variable types
Variable type Description
Query-generated list of values such as metric names, server names, sensor IDs, data centers,
Query
and so on. Add a query variable.

Custom Define the variable options manually using a comma-separated list. Add a custom variable.

Text box Display a free text input field with an optional default value. Add a text box variable.
Constant Define a hidden constant. Add a constant variable.
Data source Quickly change the data source for an entire dashboard. Add a data source variable.
Interval Interval variables represent time spans. Add an interval variable.
Key/value filters that are automatically added to all metric queries for a data source (InfluxDB,
Ad hoc filters
Prometheus, and Elasticsearch only). Add ad hoc filters.

Global variables Built-in variables that can be used in expressions in the query editor. Refer to Global variables.

Chained variables Variable queries can contain other variables. Refer to Chained variables.

33
Variable Examples
• Elasticsearch Metrics - Uses ad hoc filters, global variables, and a custom
variable.
• InfluxDB Server Monitoring - Uses query variables, chained query variables,
an interval variable, and an ad hoc filter.
• Prometheus templating - Uses chained query variables.
• Template Redux - Uses query variables, chained query variables, ad hoc
filters, an interval variable, a text box variable, a custom variable, and a data
source variable.
• Templating, repeated panels - Two sets of repeated panels use query
variables.
• Templating showcase - Uses custom, query, chained query, and data source
variables.
• Templating value groups - Uses query variable with value groups.

34
Plugins
• Besides the wide range of visualizations and data sources that are available
immediately after you install Grafana, you can extend your Grafana
experience with plugins.
• You can install one of the plugins built by the Grafana community, or build one
yourself.
• Grafana supports three types of plugins: panels, data sources, and apps.

35
Panel plugins
• Add new visualizations to your dashboard with panel plugins, such as the
Worldmap Panel, Clock, and Pie Chart.
• Use panel plugins when you want to:
• Visualize data returned by data source queries.
• Navigate between dashboards.
• Control external systems, such as smart home devices.

36
Data Source Plugins
• Data source plugins add support for new databases, such as Google
BigQuery.
• Data source plugins communicate with external sources of data and return the
data in a format that Grafana understands.
• By adding a data source plugin, you can immediately use the data in any of
your existing dashboards.
• Use data source plugins when you want to import data from external systems.

37
App plugins
• Applications, or app plugins, bundle data sources and panels to provide a
cohesive experience, such as the Zabbix and Kubernetes apps.
• Apps can also add custom pages for things like control panels.
• Use app plugins when you want to create an custom out-of-the-box monitoring
experience.

38
Thank You

39

You might also like