Skip to content

Commit

Permalink
Add: Exposing metrics from package installed tetragon
Browse files Browse the repository at this point in the history
Signed-off-by: Prateek Singh <prateeksingh9741@gmail.com>
  • Loading branch information
prateek041 committed Sep 21, 2023
1 parent ef9db49 commit caf7d89
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 2 deletions.
25 changes: 25 additions & 0 deletions docs/content/en/docs/getting-started/deployment/kubernetes.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,31 @@ If Tetragon does not to start due to BTF issues, please refer to the
for details and solutions.
{{< /note >}}

## Validation

Check if all the tetragon containers are running.

{{< note >}}
In the below examples, don't forget to change the Pod name corresponding to the Pod name inside your cluster.

This example contains Tetragon Pod container named `tetragon-qj4w4`.
{{< /note >}}

```shell
~ kubectl get pods --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system coredns-5d78c9869d-kgwbw 1/1 Running 0 12m
kube-system coredns-5d78c9869d-v728b 1/1 Running 0 12m
kube-system etcd-test-control-plane 1/1 Running 0 12m
kube-system kindnet-mwgfk 1/1 Running 0 12m
kube-system kube-apiserver-test-control-plane 1/1 Running 0 12m
kube-system kube-controller-manager-test-control-plane 1/1 Running 0 12m
kube-system kube-proxy-gm8cv 1/1 Running 0 12m
kube-system kube-scheduler-test-control-plane 1/1 Running 0 12m
kube-system tetragon-qj4w4 2/2 Running 0 2m31s
local-path-storage local-path-provisioner-6bc4bddd6b-kk6hj 1/1 Running 0 12m
```

## Configuration

You can then make modifications to the Tetragon configuration using `helm
Expand Down
38 changes: 36 additions & 2 deletions docs/content/en/docs/tutorials/tetragon-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,40 @@ promhttp_metric_handler_errors_total{cause="gathering"} 0
...
```

### Container
## Container

TBD
Tetragon, when installed as a container as mentioned in [Container Deployment]({{<ref "docs/getting-started/deployment/container" >}})

## Package

Tetragon, when installed via release packages as mentioned in [Package Deployment](../getting-started/deployment/package.md). It can be interacted with `tetragon` command. By default, metrics are disabled, which can be enabled using `--metrics-server` flag, by specifying the address.

### Set Metrics Address

Run `sudo tetragon --metrics-server localhost:2112` to set metrics address to `localhost:2112` and export metrics.

```bash
~ sudo tetragon --metrics-server localhost:2112
[sudo] password for <user>:
time="2023-09-21T13:17:08+05:30" level=info msg="Starting tetragon" version=v0.11.0
time="2023-09-21T13:17:08+05:30" level=info msg="config settings" config="mapeased
...
...
time="2023-09-21T13:17:08+05:30" level=info msg="Listening for events..."
```
### Fetch the Metrics
Then the exposed metrics can be fetched using `curl` command at `localhost:2112/metrics`
```shell
➜ ~ curl localhost:2112/metrics
# HELP promhttp_metric_handler_errors_total Total number of internal errors encountered by the promhttp metric handler.
# TYPE promhttp_metric_handler_errors_total counter
promhttp_metric_handler_errors_total{cause="encoding"} 0
promhttp_metric_handler_errors_total{cause="gathering"} 0
# HELP tetragon_errors_total The total number of Tetragon errors. For internal use only.
# TYPE tetragon_errors_total counter
...
```

0 comments on commit caf7d89

Please sign in to comment.