Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Munin node client for Ruby

tree: dff8a3ac29

Fetching latest commit…

Cannot retrieve the latest commit at this time

README.rdoc

Munin-Ruby

Munin-ruby is a ruby client library to fetch information from Munin node server.

Installation

NOTE: This gem is not published yet

gem install munin-ruby

Usage

require 'munin-ruby'

# connect to 'hostname' on 4949 port and fetch all available services
node = Munin::Node.new('hostname')

# connect to 'hostname' on specified port and fetch all available services
node = Munin::Node.new('hostname', :port => YOUR_PORT)

# connect to 'hostname' and fetch only specified services
# node: non-existent services will be skipped with no error triggered
# :fetch might be array or string
node = Munin::Node.new('hostname', :fetch => 'cpu memory nginx')

# error Munin::AccessDenied will be triggered if your IP is not present in allowed ip's list

Get munin-node version:

node.version

# => "1.2.6"

Get fetch timestamp:

node.timestamp

# => Sat Feb 19 15:29:51 -0600 2011

List list of fetched services:

node.services

# => ["cpu", "df", "df_inode", "entropy", "forks", "if_err_eth0", "if_err_eth1", "if_eth0", "if_eth1", "interrupts", "iostat", "irqstats", "load", "memory", "mysql_bytes", "mysql_queries", "mysql_slowqueries", "mysql_threads", "open_files", "open_inodes", "postfix_mailqueue", "postfix_mailvolume", "processes", "swap", "vmstat"]

Get service information:

stat = node.service('memory')

# => #<Munin::Stat:0xb7822258 @name="cpu", @params={"idle"=>"9453362032", "system"=>"2387507", "iowait"=>"20168544", "nice"=>"16044", "softirq"=>"54746", "irq"=>"65", "user"=>"6782755"}>

stat.params['idle']     # => 9453362032
stat.params['system']   # => 2387507

Copyright

Copyright © 2011 Dan Sosedoff.

Something went wrong with that request. Please try again.