12 Jun 2024 12:19 AM - last edited on 02 Oct 2024 12:59 PM by MaciejNeumann
I have DQL timeseries process query that I want to lookup the host and add the hostname field to the displayed fields. The issue I'm having is identifying the source & lookup fields in the lookup function that would get me to the hostname for the host where the process is running. Is there an example you can provide of a similar DQL query?
Also is there any documentation that identifies the available fields for a given dt.entity.... so that one can identify the entities & fields that will be required in order to lookup the field data to meet one's requirements?
I tried using the "runs_on" funciton below called out in Ex. 2 under the "Practical Examples" section in the lookup command doc found here, but this does not seem to work with my timeseries process query.
fetch dt.entity.service_instance
| lookup [ fetch dt.entity.host ],
sourceField: runs_on[dt.entity.host],
lookupField: id,
fields: { host.name = entity.name }
02 Dec 2024 10:37 AM - edited 02 Dec 2024 01:25 PM
Hey!
For the purpose of finding out what fields are available for an entity type you can run a query like this
describe dt.entity.host
Regarding your specific use case with timeseries process query, you can always define additional fields in the by: option and actually the host name is already there. Auto-suggestions in notebooks will provide you available fields to split by.
Example query:
timeseries avg(dt.process.availability), by: { host.name, dt.entity.process_group_instance }
If it happens that the field you are looking for is not exposed directly as an option to split by, you can always use entityAttr function to add any attribute you want, for example:
timeseries avg(dt.process.availability), by: { dt.entity.process_group_instance, dt.entity.host }
| fieldsAdd osType=entityAttr(dt.entity.host, "osType")
(There is also an entityName function that works very similar but just for getting the name of an entity)
Hope that helps!
EDIT: There is another way to identify the entities & fields that are available, semantic dictionary contains information about all relationships and fields avaiable on each entity.