Giter VIP home page Giter VIP logo

chef-handler-httpapi's Introduction

Httpapi chef handler

This is a simple Chef report handler that reports status of a Chef run to any API via net/http.

Kudos to the following chef_handlers for their inspirations:

Requirements

Tested Platform: Linux + Windows

Uses the libraries net_http, uri and openssl.

Installation

gem install chef-handler-httpapi

Usage

You can send data to an API via the http post method.

Therefore you have to define which data elements should be sent.

"api_data_message" is the name for the KEY including the message text.

"api_data_success/failed" are the HASHes you want to send as the post data (in addition to the "message" HASH).

Append the following to your Chef client configs, usually at /etc/chef/client.rb

require 'Httpapi.rb'

api_url = "https://myfanceapi/logging/object"
api_user = myfanceuser
api_pass = myfancepass

# ssl tweaks
(api_ssl_version = :SSLv3)
(api_ssl_verify = "none")

# name for data_message KEY
api_data_message = "message"

# keys and values for successful run
api_data_success = {
	"state" => "INFO",
	"class" => "chef-client"
}

# keys and values for failed run
api_data_failed = {
	"state" => "FAILED",
	"class" => "chef-client"
}

Httpapi_handler = Httpapi.new(api_url, api_user, api_pass, api_ssl_verify, api_ssl_version, api_data_message, api_data_success, api_data_failed)
report_handlers << Httpapi_handler            # run at the end of a successful run
exception_handlers << Httpapi_handler         # run at the end of a failed run

Contributing

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

License and Author

copyright: B1 Systems GmbH [email protected], 2016

license: GPLv3+, http://www.gnu.org/licenses/gpl-3.0.html

author: Eike Waldt [email protected]

chef-handler-httpapi's People

Contributors

yeoldegrove avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.