Project

General

Profile

Bug #44693

mgr/dashboard: enable embedding of custom Grafana dashboards

Added by Patrick Seidensal about 4 years ago. Updated almost 3 years ago.

Status:
New
Priority:
Normal
Assignee:
Category:
Monitoring
Target version:
-
% Done:

0%

Source:
Tags:
Backport:
nautilus, octopus
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

For certain users, the Grafana dashboards (GD) provided in Ceph Dashboard (CD) may neither be sufficient nor specialized enough, so that additions or enhancements might not even be appropriate. To enable such users to use custom GDs and have them embedded in CD, we need to extend CD appropriately.

The simplest possible implementation, which would not be introducing any more front-end changes, is to enable the customer to set IDs of GDs to be used instead of the static ones CD uses already.

Every GD (at least starting with Grafana v6) has a unique ID. Those IDs are used in the embedding of GDs to uniquely identify which dashboard should be displayed on which page inside CD.

CD does not allow to configure those IDs and tests exist that ensure that IDs of GDs in the Ceph repository will not accidentally change. By enabling CD to replace those IDs (using CD settings), every user could replace every GD shown in the CD individually and even all of them can be replaced. The GDs shipped would not need to be modified, making the additional dashboards also upgrade-safe.

Due to the CD having a limited amount of dashboards shown on predefined places, it is viable to have configuration options to set different GD IDs.

Configurations options that would need to be added are, with their suggested names:

  • grafana-dashboard-ceph-cluster
  • grafana-dashboard-cephfs-overview
  • grafana-dashboard-host-detail
  • grafana-dashboard-hosts-overview
  • grafana-dashboard-osd-device-details
  • grafana-dashboard-osds-overview
  • grafana-dashboard-pool-details
  • grafana-dashboard-pool-overview
  • grafana-dashboard-radosgw-detail
  • grafana-dashboard-radosgw-overview
  • grafana-dashboard-rbd-overview

This would lead to CLI commands to look like:

  • set-grafana-dashboard-ceph-cluster
  • get-grafana-dashboard-ceph-cluster
  • unset-grafana-dashboard-ceph-cluster

I wouldn't mind shortening these, but (personally), I like their expressiveness and would like to see it preserved.

The static and predefined IDs should be used by default and every time a configuration option is unset/reset.

History

#1 Updated by Patrick Seidensal about 4 years ago

  • Description updated (diff)

#2 Updated by Volker Theile about 4 years ago

  • Assignee set to Volker Theile

#3 Updated by Volker Theile about 4 years ago

There are other points to be considered when we implement this feature.

  • How is the custom configuration delivered to the UI.

To simplify that we should get the GD URLs for all GD in one request via a singleton service that get's the data on login or when the data is needed the first time. Thus it is not necessary to call the backend via REST API call every time. The disadvantage of this solution is that changes to the configuration in the backend are not automatically reflected in the frontend. We could avoid this, however, in that the CLI commands issue the warning that changes are only applied after a page reload.

  • How to process individual GD URLs incl. parameters?

So far, the GD URLs have been hard-coded, e.g.:

<cd-grafana [grafanaPath]="'ceph-pool-detail?var-pool_name='
            + selection.first()['pool_name']" 
            uid="-xyV8KCiz" 
            grafanaStyle="one">
</cd-grafana>

But how should we deal with the fact that the custom GD may need different parameters than the ones we are currently appending to the URLs? This requirement can be solved by using tokens in the configured URLs. In this way, the user-defined GD can access and use all possible parameters of the currently selected datable row.

<cd-grafana dashboardId="ceph-pool-detail" 
            [urlData]="selection.first()" 
            uid="-xyV8KCiz" 
            grafanaStyle="one">
</cd-grafana>

The cd-grafana Angular component will map the dashboard ID ceph-pool-detail to the URL ceph-pool-detail?var-pool_name={{ poolname }} and replace the tokens with the urlData to ceph-pool-detail?var-pool_name=foo.
The URL can also look like foo-bar?var-xxx={{ xxx }}&var-yyy={{ yyy }}.

#4 Updated by Volker Theile about 4 years ago

  • Backport changed from nautilus to nautilus, octopus

#5 Updated by Ernesto Puerta almost 3 years ago

  • Project changed from mgr to Dashboard
  • Category changed from 148 to Monitoring

Also available in: Atom PDF