Memory metrics

The Memory (mem) input plugin gathers memory and swap usage on Linux at a fixed interval and reports totals and free space. The plugin emits log-based metrics (for Prometheus-format metrics see the Node Exporter metrics input plugin).

Metrics reported

Key
Description
Units

Mem.free

Free or available memory reported by the kernel.

Kilobytes

Mem.total

Total system memory.

Kilobytes

Mem.used

Memory in use (Mem.total - Mem.free).

Kilobytes

Swap.free

Free swap space.

Kilobytes

Swap.total

Total system swap.

Kilobytes

Swap.used

Swap space in use (Swap.total - Swap.free).

Kilobytes

proc_bytes

Optional. Resident set size for the configured process (pid).

Bytes

proc_hr

Optional. Human-readable value of proc_bytes (for example, 12.00M).

Formatted

Configuration parameters

The plugin supports the following configuration parameters:

Key
Description
Default

interval_nsec

Polling interval in nanoseconds.

0

interval_sec

Polling interval in seconds.

1

pid

Process ID to measure. When set, the plugin also reports proc_bytes and proc_hr.

none

threaded

Run this input in its own thread.

false

Get started

To collect memory and swap usage from your system, run the plugin from the command line or through the configuration file.

Command line

Run the following command from the command line:

The output is similar to:

Configuration file

In your main configuration file append the following:

Example output when pid is set:

Last updated

Was this helpful?