# Fluent Bit Metrics

Fluent Bit exposes its [own metrics](https://docs.fluentbit.io/manual/3.1/administration/monitoring) to allow you to monitor the internals of your pipeline. The collected metrics can be processed similarly to those from the [Prometheus Node Exporter input plugin](https://docs.fluentbit.io/manual/3.1/pipeline/inputs/node-exporter-metrics). They can be sent to output plugins including [Prometheus Exporter](https://docs.fluentbit.io/manual/3.1/pipeline/outputs/prometheus-exporter), [Prometheus Remote Write](https://docs.fluentbit.io/manual/3.1/pipeline/outputs/prometheus-remote-write) or [OpenTelemetry](https://docs.fluentbit.io/manual/3.1/pipeline/outputs/opentelemetry)..

**Important note:** Metrics collected with Node Exporter Metrics flow through a separate pipeline from logs and current filters do not operate on top of metrics.

## Configuration

| Key               | Description                                                                                                                         | Default   |
| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------- | --------- |
| scrape\_interval  | The rate at which metrics are collected from the host operating system                                                              | 2 seconds |
| scrape\_on\_start | Scrape metrics upon start, useful to avoid waiting for 'scrape\_interval' for the first round of metrics.                           | false     |
| threaded          | Indicates whether to run this input in its own [thread](https://docs.fluentbit.io/manual/3.1/administration/multithreading#inputs). | `false`   |

## Getting Started

### Simple Configuration File

In the following configuration file, the input plugin \_node\_exporter\_metrics collects \_metrics every 2 seconds and exposes them through our [Prometheus Exporter](https://docs.fluentbit.io/manual/3.1/pipeline/outputs/prometheus-exporter) output plugin on HTTP/TCP port 2021.

{% tabs %}
{% tab title="fluent-bit.conf" %}

```
# Fluent Bit Metrics + Prometheus Exporter
# -------------------------------------------
# The following example collects Fluent Bit metrics and exposes
# them through a Prometheus HTTP end-point.
#
# After starting the service try it with:
#
# $ curl http://127.0.0.1:2021/metrics
#
[SERVICE]
    flush           1
    log_level       info

[INPUT]
    name            fluentbit_metrics
    tag             internal_metrics
    scrape_interval 2

[OUTPUT]
    name            prometheus_exporter
    match           internal_metrics
    host            0.0.0.0
    port            2021

```

{% endtab %}

{% tab title="fluent-bit.yaml" %}

```yaml
service:
    flush: 1
    log_level: info
pipeline:
    inputs:
        - name: fluentbit_metrics
          tag: internal_metrics
          scrape_interval: 2

    outputs:
        - name: prometheus_exporter
          match: internal_metrics
          host: 0.0.0.0
          port: 2021
```

{% endtab %}
{% endtabs %}

You can test the expose of the metrics by using *curl:*

```bash
curl http://127.0.0.1:2021/metrics
```
