aquasecurity/tracee

Metrics unavailable in Prometheus without explicit Port declarations

Opened this issue · 2 comments

Tracee has metrics enabled by default, but relevant ports are not explicitly exposed so Prometheus could collect them. Only after I added

  ports:
    - name: metrics
      containerPort: 3366
      protocol: TCP

to the container stance in Tracee Daemonset, which now looks more like this then:

containers:
  - name: tracee
    image: docker.io/aquasec/tracee:0.20.0
    command:
      - /tracee/tracee
    args:
      - '--config'
      - /tracee/config.yaml
    ports:
      - name: metrics
        containerPort: 3366
        protocol: TCP
...

Prometheus was able to see the metrics with the following PodMonitor:

apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
  name: monitoring-tracee
  namespace: default
  labels:
    name: monitoring-tracee
    release: prometheus-grafana
spec:
  namespaceSelector:
    matchNames:
    - tracee
  podMetricsEndpoints:
  - interval: 5s
    port: metrics
  selector:
    matchLabels:
      app.kubernetes.io/name: tracee

Hey @Jeansen, thank you for report this issue and to give some detail, I'll handle it :)

@rscampos Great. Thanks a lot. BTW, is it intentional that there are only metrics for ebpf? For instance, there are no more metrics for loaded signatures. Just mentioning it ;-)