Sign inSign up

leontoetenel/entity_mapper

By leontoetenel

Updated 11 months ago

`entity_mapper` is a Python service that queries Dynatrace for different entity types.

Image
0

417

leontoetenel/entity_mapper repository overview

entity_mapper

entity_mapper is a Python service that queries the Dynatrace Entities API for different entity types (hosts, process groups, process group instances, …) and writes the entityId mappings into Redis/Valkey.
These mappings are later used by other services (such as alert_streamer) to correlate alerts with the right Dynatrace entities.


Features

  • Fetches entities from Dynatrace Entities API (paginated)
  • Supports multiple entity types via ENTITY_TYPES env var
  • Stores entityId mappings in Redis/Valkey with 24h TTL
  • Skips unchanged entries for efficiency
  • Retry-friendly and lightweight
  • OpenShift- and Docker-ready container (non-root, arbitrary UID-proof)

🔧 Environment variables

VariableRequiredExample valueDescription
DT_API_URLYhttps://<tenant>.live.dynatrace.comDynatrace environment base URL
DT_API_TOKENYdt0c01...Dynatrace API Token
VALKEY_HOSTXvalkey (default: localhost)Redis/Valkey hostname
VALKEY_PORTX6379Redis/Valkey port
ENTITY_TYPESXHOST,PROCESS_GROUP,PROCESS_GROUP_INSTANCEComma-separated list of entity types to fetch

Local run (Docker)

With explicit env vars:

docker run --rm \
  -e DT_API_URL=https://<tenant>.live.dynatrace.com \
  -e DT_API_TOKEN=*** \
  -e VALKEY_HOST=valkey \
  -e VALKEY_PORT=6379 \
  -e ENTITY_TYPES=HOST,PROCESS_GROUP,PROCESS_GROUP_INSTANCE \
  leontoetenel/entity_mapper:latest

OpenShift / Kubernetes deployment

ConfigMap
apiVersion: v1
kind: ConfigMap
metadata:
  name: entity-mapper-config
data:
  VALKEY_HOST: "valkey"
  VALKEY_PORT: "6379"
  ENTITY_TYPES: "HOST,PROCESS_GROUP,PROCESS_GROUP_INSTANCE"
Secret
apiVersion: v1
kind: Secret
metadata:
  name: entity-mapper-secrets
type: Opaque
stringData:
  DT_API_URL: "https://<tenant>.live.dynatrace.com"
  DT_API_TOKEN: "<your-api-token>"
Deployment

With additional CRON properties.

apiVersion: batch/v1
kind: CronJob
metadata:
  name: entity-mapper-cron
spec:
  # Run every day at 23:00
  schedule: "0 23 * * *"
  successfulJobsHistoryLimit: 1
  failedJobsHistoryLimit: 3
  jobTemplate:
    spec:
      backoffLimit: 2
      template:
        metadata:
          labels:
            app: entity-mapper
        spec:
          restartPolicy: Never
          containers:
          - name: entity-mapper
            image: docker.io/leontoetenel/entity_mapper:latest
            imagePullPolicy: IfNotPresent
            envFrom:
            - configMapRef:

Tag summary

Content type

Image

Digest

sha256:652c2628a

Size

74 MB

Last updated

11 months ago

docker pull leontoetenel/entity_mapper