cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Dashboard Variable

ChadTurner
DynaMight Legend
DynaMight Legend

I'm hitting a wall... My overall goal is to build a variable for our new dashboard that looks at the "dataCenterName". This way users can use a dashboard that has core metrics such as CPU, Disk, Memory, etc... and reformulate the data by selecting the desired DC's. 

Any help would be appreciated! 

ChadTurner_0-1750162194799.png

 

-Chad
13 REPLIES 13

lubrman
Advisor

Hi @ChadTurner 

One possible approach for you could be to separate data centers using tagging and then include them in Management Zones (MZ). You could set up an auto-tagging rule to tag hosts based on their data center. If you're able to divide hosts into host groups, you can then define the segmentation based on those groups.

yeah, that is a viable solution form Gen1 and Gen2 of Dynatrace UI. Ideally I'd like to get it all linked in a Gen3 Dashboard, that way we can leverage some of the newer capabilities. 

@Fin_Ubels - Do you have any recommendations on Setting the DC Name as a variable for host metrics on a new Dashboard?

 

-Chad

Kenny_Gillette
DynaMight Leader
DynaMight Leader

I see the dilemma.  There is no auto tag for DCs unfortunetly.

https://community.dynatrace.com/t5/Product-ideas/Using-data-center-as-an-auto-tag/idi-p/151331

Tried Segments?

Kenny_Gillette_1-1750164008355.png

 

 

 

Dynatrace Certified Professional

that's the thing, If I can do segments, one would think I could do Variables and thus cut down a bunch of segments. If push comes to shove then I'll go the segment route. 

-Chad

Other ideas:

Create a DataCenter tag:
1.) DC IPs hopefully are different so tag based off IP
2.) Server name - do each host have part of the DC in its name?
Dynatrace Certified Professional

So I've pivoted - Using Variables within segments to drastically cut down the number of defined segments needed. Which also cuts down the pain of altering already built tiles. 

I'll keep you guys informed as I go along. Once I get everything all set, I will have a PRO TIP coming out too 🙂

-Chad

We love pro tips.  

Dynatrace Certified Professional

That is exactly the "pro" way we envisioned using variables and Segments combined. Future improvements will support this journey.

Feel free to share feedback or ping me in case you need help identifying the best way to set up and apply your data segmentation and filtering. 

mgome
Advisor

First create a variable with the following DQL:

fetch dt.entity.vmware_datacenter
| fieldsRemove id


Then you can use the variable in a timeseries query like this:

timeseries cpuUsage=avg(dt.host.cpu.usage), by: { dt.entity.host },filter:in(dt.entity.host, classicEntitySelector(concat("type(HOST),toRelationships.isSiteOf(type(VMWARE_DATACENTER),entityName.equals(",toString($Datacenter),"))")))
| fieldsAdd entityName(dt.entity.host)


You have to use concat so you can turn the variable into a usable string with the toString call.

ChadTurner
DynaMight Legend
DynaMight Legend

Thank you @mgome that worked for setting a variable in the dashboard directly. We did expand the fetch to include all DataCenter Flavors like Geo Site, Vmware, GCP, Azure, AWS. 

The only draw back is depending on what you select, certain tile might fail to render as it is a GCP tile but your DC selected is Azure... but that's an understandable limitation/function as by way of the design.

 

-Chad

ChadTurner
DynaMight Legend
DynaMight Legend

Everyone, thank you or the information. I got variables to work on the dashboard. Now I'm looking to build a segment with variables along the same methodology. 
I've got the segment all defined out and working as validated in the InfraOps App, however its not applying to DQL or Metrics on the given dashboard. I suspect there needs to be further configuration at the DQL level? I would have assumed that it would have applied to the out of the box metrics however. 

Notice there is data without Segments set: 

ChadTurner_5-1750253657515.png

 

Then as we select the Segment with a variable, the data drops out. Yes, this is looking at VMware Host CPU and the selected segment is indeed VMware and I can validate it here as well: 

ChadTurner_2-1750253223827.png

It's working on the InfraOps app: 

ChadTurner_3-1750253324979.png

But as I then set the Segment variable as A****1 you'll see the tiles looking at both a DQL statement and an out of the box metric, fails to render:

ChadTurner_4-1750253495658.png

I thought maybe there is just a processing delay much like we have seen with the legacy MZ's where we can see the preview but it takes time for it to apply in the environment... but even an hour later, no dice. But also to that delay point, if there was a delay, then the InfraOps App wouldn't have been able to use the Segment. 

Any insight would be welcomed 🙂 

 

-Chad

Fin_Ubels
Dynatrace Champion
Dynatrace Champion

Ah I think I ran into a similar problem a few weeks ago.

The first thing to note is the way management zones filter and the way segments filter is fundamentally different. Management zones allow filtering of all data types by entities whereas segments filter on records specified in the segment definition.

So when you create a segment it only filters on the data types specified in the segment. From what I see in your screenshot, we're only filtering on entities and don't have a section in the segment specifying how to filter on metrics.

The reason why this works in the infra/ops app is the base query for all of the tiles is "fetch dt.entity.host". You can see this if you look at the network tab and refresh the page and then filter requests for "query". With that, you can see all of the queries that make up any new platform pages. Unrelated to this, I find it very useful for learning how apps achieved specific views to help replicate them on a dashboard or notebook.

Fin_Ubels_0-1750371905213.png

So, to fix the segment we need to add a metric section to the segment that tells the segment how to filter the metric OR we need to change the queries on the dashboard to start by fetching the host, just like in the infra/ops app.

If we wanted to add that metric section to a segment AND use the segment to filter by different types of cloud regions then we could combine the variable query something like this.

Fin_Ubels_2-1750374044258.png

Then when we go to use the variable in our segment definitions it would look something like this.

Fin_Ubels_3-1750374091051.png

The last thing is actually using the segment and how that looks. If we query the dt.host.cpu.usage metric and split by our regions, we can see that I have it filtered on just the region I wanted. And thanks to the pretty name I can identify which region I'm filtering for while using the technical fields behind the scenes.

Fin_Ubels_4-1750374327231.png

As we can see though, this doesn't work for the host query.

Fin_Ubels_6-1750374608239.png

So now lets make it work with the host query. First we would add our region entities and then add the host relationship for each.

Fin_Ubels_5-1750374534559.png

Now when we rerun that host query it starts working because we've directly addressed how to filter for that record type with our segment.

Fin_Ubels_7-1750374730704.png

Hopefully this gets you on the right track with how segments work and how to make use of them in your case. Last time I was configuring them there was a limit to 20 configurations in a single segment so it may be difficult to make a generic "data center" segment that applies everywhere it can. If you make one for each Azure, AWS, VMWare and GCP then you'd be able to cover more use cases, but you'd also have 4 separate segments.

Thank you @Fin_Ubels! Ill be sure to start working through all of this. It makes perfect sense the way you put it. It's an all new way of thinking from Management Zones to Segments and I have to get my head wrapped around it fully and you've set me off on a great start. 

-Chad

Featured Posts