Dynatrace tips
Tips and workarounds from Dynatrace users for Dynatrace users.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PRO TIP - Automatic grid layout on a dashboard with monaco

Julius_Loman
DynaMight Legend
DynaMight Legend

It's quite common to have dashboards display many tiles for individual components - for example multiple services. Luckily Monaco supports Go Templating.  

Let's consider a Gen2 and a Gen3 dashboard where we want to easily generate a grid of tiles and just specify a set of parameters for each tile. It's just required to do some basic arithmetic to calculate the position of each tile and then wrap the tiles when we reach a defined width of the grid. Unfortunately, not even basic arithmetic is possible in the gotemplate engine used by monaco, so we need to do it creatively by using printf and len functions 😎


I believe a sample is more than enough. I've put the examples in my GitHub repository of advanced configuration as code samples here:

https://github.com/juliusloman/dynatrace-configuration-as-code-advanced-samples

When deployed, we will get a nice grid of tiles on a dashboard, and we can add new services just in the YAML without touching the JSON:

Julius_Loman_0-1755891747634.png

 

Julius_Loman_0-1755762910717.png

 



Dynatrace Ambassador | Alanata a.s., Slovakia, Dynatrace Master Partner
6 REPLIES 6

lubrman
Mentor

Elegant solution

lubrman
Mentor

For completeness, it’s even better to extract the metrics into YAML and then send them into JSON. This way, each tile can display different data. Such an approach would also allow using the tiles within a CI/CD pipeline, where, for example, during an application deployment a dashboard could be created based on the specific requirements of the application owner.

Sure, this example above is the bare minimum for showcasing the possibilities. It's also possible to use different tile types of course, like service or host health.

What I was unable to do was provide a reference to another Monaco configuration in the list. @nico_riedmann  any suggestions?  For example, to have the tag a reference to an auto-tag deployed by Monaco in the same project. Monaco does not seem to resolve dependencies in this parameter type.

Dynatrace Ambassador | Alanata a.s., Slovakia, Dynatrace Master Partner

36Krazyfists
Advisor

This is really cool.  I'd like to see something similar for modern dashboards too.  Now that RUM on Grail is available, we're starting to move more and more of our dashboards to the new framework, but I find the JSON not as friendly to read as gen 2 dashboards.

@36Krazyfists certainly possible with Gen3 dashboards. I agree, the new dashboard JSONs are less friendly for editing 🙃

Dynatrace Ambassador | Alanata a.s., Slovakia, Dynatrace Master Partner

@36Krazyfists I updated this post with Gen3 dashboard example - same approach, just you have to loop twice through the list.

Dynatrace Ambassador | Alanata a.s., Slovakia, Dynatrace Master Partner

Featured Posts