Skip to content
This repository was archived by the owner on Dec 31, 2021. It is now read-only.

Newer, better, faster and possibly stronger. #29

Open
wants to merge 55 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
5db2a92
Rewrites the collectd cookbook to utilize Poise.
May 26, 2015
a5f4ae7
Fixes unit tests so that they go green.
Sep 1, 2015
e66b42c
Fixes linting errors which Rubocop found.
Sep 1, 2015
d2900ae
Fixes issue where poise_service_user runs if set root.
Sep 2, 2015
8be8432
Removes the client/server recipes.
Sep 2, 2015
aa4d08b
Updates the collectd service options in resource.
Sep 2, 2015
757d9f6
Removes the web recipe from the cookbook.
Sep 2, 2015
ff5d3bf
Removes old default attributes no longer necessary.
Sep 2, 2015
598dd73
Fixes helper to properly build nested configs.
Sep 2, 2015
4a7129d
Fixes rubocop linting errors found in travis.
Sep 2, 2015
92094a0
Adds collectd configuration resource.
Sep 9, 2015
be8c0d6
Fixes rubocop linting error in travis.
Sep 9, 2015
dd00574
Set directory permissions and collectd plugin dir correctly
sh9189 Sep 8, 2015
d225b3a
Change directory permission, fix minor bugs
sh9189 Sep 9, 2015
b953567
Change lib directory
sh9189 Sep 9, 2015
11ba4aa
Rebase on latest master
sh9189 Sep 9, 2015
76c4bb2
Use lazy evaluation of collectd conf, dup to copy directives hash
sh9189 Sep 11, 2015
dae8640
Merge pull request #1 from sh9189/CollectdDirChanges
johnbellone Sep 11, 2015
877b4f3
Updates travis configuration for containers.
Sep 14, 2015
0638ec5
Adds an exclusion for vendor to Rubocop.
Sep 14, 2015
a9072e3
Adds default environment hash.
Sep 23, 2015
565e0a6
Fixes issue where sub-directory doesn't exist.
Sep 25, 2015
f4acb5b
Fixes problem with root_user attribute not existing.
Sep 25, 2015
f3905e6
Adds string interpolation on source url.
Sep 25, 2015
8659836
Fixes syntax error in the recipe.
Sep 25, 2015
ee43609
Bumps version of the recipe.
Sep 25, 2015
d19e7c7
Adds a recursive creation to directories.
Sep 25, 2015
29e9ffd
Fixes issue with sending attributes to resource.
Sep 25, 2015
8febcf8
Adds default attribute for collectd plugin directory.
Sep 25, 2015
5bfe3c3
Adds environment to the service options.
Sep 25, 2015
2677d09
Fixes some issues found during testing locally.
Sep 25, 2015
bb0d438
Removes explicit action for package upgrade.
Oct 1, 2015
b683516
Modifies package resource to perform an upgrade.
Oct 19, 2015
d229005
Uses the solaris package provider instead of ips.
Oct 21, 2015
2b542f9
Bumps version of the cookbook.
Oct 21, 2015
793d874
Use admin file for solaris package
sh9189 Oct 21, 2015
0d3d934
Fix rubocop issues
sh9189 Oct 21, 2015
78d9255
Merge pull request #3 from sh9189/solaris_packager_fix
johnbellone Oct 21, 2015
4fdac4a
Use standard solaris provider
sh9189 Oct 23, 2015
c8df304
Merge pull request #4 from sh9189/use_bloomberg_solaris_provider
johnbellone Oct 25, 2015
758be27
Fixes issue where Solaris package isn't removed first.
Nov 20, 2015
cb2e114
Use upgrade action for solaris provider,restart collectd on updates
sh9189 Nov 23, 2015
3183d2d
Merge pull request #5 from sh9189/solaris_upgrade
johnbellone Nov 24, 2015
63b7228
Multi value configuration need to be on separate lines
yogeswaran Dec 11, 2015
c725b05
Increment version
yogeswaran Dec 11, 2015
68e66c3
replaced for each with a map
yogeswaran Dec 11, 2015
a5f5779
Merge pull request #6 from yogeswaran/multivalueconfigs
johnbellone Dec 12, 2015
0d97e89
Updates the repository template configuration files.
Dec 17, 2015
a843283
Updates the metadata url for source and issues.
Dec 17, 2015
852f098
added support for template configuration file
yogeswaran Dec 18, 2015
388bb3d
fixed merge conflicts
yogeswaran Dec 18, 2015
a43cd10
fixed broken test case
yogeswaran Dec 18, 2015
2449cb2
fixed rubocop errors
yogeswaran Dec 18, 2015
16d05c7
fix brokern test case again
yogeswaran Dec 18, 2015
5c6e281
Merge pull request #7 from yogeswaran/jmx
johnbellone Dec 18, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Gemfile export-ignore
Berksfile export-ignore
Vagrantfile export-ignore
Thorfile export-ignore
Guardfile export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.gitmodules export-ignore
57 changes: 56 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,57 @@
metadata.json
# Ignore docs files
_gh_pages
_site
.ruby-version
.node-version
Gemfile.lock

# Numerous always-ignore extensions
*.diff
*.err
*.orig
*.log
*.rej
*.swo
*.swp
*.zip
*.vi
*~

# OS or Editor folders
.DS_Store
._*
Thumbs.db
.cache
.project
.settings
.tmproj
*.esproj
nbproject
*.sublime-project
*.sublime-workspace
.idea

# Komodo
*.komodoproject
.komodotools

# grunt-html-validation
validation-status.json
validation-report.json

# Folders to ignore
bin
node_modules
tmp
vendor
.bundle

# Chef specifics to ignore
.chef
.chefdk
.kitchen
.vagrant
Berksfile.lock
coverage/
Policyfile.lock.json
nodes/
19 changes: 19 additions & 0 deletions .kitchen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
driver:
name: vagrant

provisioner:
name: chef_zero

platforms:
- name: ubuntu-14.04
- name: ubuntu-12.04
- name: ubuntu-10.04
- name: centos-7.1
- name: centos-6.7
- name: centos-5.11

suites:
- name: default
run_list:
- recipe[collectd::default]
2 changes: 2 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--default-path test/spec
--color
43 changes: 43 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
AllCops:
Exclude:
- 'Guardfile'
- 'Rakefile'
- 'Vagrantfile'
- 'Policyfile.rb'
- 'Berksfile'
- 'Thorfile'
- 'Gemfile'
- 'test/**/*'
- 'bin/**'
- 'vendor/**/*'
AlignParameters:
Enabled: false
ClassLength:
Enabled: false
CyclomaticComplexity:
Enabled: false
Documentation:
Enabled: false
Encoding:
Enabled: false
Style/FileName:
Enabled: false
LineLength:
Enabled: false
MethodLength:
Enabled: false
Metrics/AbcSize:
Enabled: false
PerceivedComplexity:
Enabled: false
SingleSpaceBeforeFirstArg:
Enabled: false
Style/ClassAndModuleChildren:
Enabled: false
Style/FileName:
Enabled: false
Style/GuardClause:
Enabled: false
Style/PercentLiteralDelimiters:
Enabled: false
14 changes: 14 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
language: ruby
sudo: false
notifications:
slack: bloomberg-rnd:eHp3Czg42iGzaTgG8sAFeD9v
script: bundle exec rake travis
rvm:
- 2.1
- 2.2
branches:
only:
- master
matrix:
fast_finish: true
5 changes: 5 additions & 0 deletions .yardopts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
--plugin classmethods
--embed-mixin ClassMethods
--hide-api private
--markup markdown
--hide-void-return
2 changes: 2 additions & 0 deletions Berksfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
source 'https://supermarket.chef.io'
metadata
44 changes: 44 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
source 'https://rubygems.org'
gem 'poise', '~> 2.2'
gem 'poise-service', '~> 1.0'
gem 'poise-boiler'

group :lint do
gem 'rubocop'
gem 'foodcritic'
end

group :kitchen_common do
gem 'test-kitchen', '~> 1.4'
end

group :kitchen_vagrant do
gem 'kitchen-vagrant', '~> 0.19'
end

group :kitchen_cloud do
gem 'kitchen-openstack', '~> 1.8'
end

group :unit do
gem 'berkshelf'
gem 'chefspec'
end

group :integration do
gem 'serverspec'
end

group :development do
gem 'awesome_print'
gem 'guard'
gem 'guard-kitchen'
gem 'guard-rspec'
gem 'guard-rubocop'
gem 'rake'
gem 'stove'
end

group :doc do
gem 'yard'
end
21 changes: 21 additions & 0 deletions Guardfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
guard 'foodcritic', cookbook_paths: '.', cli: '-t ~FC023 -t ~FC005', all_on_start: false do
watch(%r{^(?:recipes|libraries|providers|resources)/.+\.rb$})
watch('metadata.rb')
end

# More info at https://github.com/guard/guard#readme
guard 'rubocop' do
watch(%r{^attributes/.+\.rb$})
watch(%r{^providers/.+\.rb$})
watch(%r{^recipes/.+\.rb$})
watch(%r{^resources/.+\.rb$})
watch(%r{^libraries/.+\.rb$})
watch('metadata.rb')
end

guard :rspec, cmd: 'bin/rspec', all_on_start: false, notification: false do
watch(%r{^(recipes|libraries|providers|resources)/(.+)\.rb$}) do |m|
"test/spec/#{m[0]}/#{m[1]}_spec.rb"
end
watch('test/spec/spec_helper.rb') { 'test/spec' }
end
14 changes: 14 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Copyright 2010, Atari, Inc
Copyright 2015, Bloomberg Finance L.P.

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.
144 changes: 59 additions & 85 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,92 +1,66 @@
# DESCRIPTION #

Configure and install the [collectd](http://collectd.org/) monitoring daemon.

# REQUIREMENTS #

This cookbook has only been tested on Ubuntu 10.04.

To use the `collectd::collectd_web` recipe you need the [apache2](https://github.com/opscode/cookbooks/tree/master/apache2) cookbook.

The [collectd_plugins](https://github.com/coderanger/chef-collectd_plugins) cookbook is not required, but provides many common plugin definitions for easy reuse.

# ATTRIBUTES #

* collectd.basedir - Base folder for collectd output data.
* collectd.plugin_dir - Base folder to find plugins.
* collectd.types_db - Array of files to read graph type information from.
* collectd.interval - Time period in seconds to wait between data reads.

* collectd.collectd_web.path - Location to install collectd_web to. Defaults to /srv/collectd_web.
* collectd.collectd_web.hostname - Server name to use for collectd_web Apache site.

# USAGE #

Three main recipes are provided:

* collectd - Install a standalone daemon.
* collectd::client - Install collectd and configure it to send data to a server.
* collectd::server - Install collectd and configure it to recieve data from clients.

The client recipe will use the search index to automatically locate the server hosts, so no manual configuration is required.

## Defines ##

Several defines are provided to simplfy configuring plugins

### collectd_plugin ###

The `collectd_plugin` define configures and enables standard collect plugins. Example:

```ruby
collectd_plugin "interface" do
options :interface=>"lo", :ignore_selected=>true
end
```

The options hash is converted to collectd-style settings automatically. Any symbol key will be converted to camel-case. In the above example :ignore_selected will be output as the
key "IgnoreSelected". If the key is already a string, this conversion is skipped. If the value is an array, it will be output as a separate line for each element.

### collectd_python_plugin ###

The `collectd_python_plugin` define configures and enables Python plugins using the collectd-python plugin. Example:

# collectd-cookbook
[![Build Status](https://img.shields.io/travis/coderanger/chef-collectd.svg)](https://travis-ci.org/coderanger/chef-collectd)
[![Gem Version](https://img.shields.io/gem/v/poise.svg)](https://rubygems.org/gems/poise)
[![Cookbook Version](https://img.shields.io/cookbook/v/poise.svg)](https://supermarket.chef.io/cookbooks/poise)
[![Coverage](https://img.shields.io/codecov/c/github/coderanger/chef-collectd.svg)](https://codecov.io/github/coderanger/chef-collectd)
[![Gemnasium](https://img.shields.io/gemnasium/coderanger/chef-collectd.svg)](https://gemnasium.com/coderanger/chef-collectd)
[![License](https://img.shields.io/badge/license-Apache_2-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)

[Application cookbook][0] which installs and configures the
[collectd monitoring daemon][1].

This cookbook provides a dead-simple installation and configuration of
the collectd monitoring daemon. It provides two resources: the first
is for managing the collectd system service, and the second is for
configuring the daemon's plugins. Additionally, the
[collectd_plugins cookbook][4] may be used to configure many of the
common plugins that ship with the daemon.

It is very important to note that distributions may ship different
major versions of the package, but the following platforms are tested
using the integration tests via [Test Kitchen][2].
- Ubuntu ~> 10.04, 12.04, 14.04
- CentOS ~> 5.8, 6.4, 7.1
- RHEL ~> 5.8, 6.4, 7.1

## Basic Usage
The [default recipe](recipes/default.rb) in this cookbook simply
configures the monitoring daemon to run as a system service. The
configuration for this service can be tuned using the
[node attributes](attributes/default.rb). Additionally, a resource is
provided to configure plugins for the daemon. After a plugin has been
configured the daemon should be restarted.

### Enabling Syslog
One of the simplest plugins to enable is the [collectd Syslog plugin][3]
which receives log messages from the daemon and dispatches them to the
to syslog. This allows the daemon's logs to easily integrate with
existing UNIX utilities.
```ruby
collectd_python_plugin "redis" do
options :host=>servers, :verbose=>true
collectd_plugin 'syslog' do
options do
log_level 'info'
notify_level 'OKAY'
end
end
```

Options are interpreted in the same way as with `collectd_plugin`. This define will not deploy the plugin script as well, so be sure to setup a cookbook_file resource
or other mechanism to handle distribution. Example:

## Advanced Usage
In order to enable the full functionality of some of the more
intrusive collectd plugins the daemon will need to run as the root
user. Since this is obviously a security risk it is not the default.
To achieve this behavior you're required to write a
[wrapper cookbook][5] which overrides the service user with the proper
root user.
```ruby
cookbook_file File.join(node[:collectd][:plugin_dir], "redis.py") do
owner "root"
group "root"
mode "644"
end
node.default['collectd']['service_user'] = node['root_user']
node.default['collectd']['service_group'] = node['root_group']
include_recipe 'collectd::default'
```

## Web frontend ##

The `collectd::collectd_web` recipe will automatically deploy the [collectd_web](https://github.com/httpdss/collectd-web) frontend using Apache. The
[apache2](https://github.com/opscode/cookbooks/tree/master/apache2) cookbook is required for this and is *not* included automatically as this is an optional
component, so be sure to configure the node with the correct recipes.

# LICENSE & AUTHOR #

Author:: Noah Kantrowitz (<[email protected]>)
Copyright:: 2010, Atari, Inc

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.
[0]: http://blog.vialstudios.com/the-environment-cookbook-pattern#theapplicationcookbook
[1]: https://collectd.org
[2]: https://github.com/test-kitchen/test-kitchen
[3]: https://collectd.org/wiki/index.php/Plugin:SysLog
[4]: https://github.com/coderanger/chef-collectd_plugins
[5]: http://blog.vialstudios.com/the-environment-cookbook-pattern/#thewrappercookbook
Loading