<commit_before># ruby-icinga2

An enhanced ruby gem to communicate with Icinga2 API

[![Gem Version](https://badge.fury.io/rb/icinga2.svg)](https://badge.fury.io/rb/icinga2)

[![Build Status](https://travis-ci.org/bodsch/ruby-icinga2.svg)][travis]
[![Gem Downloads](http://ruby-gem-downloads-badge.herokuapp.com/icinga2)][gem-downloads]
[![total Downloads](http://ruby-gem-downloads-badge.herokuapp.com/icinga2?type=total&metric=true&label=downloads-total)][gem-downloads]
[![Dependency Status](https://gemnasium.com/badges/github.com/bodsch/ruby-icinga2.svg)][gemnasium]


[travis]: https://travis-ci.org/bodsch/ruby-icinga2
[gem-downloads]: http://ruby-gem-downloads-badge.herokuapp.com/icinga2
[gemnasium]: https://gemnasium.com/github.com/bodsch/ruby-icinga2

## Requirements

* ruby version  => 2.0
* rest-client ~> 2.0
* json  ~> 2.1
* openssl ~> 2.0 (only with ruby >= 2.3)
* ruby_dig (only with ruby < 2.3)

## Install

    gem install icinga2

## Usage

create an instance

    require 'icinga2'

    config = {
      icinga: {
        host: icinga_host,
        api: {
          port: icinga_api_port,
          username: icinga_api_user,
          password: <PASSWORD>
        }
      }
    }

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

### Use the examples

You can use the [Icinga Vagrant-Box](https://github.com/Icinga/icinga-vagrant) from the Icinga Team or
my own [Docker Container](https://hub.docker.com/r/bodsch/docker-icinga2/) as Datasource.

**Remember** Change the exported Environment Variables to your choosed Datasource!

you can find many examples under the directory `examples`:

    $ export ICINGA_HOST=localhost ; export ICINGA_API_USER=root ; export ICINGA_API_PASSWORD=<PASSWORD>
    $ ruby examples/informations.rb
    $ ruby examples/statistics.rb<commit_msg>Typo correction<commit_after># ruby-icinga2

An enhanced ruby gem to communicate with Icinga2 API

[![Gem Version](https://badge.fury.io/rb/icinga2.svg)](https://badge.fury.io/rb/icinga2)

[![Build Status](https://travis-ci.org/bodsch/ruby-icinga2.svg)][travis]
[![Gem Downloads](http://ruby-gem-downloads-badge.herokuapp.com/icinga2)][gem-downloads]
[![total Downloads](http://ruby-gem-downloads-badge.herokuapp.com/icinga2?type=total&metric=true&label=downloads-total)][gem-downloads]
[![Dependency Status](https://gemnasium.com/badges/github.com/bodsch/ruby-icinga2.svg)][gemnasium]


[travis]: https://travis-ci.org/bodsch/ruby-icinga2
[gem-downloads]: http://ruby-gem-downloads-badge.herokuapp.com/icinga2
[gemnasium]: https://gemnasium.com/github.com/bodsch/ruby-icinga2

## Requirements

* ruby version  => 2.0
* rest-client ~> 2.0
* json  ~> 2.1
* openssl ~> 2.0 (only with ruby >= 2.3)
* ruby_dig (only with ruby < 2.3)

## Install

    gem install icinga2

## Usage

create an instance

    require 'icinga2'

    config = {
      icinga: {
        host: icinga_host,
        api: {
          port: icinga_api_port,
          username: icinga_api_user,
          password: <PASSWORD>
        }
      }
    }

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

### Use the examples

You can use the [Icinga Vagrant-Box](https://github.com/Icinga/icinga-vagrant) from the Icinga Team or
my own [Docker Container](https://hub.docker.com/r/bodsch/docker-icinga2/) as Datasource.

**Remember** Change the exported Environment Variables to your choosed Datasource!

you can find many examples under the directory `examples`:

    $ export ICINGA_HOST=localhost ; export ICINGA_API_USER=root ; export ICINGA_API_PASSWORD=<PASSWORD>
    $ ruby examples/informations.rb
    $ ruby examples/statistics.rb
{'fraction_non_alphanumeric': 0.14472585583078207, 'fraction_numerical': 0.014750904536598943, 'mean_word_length': 3.8436657681940702, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 17, 'https://': 16, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 18, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6552622', 'n_tokens_mistral': 1380, 'n_tokens_neox': 1309, 'n_words': 238}