Skip to content
Daniel Berger edited this page Apr 23, 2023 · 4 revisions

Description

A Ruby library for gathering Linux kernel statistics out of /proc/stat.

Installation

gem install linux-kstat

Bundler

If you have trouble installing this gem via bundler, please try this:

bundle config specific_platform true

Then attempt to install again.

Synopsis

# require 'linux-kstat' will also work
require 'linux/kstat'

kstat = Linux::Kstat.new

p kstat[:cpu]
p kstat[:procs_running]

Details

The values for most of the keys are a single numeric value. However, in the case of "cpu" keys, the result is a 7 element hash of numeric values. In the case of the "intr" key, the value is an array containing the list of interrupts.

Information about /proc/stat

See linuxhowto for more information about the meaning of each of the fields.

Clone this wiki locally