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

what api can be used to get events from all pods from a kubernetes cluster?

Arunkumarbnp
Helper

what api can be used to get events from all pods from a kubernetes cluster?

5 REPLIES 5

AntonPineiro
DynaMight Guru
DynaMight Guru

Hi,

I would check Events API v2.

Best regards

❤️ Emacs ❤️ Vim ❤️ Bash ❤️ Perl

Hi @AntonPineiro 

I tested the following API endpoint to retrieve Kubernetes-related events:

{{baseUrl}}/it_prod-dynatrace-environment-apac/v2/events?entitySelector=entityId(KUBERNETES_CLUSTER-0FB79669080C9DD5)&from=now-60d&to=now&pageSize=500
Observation:

The query successfully returns events for the Kubernetes cluster (KUBERNETES_CLUSTER-0FB79669080C9DD5).
However, no events for individual Kubernetes pods are included in the response.

Julius_Loman
DynaMight Legend
DynaMight Legend

Use DQL:

fetch events
| filter k8s.cluster.name == "mycluster"
| filter event.provider == "KUBERNETES_EVENT" or event.provider == "KUBERNETES_INFERRED_EVENT"

 

And use the platform /platform/storage/query/v1 API , see https://developer.dynatrace.com/develop/guides/access-platform-apis-from-outside/ on how to access it.

Or use dtctl insted which might be much easier to use.

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

@Julius_Loman I'm using dynatrace classic, how can I use this query?

With Dynatrace Classic or Dynatrace Managed you are left with the Events API that @AntonPineiro  suggested.
You need to select events from workloads running in the kubernetes cluster and you must adjust entitySelector accordingly.

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

Featured Posts