cookbook 'splunkstorm', '~> 0.0.3'
splunkstorm (3) Versions 0.0.3 Follow5
Installs/Configures Splunk Storm forwarders
cookbook 'splunkstorm', '~> 0.0.3', :supermarket
knife supermarket install splunkstorm
knife supermarket download splunkstorm
Description
This little Chef Cookbook provides recipes and definitions to install Splunk Forwarders and setup monitors for Splunk Storm.
As you know, Splunk Storm uses a proprietary credentials file to setup access to the Splunk Storm servers/account.
You probably won't want to have this file floating around in your cookbook unencrypted, so we're going to stuff the contents of the credentials file into a Secure Databag.
To do that, you'll need to:
-
Create the data bag using knife (or whatever process you usually take)
knife data bag create licenses storm --secret-file ~/.chef/encrypted_data_bag_secret
-
Open
irb
and run the following script (make sure you update the variables to suit your setup)require 'base64' require 'chef' data_bag = "licenses" data_bag_key = "storm" license_file = "stormforwarder_XXXXXXXX.spl" Chef::Config.from_file("#{ENV['HOME']}/.chef/knife.rb") c = Chef::DataBagItem.load(data_bag, data_bag_key) contents = [File.open(license_file, "rb") {|io| io.read}].pack("m") c['data'] = contents c['filename'] = license_file c.save
-
You'll probably want to check-in your databag into your SCM
knife data bag show licenses storm -Fj > data_bags/licenses/storm.json
If you need to get the credentials out of the databag and into an actual file (note: the cookbook takes care of this for you), you can run this command in irb
require 'base64'
require 'chef'
data_bag = "licenses"
data_bag_key = "storm"
Chef::Config.from_file("#{ENV['HOME']}/.chef/knife.rb")
c = Chef::DataBagItem.load(data_bag, data_bag_key)
File.open(c['filename'], "wb") do |file|
file.write(c['data'].unpack('m').first)
end
Changes
- v0.0.1 - Initial Release
Current Bugs
- Very beta - only tested in Ubuntu 12.04
Requirements
Platform:
Ubuntu, Debian, RedHat, CentOS, Fedora
This cookbook has only been tested thoroughly with Ubuntu
Attributes
See attributes/default.rb
for default values.
-
node['splunkstorm']['cookbook_name']
- The name of the directory in which the cookbook runs. -
node['splunkstorm']['forwarder_home']
- The directory in which to install the Splunk Forwarder -
node['splunkstorm']['auth']
- The default admin password to use instead of splunks "changeme" -
node['splunkstorm']['forwarder_root']
- The base URL that splunk uses to download release files for Splunk Forwarder -
node['splunkstorm']['forwarder_version']
- The specific version of Splunk Forwarder to download -
node['splunkstorm']['forwarder_build]
- The specific build number of Splunk Forwarder to download
Recipes
splunkstorm
Installs Splunk Forwarder for Storm.
- You need to setup data bags with your Splunk Storm credentials. Check out this gist for details: https://gist.github.com/3384786
Usage
Splunk Storm Forwarder Install:
This will install the Splunk Forwarder:
recipe[splunkstorm]
Resources and Providers
To add and remove monitors you can use the splunkstorm_monitor
provider:
include_recipe "splunkstorm"
# monitor the log directory in Splunk Storm
splunkstorm_monitor "/var/log" do
path "/var/log/*.log"
action :add
end
# remove the log directory monitor in Splunk Storm
splunkstorm_monitor "/var/log" do
path "/var/log/*.log"
action :remove
end
License and Author
Author:: Aaron Wallis (aaron.wallis@lexer.com.au)
Copyright 2012-2013, Lexer Pty Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Dependent cookbooks
This cookbook has no specified dependencies.
Contingent cookbooks
There are no cookbooks that are contingent upon this one.
Collaborator Number Metric
0.0.3 failed this metric
Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.
Contributing File Metric
0.0.3 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
0.0.3 failed this metric
FC016: LWRP does not declare a default action: splunkstorm/resources/monitor.rb:1
FC064: Ensure issues_url is set in metadata: splunkstorm/metadata.rb:1
FC065: Ensure source_url is set in metadata: splunkstorm/metadata.rb:1
FC066: Ensure chef_version is set in metadata: splunkstorm/metadata.rb:1
FC069: Ensure standardized license defined in metadata: splunkstorm/metadata.rb:1
FC104: Use the :run action in ruby_block instead of :create: splunkstorm/recipes/default.rb:77
FC109: Use platform-specific package resources instead of provider property: splunkstorm/recipes/default.rb:49
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
No Binaries Metric
0.0.3 passed this metric
Testing File Metric
0.0.3 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
0.0.3 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
0.0.3 failed this metric
0.0.3 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
0.0.3 failed this metric
FC016: LWRP does not declare a default action: splunkstorm/resources/monitor.rb:1
FC064: Ensure issues_url is set in metadata: splunkstorm/metadata.rb:1
FC065: Ensure source_url is set in metadata: splunkstorm/metadata.rb:1
FC066: Ensure chef_version is set in metadata: splunkstorm/metadata.rb:1
FC069: Ensure standardized license defined in metadata: splunkstorm/metadata.rb:1
FC104: Use the :run action in ruby_block instead of :create: splunkstorm/recipes/default.rb:77
FC109: Use platform-specific package resources instead of provider property: splunkstorm/recipes/default.rb:49
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
No Binaries Metric
0.0.3 passed this metric
Testing File Metric
0.0.3 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
0.0.3 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
0.0.3 failed this metric
FC064: Ensure issues_url is set in metadata: splunkstorm/metadata.rb:1
FC065: Ensure source_url is set in metadata: splunkstorm/metadata.rb:1
FC066: Ensure chef_version is set in metadata: splunkstorm/metadata.rb:1
FC069: Ensure standardized license defined in metadata: splunkstorm/metadata.rb:1
FC104: Use the :run action in ruby_block instead of :create: splunkstorm/recipes/default.rb:77
FC109: Use platform-specific package resources instead of provider property: splunkstorm/recipes/default.rb:49
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
0.0.3 passed this metric
Testing File Metric
0.0.3 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
0.0.3 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
0.0.3 failed this metric
0.0.3 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number