Module: StatsLite

Defined in:
lib/stats_lite.rb,
lib/stats_lite/app.rb,
lib/stats_lite/log.rb,
lib/stats_lite/cache.rb,
lib/stats_lite/helper.rb,
lib/stats_lite/default.rb,
lib/stats_lite/version.rb,
lib/stats_lite/configure.rb,
lib/stats_lite/rufus_wrapper.rb,
lib/stats_lite/default_commands.rb

Defined Under Namespace

Modules: Default, Helper, Log Classes: App, Cache, Configuration, RufusWrapper

Constant Summary collapse

VERSION =
"0.8.1"
DEFAULT_COMMANDS =
{
  host: {
    hostname: "hostname",
    ip: {
      public: "curl -s ifconfig.me"
    }
  },
  cpu: {
    model: "lscpu | grep 'Model name' | cut -f 2 -d \":\" | awk '{$1=$1}1'",
    cores: "nproc",
    usage: <<-CMD
(grep 'cpu ' /proc/stat;sleep 0.1;grep 'cpu ' /proc/stat)|awk -v RS="" '{print ""($13-$2+$15-$4)*100/($13-$2+$15-$4+$16-$5)"%"}'
    CMD
  }
}

Class Method Summary collapse

Class Method Details

.configureObject



42
43
44
45
46
47
48
49
# File 'lib/stats_lite/configure.rb', line 42

def configure
  config = @configuration ||= Configuration.new
  if block_given?
    yield config, StatsLite::Helper
  else
    config
  end
end