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

Host availability on Notebookes, by host name

ArtuD
Participant

I want to create a notebook that shows me the availability of hosts, separated by the name of the hosts, but I can only do this using host.entity, how could I create this?

6 REPLIES 6

cesarsaravia
Dynatrace Pro
Dynatrace Pro

Hi @ArtuD 
You can use this DQL:

timeseries avg(dt.host.availability), by:{dt.entity.host}
or
timeseries availability=sum(dt.host.availability),by:{availability.state,dt.metrics.source,dt.entity.host}

Regards,

-César S. - LATAM Solutions Architect

Yes, but i want to do this whith host names, not host entity

You should use the lookup command in this case.

This is the code:

timeseries avg(dt.host.availability), by:{dt.entity.host}
| lookup [fetch dt.entity.host], lookupField:id , sourceField:dt.entity.host, prefix:"host."
| fields timeframe,interval,host.entity.name, `avg(dt.host.availability)`

Result:

cesarsaravia_0-1711050543351.png

Regards,

-César S. - LATAM Solutions Architect

And maybe you can use the metrics option in Notebooks. It's easier to find the right metric.

cesarsaravia_0-1711049980946.png

 

-César S. - LATAM Solutions Architect

I tried metric options, but still just the host.entity, just like in your print, something like 

timeseries avg(dt.host.availability), by:{host.name}

 

If metric has entity id, but does not have entity name (or yet another dimension), you can always enrich result using lookup command and referencing to entity model.

In my example I calculate % of availability for 2 hosts and  add entity name from dt.entity.host

timeseries availability=avg(dt.host.availability), by:{dt.entity.host, availability.state}
, filter:in(dt.entity.host, {"HOST-86E98F7E966EA327","HOST-9F38503667743716"}), interval:5m
| summarize { availability = 100*sum(if(availability.state=="up",availability[])) / sum(availability[])}, 
by: {interval, timeframe, dt.entity.host}

| lookup [fetch dt.entity.host], sourceField:dt.entity.host, lookupField:id, fields:{entity.name}

Result looks like this:

krzysztof_hoja_0-1711050814024.png

 

Featured Posts