cookbook 'diamond_lwrp', '~> 0.1.3'
diamond_lwrp (3) Versions 0.1.3 Follow1
Installs/Configures diamond
cookbook 'diamond_lwrp', '~> 0.1.3', :supermarket
knife supermarket install diamond_lwrp
knife supermarket download diamond_lwrp
Description
This cookbook provides providers and resources to configure and manage Diamond Diamond is a python daemon that collects system metrics and publishes them to Graphite. It is capable of collecting cpu, memory, network, i/o, load and disk metrics. Additionally, it features an API for implementing custom collectors for gathering metrics from almost any source.
Requirements
Requires Chef 0.7.10 or higher for Lightweight Resource and Provider support. Chef 0.8+ is recommended. While this cookbook can be used in chef-solo mode, to gain the most flexibility, we recommend using chef-client with a Chef Server.
Recipes
The example recipe installs Diamond in the most basic of configurations
Installation Prefix problems
- 
diamond_collectors_pathanddiamond_installation_pathexist in the configure resource because on how you install distutils Diamond will install its collectors in/usr/local/share/diamond/collectorsinstead of/usr/share/diamond/collectors. If your OS/Distribution installs the collectors in/usr/share/diamond/collectorsyou should set this accordingly.
Feel free to submit pull requests that can improve this problem.
Default Collectors
Diamond has the following Collectors enabled by default:
Cpu, DiskSpace, DiskUsage, LoadAvg, Memory, SockStat, Vmstat.
Resources and Providers
This cookbook provides three resources and corresponding providers.
install.rb
Install Diamond with this resource.
Actions:
- 
git- Clones the source from Github and installs usingpython setup.py install
- 
deb- Clones the source from Github and installs usingmake builddeb
Attribute Parameters:
- 
name- String - non-unique name to give your installation. diamond or using#{node['hostname']}
- 
options- Hash - not required
- 
git_repository_uri- String - default -https://github.com/BrightcoveOS/Diamond.git
- 
git_reference- String - default -master
- 
required_python_packages- Hash - default -{ "configobj" => "4.7.2","psutil" => "0.6.1"}
- 
required_debian_packages- Array - default -["pbuilder","python-mock","python-configobj","cdbs"]
- 
cookbook- String - default -diamond
configure.rb
Configure Diamond with this resource.
Actions:
- 
config- Creates/etc/diamond/diamond.conf
Attribute Parameters:
- 
name- String - non-unique name to give your installation. diamond or using#{node['hostname']}
- 
cookbook- String - default -diamond
- 
options- Hash - not required
- 
diamond_installation_path- String - default -/usr/local
- 
diamond_configuration_path- String - default -/etc/diamond
- 
diamond_configuration_source- String - default -diamond.conf.erb
- 
diamond_init_source- String -diamond.erb
- 
diamond_handlers- Array -default -["diamond.handler.graphitepickle.GraphitePickleHandler"]
- 
diamond_user- String
- 
diamond_group- String
- 
diamond_pidfile- String, - default -/var/run/diamond.pid
- 
collectors_config_path- String - default -/etc/diamond/collectors/
- 
diamond_collectors_path- String - default =>/usr/local/share/diamond/collectors/
- 
collectors_reload_interval- Fixnum - default -3600
- 
archive_handler- Hash - default -{ "log_file" => "/var/log/diamond/diamond.log", "days" => 7 }
- 
graphite_handler- Hash - default -{ "host" => "localhost", "port" => 2003, "batch" => 256, "timeout" => 15 }
- 
graphite_picklehandler- Hash - default -{ "host" => "localhost", "port" => 2004, "batch" => 256, "timeout" => 15 }
- 
statsdhandler- Hash - default -{ "host" => "127.0.0.1", "port" => 8125 }
- 
tsdbhandler- Hash - default -{ "host" => "127.0.0.1", "port" => 4242, "timeout" => 15 }
- 
mysqlhandler- Hash - default -{ "host" => "127.0.0.1", "port" => 3306, "username" => String.new, "password" => String.new, "database" => "diamond", "table" => "metrics", "col_time" => "timestamp", "col_metric" => "metric", "col_value" => "value" }
- 
collectors- Hash - default -{ "hostname_method" => "fqdn_short", "hostname" => String.new, "path_prefix" => String.new, "path_suffix" => String.new, "interval" => 300 }
plugin.rb
Enable / Disable plugins with this resource.
Actions:
- 
name- String - name of plugin to enable / disable
- 
options- Hash - required - see usage
- 
source- String - default -generic_collector_config.conf.erb
- 
cookbook- String - default -diamond
- 
collectors_path- String -default/etc/diamond/collectors/
Generic Usage
The following example will just configure Diamond with the GraphiteHandler and with the default collectors enabled only.
diamond_install "#{node['hostname']}" do  
  action :git  
end  
diamond_configure "#{node['hostname']}" do   
  action :config  
  diamond_handlers [ "diamond.handler.graphite.GraphiteHandler" ]    
  graphite_handler({"host" => "127.0.0.1","port" => 2003, "timeout" => 15})  
end  
Basic Usage with Plugins
The following example will configure Diamond with the archive.ArchiveHandler and graphite.GraphiteHandler with the PingCollector and CPUCollector enabled.
diamond_install "#{node['hostname']}" do  
  action :git  
end  
diamond_configure "#{node['hostname']}" do  
  action :config  
  diamond_handlers [ "diamond.handler.archive.ArchiveHandler", "diamond.handler.graphite.GraphiteHandler" ]  
  graphite_handler({"host" => "127.0.0.1","port" => 2003, "timeout" => 15})  
end  
diamond_plugin "CPUCollector" do  
  action :enable  
  options({})  
end  
diamond_plugin "PingCollector" do  
  action :enable  
  options({  
    "enabled" => "True",  
    "bin" => "/bin/ping",  
    "use_sudo" => "False",  
    "sudo_cmd" => "/usr/bin/sudo",  
    "target_1" => "google.com",  
    "target_2" => "aol.com"  
  })  
end  
Advanced Usage with Custom Collectors Installed
diamond_install "#{node['hostname']}" do  
  action :git  
end  
diamond_configure "#{node['hostname']}" do  
  action :config  
  diamond_handlers [ "diamond.handler.archive.ArchiveHandler", "diamond.handler.graphite.GraphiteHandler" ]  
  graphite_handler({"host" => "127.0.0.1","port" => 2003, "timeout" => 15})  
end  
directory "/usr/local/share/diamond/collectors/latency_http" do  
  action :create  
end  
cookbook_file "/usr/local/share/diamond/collectors/latency_http/latency_http.py" do  
  source "latency_http.py"
  cookbook "our_custom"
end
diamond_plugin "LatencyHTTTPCollector" do  
  action :enable  
  options({  
    "enabled" => "True",  
    "target_1" => "host1.com",  
    "target_2" => "host2.com"  
  })  
end  
Author:: Scott M. Likens (scott@likens.us)
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
| python >= 0.0.0 | 
| git >= 0.0.0 | 
| build-essential >= 0.0.0 | 
Contingent cookbooks
There are no cookbooks that are contingent upon this one.
Collaborator Number Metric
        
            0.1.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.1.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.1.3 failed this metric
            FC064: Ensure issues_url is set in metadata: diamond_lwrp/metadata.rb:1
FC065: Ensure source_url is set in metadata: diamond_lwrp/metadata.rb:1
FC066: Ensure chef_version is set in metadata: diamond_lwrp/metadata.rb:1
FC067: Ensure at least one platform supported in metadata: diamond_lwrp/metadata.rb:1
FC069: Ensure standardized license defined in metadata: diamond_lwrp/metadata.rb:1
FC074: LWRP should use DSL to define resource's default action: diamond_lwrp/resources/configure.rb:1
FC074: LWRP should use DSL to define resource's default action: diamond_lwrp/resources/install.rb:1
FC074: LWRP should use DSL to define resource's default action: diamond_lwrp/resources/plugin.rb:1
FC085: Resource using new_resource.updated_by_last_action to converge resource: diamond_lwrp/providers/configure.rb:37
FC085: Resource using new_resource.updated_by_last_action to converge resource: diamond_lwrp/providers/install.rb:46
FC085: Resource using new_resource.updated_by_last_action to converge resource: diamond_lwrp/providers/install.rb:89
FC085: Resource using new_resource.updated_by_last_action to converge resource: diamond_lwrp/providers/plugin.rb:12
FC085: Resource using new_resource.updated_by_last_action to converge resource: diamond_lwrp/providers/plugin.rb:21
FC109: Use platform-specific package resources instead of provider property: diamond_lwrp/providers/install.rb:78
FC121: Cookbook depends on cookbook made obsolete by Chef 14: diamond_lwrp/metadata.rb:1
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
        
      No Binaries Metric
        
            0.1.3 passed this metric
        
      Testing File Metric
        
            0.1.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.1.3 passed this metric
        
  
0.1.3 failed this metric
            0.1.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.1.3 failed this metric
            FC064: Ensure issues_url is set in metadata: diamond_lwrp/metadata.rb:1
FC065: Ensure source_url is set in metadata: diamond_lwrp/metadata.rb:1
FC066: Ensure chef_version is set in metadata: diamond_lwrp/metadata.rb:1
FC067: Ensure at least one platform supported in metadata: diamond_lwrp/metadata.rb:1
FC069: Ensure standardized license defined in metadata: diamond_lwrp/metadata.rb:1
FC074: LWRP should use DSL to define resource's default action: diamond_lwrp/resources/configure.rb:1
FC074: LWRP should use DSL to define resource's default action: diamond_lwrp/resources/install.rb:1
FC074: LWRP should use DSL to define resource's default action: diamond_lwrp/resources/plugin.rb:1
FC085: Resource using new_resource.updated_by_last_action to converge resource: diamond_lwrp/providers/configure.rb:37
FC085: Resource using new_resource.updated_by_last_action to converge resource: diamond_lwrp/providers/install.rb:46
FC085: Resource using new_resource.updated_by_last_action to converge resource: diamond_lwrp/providers/install.rb:89
FC085: Resource using new_resource.updated_by_last_action to converge resource: diamond_lwrp/providers/plugin.rb:12
FC085: Resource using new_resource.updated_by_last_action to converge resource: diamond_lwrp/providers/plugin.rb:21
FC109: Use platform-specific package resources instead of provider property: diamond_lwrp/providers/install.rb:78
FC121: Cookbook depends on cookbook made obsolete by Chef 14: diamond_lwrp/metadata.rb:1
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
        
      No Binaries Metric
        
            0.1.3 passed this metric
        
      Testing File Metric
        
            0.1.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.1.3 passed this metric
        
  
0.1.3 failed this metric
FC065: Ensure source_url is set in metadata: diamond_lwrp/metadata.rb:1
FC066: Ensure chef_version is set in metadata: diamond_lwrp/metadata.rb:1
FC067: Ensure at least one platform supported in metadata: diamond_lwrp/metadata.rb:1
FC069: Ensure standardized license defined in metadata: diamond_lwrp/metadata.rb:1
FC074: LWRP should use DSL to define resource's default action: diamond_lwrp/resources/configure.rb:1
FC074: LWRP should use DSL to define resource's default action: diamond_lwrp/resources/install.rb:1
FC074: LWRP should use DSL to define resource's default action: diamond_lwrp/resources/plugin.rb:1
FC085: Resource using new_resource.updated_by_last_action to converge resource: diamond_lwrp/providers/configure.rb:37
FC085: Resource using new_resource.updated_by_last_action to converge resource: diamond_lwrp/providers/install.rb:46
FC085: Resource using new_resource.updated_by_last_action to converge resource: diamond_lwrp/providers/install.rb:89
FC085: Resource using new_resource.updated_by_last_action to converge resource: diamond_lwrp/providers/plugin.rb:12
FC085: Resource using new_resource.updated_by_last_action to converge resource: diamond_lwrp/providers/plugin.rb:21
FC109: Use platform-specific package resources instead of provider property: diamond_lwrp/providers/install.rb:78
FC121: Cookbook depends on cookbook made obsolete by Chef 14: diamond_lwrp/metadata.rb:1
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
            0.1.3 passed this metric
        
      Testing File Metric
        
            0.1.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.1.3 passed this metric
        
  
0.1.3 failed this metric
            0.1.3 passed this metric