module DockDriver::Template::FreeBSD

Adds network-related methods to the DockDriver::Template DSL.

Since I’m using a bit of metaprogramming, here’s a list of DSL methods that this module brings to the template:

loadavg_one

1 minute load average

loadavg_five

minute load average

loadavg_fifteen

15 minute load average

Example:

<%= loadavg_one %> => 1.61

Constants

LOADAVG_KEYS

Map of column names for the load stats.

Private Instance Methods

loadavg() click to toggle source

Parse the contents of LOADAVG_PATH and return a hash of values found.

# File lib/dock_driver/template/freebsd.rb, line 40
def loadavg
    items = `sysctl vm.loadavg`.chomp.scan( /(\d+[,.]\d+)+/ ).flatten!
    return Hash[LOADAVG_KEYS.zip( items )]
rescue Exception
    return Hash.new
end