Permalink
Browse files

initial commit

  • Loading branch information...
1 parent 57476fa commit 44a4fb6bb3dd62a20ea6d01a1f4bece60aaa58ee @mbornoz mbornoz committed Dec 10, 2012
Showing with 344 additions and 3 deletions.
  1. +12 −0 Modulefile
  2. +46 −3 README.md
  3. +107 −0 manifests/init.pp
  4. +52 −0 manifests/params.pp
  5. BIN templates/.KibanaConfig.rb.erb.swp
  6. +127 −0 templates/KibanaConfig.rb.erb
View
@@ -0,0 +1,12 @@
+name 'camptocamp-kibana'
+version '0.0.1'
+source 'https://github.com/camptocamp/puppet-kibana'
+author 'DevOps Team / Camptocamp'
+license 'GNU GPLv3'
+summary 'Camptocamp Thin Module'
+description 'Thin Module for Puppet'
+project_page 'https://github.com/camptocamp/puppet-kibana'
+
+## Add dependencies, if any:
+dependency 'camptocamp/thin', '>= 0.0.1'
+dependency 'camptocamp/ruby', '>= 0.0.1'
View
@@ -1,4 +1,47 @@
-puppet-kibana
-=============
+# Kibana Puppet Module
-Manage Kibana with Puppet
+This module manages [Kibana](http://www.kibana.org) a highly scalable for [Logstash](http://logstash.net/) and [ElasticSearch](http://www.elasticsearch.org/).
+
+## Basic usage
+
+You can install kibana in different ways (see class parameter *kibana_provider*). For example directly from Github (default settings):
+
+ include kibana
+
+This way, Ruby libs required by Kibana are installed with your package management system (yum, apt).
+
+If you prefer to use gem packages (more Dev than Op :)), simply force class parameter *package_type* to 'gem':
+
+ class {'kibana': package_type => 'gem'}
+
+## Dependencies
+
+This module depends on:
+
+ * [puppet-ruby](https://github.com/camptocamp/puppet-ruby) for the management of Ruby libraries
+
+## Contributing
+
+Please report bugs and feature request using [GitHub issue
+tracker](https://github.com/camptocamp/puppet-kibana/issues).
+
+For pull requests, it is very much appreciated to check your Puppet manifest
+with [puppet-lint](https://github.com/rodjek/puppet-lint) to follow the recommended Puppet style guidelines from the
+[Puppet Labs style guide](http://docs.puppetlabs.com/guides/style_guide.html).
+
+## License
+
+Copyright (c) 2012 <mailto:puppet@camptocamp.com> All rights reserved.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
View
@@ -0,0 +1,107 @@
+# == Class: kibana
+#
+# This class installs Kibana
+#
+class kibana (
+ $ensure = $kibana::params::ensure,
+ $address = $kibana::params::host,
+ $port = $kibana::params::port,
+ $home = $kibana::params::home,
+ $user = $kibana::params::user,
+ $group = $kibana::params::group,
+ $kibana_provider = $kibana::params::kibana_provider,
+ $package_type = $kibana::params::package_type,
+ $git_revision = $kibana::params::git_revision,
+ $elasticsearch_servers = $kibana::params::elasticsearch_servers,
+ $elasticsearch_timeout = $kibana::params::elasticsearch_timeout,
+) inherits kibana::params {
+
+ include thin::params
+
+ case $package_type {
+
+ 'gem': {
+ include ruby::gem::json
+ include ruby::gem::sinatra
+ include ruby::gem::tzinfo
+ include ruby::gem::fastercsv
+ }
+
+ 'package': {
+ include ruby::package::json
+ include ruby::package::sinatra
+ include ruby::package::tzinfo
+ include ruby::package::fastercsv
+ }
+
+ default: { fail "Unsupported package type ${package_type}" }
+
+ }
+
+ # resource alias is only usable for require
+ # e.g. realize Package[tzinfo] doesn't work if 'tzinfo'
+ # is an alias, see http://projects.puppetlabs.com/issues/4459
+ Package <| alias == 'json' |>
+ Package <| alias == 'sinatra' |>
+ Package <| alias == 'tzinfo' |>
+ Package <| alias == 'fastercsv' |>
+
+ user {$user:
+ ensure => $ensure,
+ home => $home,
+ system => true,
+ }
+
+ case $kibana_provider {
+
+ 'git': {
+ vcsrepo {$home:
+ ensure => $git_revision,
+ provider => 'git',
+ source => 'git://github.com/rashidkpc/Kibana.git',
+ }
+ }
+
+ 'package': {
+ package{'kibana':
+ ensure => $ensure,
+ }
+ }
+
+ 'gem': {
+ package{'kibana':
+ ensure => $ensure,
+ provider => 'gem',
+ }
+ }
+
+ default: { fail "Unsupported kibana provider ${kibana_provider}" }
+ }
+
+ file {"${home}/KibanaConfig.rb":
+ ensure => $ensure,
+ owner => 'root',
+ group => 'root',
+ content => template('kibana/KibanaConfig.rb.erb'),
+ notify => Service[$thin::params::service],
+ require => $kibana_provider ? {
+ 'git' => Vcsrepo[$home],
+ /package|gem/ => Package['kibana'],
+ },
+ }
+
+ thin::app {'kibana':
+ ensure => $ensure,
+ chdir => $home,
+ address => $address,
+ port => $port,
+ user => $user,
+ group => $group,
+ rackup => "${home}/config.ru",
+ require => [
+ Vcsrepo[$home], User[$user], File["${home}/KibanaConfig.rb"],
+ Package['json','sinatra','tzinfo','fastercsv'],
+ ],
+ }
+
+}
View
@@ -0,0 +1,52 @@
+# == Class: kibana::params
+#
+# The Kibana configuration settings.
+#
+# === Parameters
+#
+# [*ensure*]
+# Specifies if resources are present or absent
+#
+# [*address*]
+# The $address to bind to (default localhost)
+#
+# [*port*]
+# The $port to use (default 5601)
+#
+# [*home*]
+# The $home is the directory where is installed Kibana
+#
+# [*user*]
+# The $user to run daemon as
+#
+# [*group*]
+# The $group to run daemon as
+#
+# [*kibana_provider*]
+# The $kibana_provider is the way Kibana must be installed (default git)
+#
+# [*git_revision*]
+# Set $git_revision if you need a specific version of Kibana
+#
+# [*package_type*]
+# The type of packaging system
+#
+# [*elasticsearch_servers*]
+# An array of elastic search server
+#
+# [*elasticsearch_timeout*]
+# Set the Net::HTTP read/open timeouts for the connection to the ES backend
+#
+class kibana::params {
+ $ensure = present
+ $address = 'localhost'
+ $port = '5601'
+ $home = '/opt/kibana'
+ $user = 'kibana'
+ $group = 'kibana'
+ $kibana_provider = 'git'
+ $git_revision = 'latest'
+ $package_type = 'package'
+ $elasticsearch_servers = ['localhost:9200']
+ $elasticsearch_timeout = '500'
+}
Binary file not shown.
@@ -0,0 +1,127 @@
+module KibanaConfig
+
+ # File managed by Puppet
+
+ # A Note: While the only option you really have to set is "Elasticsearch" it
+ # is HIGHLY recommended you glance over every option. I personally consider
+ # 'Facet_index_limit' really important.
+
+ # Your elastic search server(s). This may be set as an array for round robin
+ # load balancing
+ # Elasticsearch = ["elasticsearch1:9200","elasticsearch2:9200"]
+ Elasticsearch = ["<%= elasticsearch_servers.join('","') %>"]
+
+ #Set the Net::HTTP read/open timeouts for the connection to the ES backend
+ ElasticsearchTimeout = <%= @elasticsearch_timeout %>
+
+ # The port Kibana should listen on
+ KibanaPort = 5601
+
+ # The adress ip Kibana should listen on. Comment out or set to
+ # 0.0.0.0 to listen on all interfaces.
+ KibanaHost = '127.0.0.1'
+
+ # The record type as defined in your logstash configuration.
+ # Seperate multiple types with a comma, no spaces. Leave blank
+ # for all.
+ Type = ''
+
+ # Results to show per page
+ Per_page = 50
+
+ # Timezone. Leave this set to 'user' to have the user's browser autocorrect.
+ # Otherwise, set a timezone string
+ # Examples: 'UTC', 'America/Phoenix', 'Europe/Athens', MST
+ # You can use `date +%Z` on linux to get your timezone string
+ Timezone = 'user'
+
+ # Format for timestamps. Defaults to mm/dd HH:MM:ss.
+ # For syntax see: http://blog.stevenlevithan.com/archives/date-time-format
+ # Time_format = 'isoDateTime'
+ Time_format = 'mm/dd HH:MM:ss'
+
+ # Change which fields are shown by default. Must be set as an array
+ # Default_fields = ['@fields.vhost','@fields.response','@fields.request']
+ Default_fields = ['@message']
+
+ # The default operator used if no explicit operator is specified.
+ # For example, with a default operator of OR, the query capital of
+ # Hungary is translated to capital OR of OR Hungary, and with default
+ # operator of AND, the same query is translated to capital AND of AND
+ # Hungary. The default value is OR.
+ Default_operator = 'OR'
+
+ # When using analyze, use this many of the most recent
+ # results for user's query
+ Analyze_limit = 2000
+
+ # Show this many results in analyze/trend/terms/stats modes
+ Analyze_show = 25
+
+ # Show this many results in an rss feed
+ Rss_show = 25
+
+ # Show this many results in an exported file
+ Export_show = 2000
+
+ # Delimit exported file fields with what?
+ # You may want to change this to something like "\t" (tab) if you have
+ # commas in your logs
+ Export_delimiter = ","
+
+ # You may wish to insert a default search which all user searches
+ # must match. For example @source_host:www1 might only show results
+ # from www1.
+ Filter = ''
+
+ # When searching, Kibana will attempt to only search indices
+ # that match your timeframe, to make searches faster. You can
+ # turn this behavior off if you use something other than daily
+ # indexing
+ Smart_index = true
+
+ # You can define your custom pattern here for index names if you
+ # use something other than daily indexing. Pattern needs to have
+ # date formatting like '%Y.%m.%d'. Will accept an array of smart
+ # indexes.
+ # Smart_index_pattern = ['logstash-web-%Y.%m.%d', 'logstash-mail-%Y.%m.%d']
+ Smart_index_pattern = 'logstash-%Y.%m.%d'
+
+ # ElasticSearch has a default limit on URL size for REST calls,
+ # so Kibana will fall back to _all if a search spans too many
+ # indices. Use this to set that 'too many' number. By default this
+ # is set really high, ES might not like this
+ Smart_index_limit = 150
+
+ # Elasticsearch has an internal mechanism called "faceting" for performing
+ # analysis that we use for the "Stats" and "Terms" modes. However, on large
+ # data sets/queries facetting can cause ES to crash if there isn't enough
+ # memory available. It is suggested that you limit the number of indices that
+ # Kibana will use for the "Stats" and "Terms" to prevent ES crashes. For very
+ # large data sets and undersized ES clusers, a limit of 1 is not unreasonable.
+ # Default is 0 (unlimited)
+ Facet_index_limit = 0
+
+ # You probably don't want to touch anything below this line
+ # unless you really know what you're doing
+
+ # Primary field. By default Elastic Search has a special
+ # field called _all that is searched when no field is specified.
+ # Dropping _all can reduce index size significantly. If you do that
+ # you'll need to change primary_field to be '@message'
+ Primary_field = '_all'
+
+ # Default Elastic Search index to query
+ Default_index = '_all'
+
+ # TODO: This isn't functional yet
+ # Prevent wildcard search terms which result in extremely slow queries
+ # See: http:#www.elasticsearch.org/guide/reference/query-dsl/wildcard-query.html
+ Disable_fullscan = false
+
+ # Set headers to allow kibana to be loaded in an iframe from a different origin.
+ Allow_iframed = false
+
+ # Use this interval as fallback.
+ Fallback_interval = 900
+end

0 comments on commit 44a4fb6

Please sign in to comment.