Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/threez/ruby-vmstat

A focused and fast library to gather memory, cpu, network, load avg and disk information
https://github.com/threez/ruby-vmstat

cpu disk freebsd linux macosx netbsd openbsd ruby smartos solaris vmstat

Last synced: 1 day ago
JSON representation

A focused and fast library to gather memory, cpu, network, load avg and disk information

Awesome Lists containing this project

README

        

# Vmstat [![Build Status](https://secure.travis-ci.org/threez/ruby-vmstat.png)](http://travis-ci.org/threez/ruby-vmstat) [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/threez/ruby-vmstat)

This is a focused and fast library to get system information like:

* _Memory_ (free, active, ...)
* _Network Interfaces_ (name, in bytes, out bytes, ...)
* _CPU_ (user, system, nice, idle)
* _Load_ Average
* _Disk_ (type, disk path, free bytes, total bytes, ...)
* _Boot Time_
* _Current Task_ (used bytes and usage time *MAC OS X / Linux ONLY*)

*It currently supports:*

* FreeBSD
* MacOS X
* Linux (>= 2.6)
* OpenBSD
* NetBSD
* Solaris/SmartOS

*It might support (but not tested):*

* Older versions of linux

## Installation

Add this line to your application's Gemfile:

gem 'vmstat'

And then execute:

$ bundle

Or install it yourself as:

$ gem install vmstat

## Usage

Just require the library and make a snapshot or use the distinct methods to just capture parts of the statistics. For further information have a look at the [rdoc](http://rdoc.info/gems/vmstat/frames).

require "vmstat"

Vmstat.snapshot # => #,
# #,
# #,
# #,
# #,
# #,
# #,
# #],
# @disks=
# [#],
# @load_average=
# #,
# @memory=
# #,
# @network_interfaces=
# [#,
# #,
# #,
# #,
# #],
# @task=
# #>

## Test

Development

docker-compose up

Single test build and run:

docker build -t ruby-vmstat .
docker run --rm -ti ruby-vmstat rake spec

## Todo

* Swap information
* Support more platforms (hp ux, aix, ...)
* Optimize performance for OpenBSD, NetBSD using `uvmexp` etc. directly
* Optimize performance for solaris, smartos using `kstat` etc. directly
* Server performance/system information (open file handles, cache sizes, number of inodes ...)

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request