CPU Stats FilterΒΆ

New in version 0.10.

Plugin Name: SandboxFilter
File Name: lua_filters/procstat.lua

Calculates deltas in /proc/stat data. Also emits CPU percentage utilization information.


  • whitelist (string, optional, default “”)

    Only process fields that fit the pattern, defaults to match all.

  • extras (boolean, optional, default false)

    Process extra fields like ctxt, softirq, cpu fields.

  • percent_integer (boolean, optional, default true)

    Process percentage as whole number.

Example Heka Configuration

type = "FilePollingInput"
ticker_interval = 1
file_path = "/proc/stat"
decoder = "ProcStatDecoder"

type = "SandboxDecoder"
filename = "lua_decoders/linux_procstat.lua"

type = "SandboxFilter"
filename = "lua_filters/procstat.lua"
preserve_data = true
message_matcher = "Type == 'stats.procstat'"
    whitelist = "cpu$"
    extras = false
    percent_integer = true
Cpu fields:

1 2 3 4 5 6 7 8 9 10 user nice system idle [iowait] [irq] [softirq] [steal] [guest] [guestnice] Note: systems provide user, nice, system, idle. Other fields depend on kernel.

user: Time spent executing user applications (user mode). nice: Time spent executing user applications with low priority (nice). system: Time spent executing system calls (system mode). idle: Idle time. iowait: Time waiting for I/O operations to complete. irq: Time spent servicing interrupts. softirq: Time spent servicing soft-interrupts. steal: ticks spent executing other virtual hosts [virtualization setups] guest: Used in virtualization setups. guestnice: running a niced guest

This line shows counts of interrupts serviced since boot time, for each of the possible system interrupts. The first column is the total of all interrupts serviced including unnumbered architecture specific interrupts; each subsequent column is the total for that particular numbered interrupt. Unnumbered interrupts are not shown, only summed into the total.
ctxt 115315
The number of context switches that the system underwent.
btime 769041601
Boot time, in seconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC).
processes 86031
Number of forks since boot.
procs_running 6
Number of process in runnable state. (Linux 2.5.45 onward.)
procs_blocked 2
Number of process blocked waiting for I/O to complete. (Linux 2.5.45 onward.)
softirq 288977 23 101952 19 13046 19217 7 19125 92077 389 43122
Time spent servicing soft-interrupts.