0
0
Fork 0
mirror of https://github.com/netdata/netdata.git synced 2025-04-09 15:47:53 +00:00
netdata_netdata/web
Costa Tsaousis cb7af25c09
RRD structures managed by dictionaries ()
* rrdset - in progress

* rrdset optimal constructor; rrdset conflict

* rrdset final touches

* re-organization of rrdset object members

* prevent use-after-free

* dictionary dfe supports also counting of iterations

* rrddim managed by dictionary

* rrd.h cleanup

* DICTIONARY_ITEM now is referencing actual dictionary items in the code

* removed rrdset linked list

* Revert "removed rrdset linked list"

This reverts commit 690d6a588b4b99619c2c5e10f84e8f868ae6def5.

* removed rrdset linked list

* added comments

* Switch chart uuid to static allocation in rrdset
Remove unused functions

* rrdset_archive() and friends...

* always create rrdfamily

* enable ml_free_dimension

* rrddim_foreach done with dfe

* most custom rrddim loops replaced with rrddim_foreach

* removed accesses to rrddim->dimensions

* removed locks that are no longer needed

* rrdsetvar is now managed by the dictionary

* set rrdset is rrdsetvar, fixes https://github.com/netdata/netdata/pull/13646#issuecomment-1242574853

* conflict callback of rrdsetvar now properly checks if it has to reset the variable

* dictionary registered callbacks accept as first parameter the DICTIONARY_ITEM

* dictionary dfe now uses internal counter to report; avoided excess variables defined with dfe

* dictionary walkthrough callbacks get dictionary acquired items

* dictionary reference counters that can be dupped from zero

* added advanced functions for get and del

* rrdvar managed by dictionaries

* thread safety for rrdsetvar

* faster rrdvar initialization

* rrdvar string lengths should match in all add, del, get functions

* rrdvar internals hidden from the rest of the world

* rrdvar is now acquired throughout netdata

* hide the internal structures of rrdsetvar

* rrdsetvar is now acquired through out netdata

* rrddimvar managed by dictionary; rrddimvar linked list removed; rrddimvar structures hidden from the rest of netdata

* better error handling

* dont create variables if not initialized for health

* dont create variables if not initialized for health again

* rrdfamily is now managed by dictionaries; references of it are acquired dictionary items

* type checking on acquired objects

* rrdcalc renaming of functions

* type checking for rrdfamily_acquired

* rrdcalc managed by dictionaries

* rrdcalc double free fix

* host rrdvars is always needed

* attempt to fix deadlock 1

* attempt to fix deadlock 2

* Remove unused variable

* attempt to fix deadlock 3

* snprintfz

* rrdcalc index in rrdset fix

* Stop storing active charts and computing chart hashes

* Remove store active chart function

* Remove compute chart hash function

* Remove sql_store_chart_hash function

* Remove store_active_dimension function

* dictionary delayed destruction

* formatting and cleanup

* zero dictionary base on rrdsetvar

* added internal error to log delayed destructions of dictionaries

* typo in rrddimvar

* added debugging info to dictionary

* debug info

* fix for rrdcalc keys being empty

* remove forgotten unlock

* remove deadlock

* Switch to metadata version 5 and drop
  chart_hash
  chart_hash_map
  chart_active
  dimension_active
  v_chart_hash

* SQL cosmetic changes

* do not busy wait while destroying a referenced dictionary

* remove deadlock

* code cleanup; re-organization;

* fast cleanup and flushing of dictionaries

* number formatting fixes

* do not delete configured alerts when archiving a chart

* rrddim obsolete linked list management outside dictionaries

* removed duplicate contexts call

* fix crash when rrdfamily is not initialized

* dont keep rrddimvar referenced

* properly cleanup rrdvar

* removed some locks

* Do not attempt to cleanup chart_hash / chart_hash_map

* rrdcalctemplate managed by dictionary

* register callbacks on the right dictionary

* removed some more locks

* rrdcalc secondary index replaced with linked-list; rrdcalc labels updates are now executed by health thread

* when looking up for an alarm look using both chart id and chart name

* host initialization a bit more modular

* init rrdlabels on host update

* preparation for dictionary views

* improved comment

* unused variables without internal checks

* service threads isolation and worker info

* more worker info in service thread

* thread cancelability debugging with internal checks

* strings data races addressed; fixes https://github.com/netdata/netdata/issues/13647

* dictionary modularization

* Remove unused SQL statement definition

* unit-tested thread safety of dictionaries; removed data race conditions on dictionaries and strings; dictionaries now can detect if the caller is holds a write lock and automatically all the calls become their unsafe versions; all direct calls to unsafe version is eliminated

* remove worker_is_idle() from the exit of service functions, because we lose the lock time between loops

* rewritten dictionary to have 2 separate locks, one for indexing and another for traversal

* Update collectors/cgroups.plugin/sys_fs_cgroup.c

Co-authored-by: Vladimir Kobal <vlad@prokk.net>

* Update collectors/cgroups.plugin/sys_fs_cgroup.c

Co-authored-by: Vladimir Kobal <vlad@prokk.net>

* Update collectors/proc.plugin/proc_net_dev.c

Co-authored-by: Vladimir Kobal <vlad@prokk.net>

* fix memory leak in rrdset cache_dir

* minor dictionary changes

* dont use index locks in single threaded

* obsolete dict option

* rrddim options and flags separation; rrdset_done() optimization to keep array of reference pointers to rrddim;

* fix jump on uninitialized value in dictionary; remove double free of cache_dir

* addressed codacy findings

* removed debugging code

* use the private refcount on dictionaries

* make dictionary item desctructors work on dictionary destruction; strictier control on dictionary API; proper cleanup sequence on rrddim;

* more dictionary statistics

* global statistics about dictionary operations, memory, items, callbacks

* dictionary support for views - missing the public API

* removed warning about unused parameter

* chart and context name for cloud

* chart and context name for cloud, again

* dictionary statistics fixed; first implementation of dictionary views - not currently used

* only the master can globally delete an item

* context needs netdata prefix

* fix context and chart it of spins

* fix for host variables when health is not enabled

* run garbage collector on item insert too

* Fix info message; remove extra "using"

* update dict unittest for new placement of garbage collector

* we need RRDHOST->rrdvars for maintaining custom host variables

* Health initialization needs the host->host_uuid

* split STRING to its own files; no code changes other than that

* initialize health unconditionally

* unit tests do not pollute the global scope with their variables

* Skip initialization when creating archived hosts on startup. When a child connects it will initialize properly

Co-authored-by: Stelios Fragkakis <52996999+stelfrag@users.noreply.github.com>
Co-authored-by: Vladimir Kobal <vlad@prokk.net>
2022-09-19 23:46:13 +03:00
..
api RRD structures managed by dictionaries () 2022-09-19 23:46:13 +03:00
gui add proxysql dashboard info () 2022-09-16 16:08:41 +03:00
server Deduplicate all netdata strings () 2022-09-05 19:31:06 +03:00
Makefile.am Use a prefix for the old dashboard. () 2020-04-24 07:11:30 -04:00
README.md Docs: Removed Google Analytics tags () 2022-02-17 10:37:46 +00:00

Dashboards

Because Netdata is a health monitoring and performance troubleshooting system, we put a lot of emphasis on real-time, meaningful, and context-aware charts.

We bundle Netdata with a dashboard and hundreds of charts, designed by both our team and the community, but you can also customize them yourself.

There are two primary ways to view Netdata's dashboards:

  1. The local Agent dashboard that comes pre-configured with every Netdata installation. You can see it at http://NODE:19999, replacing NODE with localhost, the hostname of your node, or its IP address. You can customize the contents and colors of the standard dashboard using JavaScript.

  2. The dashboard.js JavaScript library, which helps you customize the standard dashboards using JavaScript, or create entirely new custom dashboards or Atlassian Confluence dashboards.

You can also view all the data Netdata collects through the REST API v1.

No matter where you use Netdata's charts, you'll want to know how to use them. You'll also want to understand how Netdata defines charts, dimensions, families, and contexts.

Using charts

Netdata's charts are far from static. They are interactive, real-time, and work with your mouse, touchpad, or touchscreen!

Hover over any chart to temporarily pause it and see the exact values presented as different dimensions. Click or tap stop the chart from automatically updating with new metrics, thereby locking it to a single timeframe.

Animated GIF of hovering over a chart to see
values

You can change how charts show their metrics by zooming in or out, moving forward or backward in time, or selecting a specific timeframe for more in-depth analysis.

Whenever you use a chart in this way, Netdata synchronizes all the other charts to match it.

You can change how charts show their metrics in a few different ways, each of which have a few methods:

Manipulation Method #1 Method #2 Method #3
Reset charts to default auto-refreshing state   double click  double tap (touchpad/touchscreen)    
Select a certain timeframe  ALT + mouse selection   + mouse selection (macOS)    
Pan forward or back in time   click and drag  touch and drag (touchpad/touchscreen)    
Zoom to a specific timeframe  SHIFT + mouse selection      
Zoom in/out   SHIFT/ALT + mouse scrollwheel   SHIFT/ALT + two-finger pinch (touchpad/touchscreen)   SHIFT/ALT + two-finger scroll (touchpad/touchscreen) 

Here's how chart synchronization looks while zooming and panning:

Animated GIF of the standard Netdata dashboard being manipulated and synchronizing
charts

You can also perform all these actions using the small rewind/play/fast-forward/zoom-in/zoom-out buttons that appear in the bottom-right corner of each chart.

Additionally, resize charts by clicking-and-dragging the icon on the bottom-right corner of any chart. To restore the chart to its original height, double-click the same icon.

Animated GIF of resizing a chart and resetting it to the default
height

Charts, contexts, families

Before customizing the standard web dashboard, creating a custom dashboard, configuring an alarm, or writing a collector, it's crucial to understand how Netdata organizes metrics into charts, dimensions, families, and contexts.

Charts

A chart is an individual, interactive, always-updating graphic displaying one or more collected/calculated metrics. Charts are generated by collectors.

Here's the system CPU chart, the first chart displayed on the standard dashboard:

Screenshot of the system CPU chart in the Netdata
dashboard

Netdata displays a chart's name in parentheses above the chart. For example, if you navigate to the system CPU chart, you'll see the label: Total CPU utilization (system.cpu). In this case, the chart's name is system.cpu. Netdata derives the name from the chart's context.

Dimensions

A dimension is a value that gets shown on a chart. The value can be raw data or calculated values, such as percentages, aggregates, and more.

Charts are capable of showing more than one dimension. Netdata shows these dimensions on the right side of the chart, beneath the date and time. Again, the system.cpu chart will serve as a good example.

Screenshot of the dimensions shown in the system CPU chart in the Netdata
dashboard

Here, the system.cpu chart is showing many dimensions, such as user, system, softirq, irq, and more.

Note that other applications sometimes use the word series instead of dimension.

Families

A family is one instance of a monitored hardware or software resource that needs to be monitored and displayed separately from similar instances.

For example, if your system has multiple disk drives at sda and sdb, Netdata will put each interface into their own family. Same goes for software resources, like multiple MySQL instances. We call these instances "families" because the charts associated with a single disk instance, for example, are often related to each other. Relatives, family... get it?

When relevant, Netdata prefers to organize charts by family. When you visit the Disks section, you will see your disk drives organized into families, and each family will have one or more charts: disk, disk_ops, disk_backlog, disk_util, disk_await, disk_avgsz, disk_svctm, disk_mops, and disk_iotime.

In the screenshot below, the disk family sdb shows a few gauges, followed by a few of the associated charts:

Screenshot of a disk drive family and associated charts in the Netdata
dashboard

Netdata also creates separate submenu entries for each family in the right navigation page so you can easily navigate to the instance you're interested in. Here, Netdata has made several submenus under the Disk menu.

Screenshot of the disks menu and
submenus

Contexts

A context is a way of grouping charts by the types of metrics collected and dimensions displayed. Different charts with the same context will show the same dimensions, but for different instances (families) of hardware/software resources.

For example, the Disks section will often use many contexts (disk.io, disk.ops, disk.backlog, disk.util, and so on). Netdata then creates an individual chart for each context, and groups them by family.

Netdata names charts according to their context according to the following structure: [context].[family]. A chart with the disk.util context, in the sdb family, gets the name disk_util.sdb. Netdata shows that name in the top-left corner of a chart.

Given the four example contexts, and two families of sdb and sdd, Netdata will create the following charts and their names:

Context sdb family sdd family
disk.io disk_io.sdb disk_io.sdd
disk.ops disk_ops.sdb disk_ops.sdd
disk.backlog disk_backlog.sdb disk_backlog.sdd
disk.util disk_util.sdb disk_util.sdd

And here's what two of those charts in the disk.io context look like under sdb and sdd families:

context_01 context_02

As you can see in the screenshot, you can view the context of a chart if you hover over the date above the list of dimensions. A tooltip will appear that shows you two pieces of information: the collector that produces the chart, and the chart's context.

Netdata also uses contexts for alarm templates. You can create an alarm for the net.packets context to receive alerts for any chart with that context, no matter which family it's attached to.

Positive and negative values on charts

To improve clarity on charts, Netdata dashboards present positive values for metrics representing read, input, inbound, received and negative values for metrics representing write, output, outbound, sent.

Screenshot showing positive and negative
values

Netdata charts showing the bandwidth and packets of a network interface. received is positive and sent is negative.

Autoscaled y-axis

Netdata charts automatically zoom vertically, to visualize the variation of each metric within the visible timeframe.

Animated GIF showing the auso-scaling Y
axis

A zero-based stacked chart, automatically switches to an auto-scaled area chart when a single dimension is selected.

dashboard.js

Netdata uses the dashboards.js file to define, configure, create, and update all the charts and other visualizations that appear on any Netdata dashboard. You need to put dashboard.js on any HTML page that's going to render Netdata charts.

The custom dashboards documentation contains examples of such custom HTML pages.

Generating dashboard.js

We build the dashboards.js file by concatenating all the source files located in the web/gui/src/dashboard.js/ directory. That's done using the provided build script:

cd web/gui
make

If you make any changes to the src directory when developing Netdata, you should regenerate the dashboard.js file before you commit to the Netdata repository.