---
title: Linux Kernel CPU Profiling
slug: linux-kernel-cpu-profiling
docTags: 
createdAt: 2024-02-06T20:33:06.341Z
---

The Linux Kernel CPU profiler can be enabled in observe-agent to collect machine level CPU statistics. Our profiler internally leverages `eBPF` to collect stats so enabling this adds minimal amount of latency on your overall system.

:::hint{type="info"}
Since the profiler internally uses `eBPF` it needs your cluster to be running with a Linux kernel version >= `4.9`
:::

### Getting Started

Ensure that `ObserveNow Profiling` is enabled for your stack. This sets up the profiling server along with a username and password to login.

Login to the profiling server with your credentials, and then navigate to `Settings` -> `API keys` -> `Add API Key` and create a new API Key with following config:

```yaml
Name: ObserveAgentKey
Role: Agent
Valid for: 0 # No expiry
```

Make sure you copy the API Key created and add the following YAML snippet to the agent's `values.yaml` and run the agent based on [these instructions](https://github.com/devopsnowinc/docs/blob/opsverse/docs/observenow/install-opsverse-agent/#kubernetes).

```yaml
pyroscope-ebpf:
  enabled: true
  args:
    - "ebpf"
    - "--application-name"
    - "agent.ebpf"
    - "--server-address"
    - "<ADD_SERVER_ENDPOINT_HERE>"
    - "--auth-token"
    - "<ADD_APIKEY_HERE>"
```

You should see kernel-level CPU statistics start getting pushed to your profiling server within a few minutes.

For more `pyroscope` options, visit [this repo](https://github.com/pyroscope-io/pyroscope)
