ruby-icinga2

Ruby Class for the Icinga2 API

Requirements

  • ruby version ~> 2.3
  • rest-client ~> 2.0
  • openssl ~> 2.0
  • json ~> 2.1

install

gem install icinga2

usage

create an instance

config = {
  :icinga => {
    :host      => icingaHost,
    :api       => {
      :port => icingaApiPort,
      :user => icingaApiUser,
      :pass => icingaApiPass
    },
    :cluster   => icingaCluster,
    :satellite => icingaSatellite,
  }
}

@icinga = Icinga::Client.new( config )

Status

supports the following API Calls:

create a own gem File

#$ gem build icinga2.gemspec
Successfully built RubyGem
Name: icinga2
Version: 0.6.0
File: icinga2-0.6.0.gem

install gem

#$ gem install icinga2
Successfully installed icinga2-0.6.0
1 gem installed

test via CLI

#$ irb
2.3.0 :001 > require 'icinga2'
 => true
2.3.0 :002 > config = { :icinga => { :host => 'localhost', :api => { :user => 'root', :pass => 'icinga' } } }
 => {:icinga=>{:host=>"localhost", :api=>{:user=>"root", :pass=>"icinga"}}}
2.3.0 :003 > i = Icinga2::Client.new( config )

test via example

#$ export ICINGA_HOST=localhost ; export ICINGA_API_USER=root ; export ICINGA_API_PASSWORD=icinga
#$ ruby examples/test.rb

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