Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 2 days ago
JSON representation
A focused and fast library to gather memory, cpu, network, load avg and disk information
- Host: GitHub
- URL: https://github.com/threez/ruby-vmstat
- Owner: threez
- License: mit
- Created: 2012-09-29T18:36:48.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2022-09-09T08:26:31.000Z (over 2 years ago)
- Last Synced: 2025-01-25T12:06:57.217Z (10 days ago)
- Topics: cpu, disk, freebsd, linux, macosx, netbsd, openbsd, ruby, smartos, solaris, vmstat
- Language: Ruby
- Homepage: http://threez.github.com/ruby-vmstat/
- Size: 158 KB
- Stars: 71
- Watchers: 5
- Forks: 14
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
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