Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions cookbooks/main/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,6 @@
# postgresql9_pg_buffercache "postgres"
# postgresql9_pg_freespacemap "postgres"
#end

# Install Treasure Data Agent
require_recipe "td-agent"
44 changes: 44 additions & 0 deletions cookbooks/td-agent/README.rdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
= DESCRIPTION:

{Opscode Chef}[http://www.opscode.com/chef/] cookbook for td-agent (Treasure Data Agent). The release log of td-agent is available {here}[http://help.treasure-data.com/kb/installing-td-agent-daemon/changelog-of-td-agent].

NOTE: td-agent is open-sourced as {Fluentd project}[http://github.com/fluent/]. If you want to use stable version of Fluentd, using this cookbook is recommended.

= INSTALLATION:

The {knife-github-cookbooks}[https://github.com/websterclay/knife-github-cookbooks] gem is a plugin for knife that supports installing cookbooks directly from a GitHub repository. To install with this plugin, please follow these steps:

$ gem install knife-github-cookbooks
$ cd chef-repo
$ knife cookbook github install treasure-data/chef-td-agent

= REQUIREMENTS:

This cookbook has these external dependencies.

- apt cookbook
- yum cookbook

= ATTRIBUTES:

API Key, and the Secret Key are required.

- node[:td_agent][:api_key] (required)

= USAGE:

This is an example role file.

name "base"
description "base server role."
run_list(
"recipe[apt]",
"recipe[yum]",
"recipe[td-agent]",
)
override_attributes(
# for td-agent
:td_agent => {
:api_key => 'foo_bar_buz',
}
)
2 changes: 2 additions & 0 deletions cookbooks/td-agent/attributes/default.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# my testing key - will be deleted before merging the pull request
td_agent_api_key("1f157707e42fe82016b32b01aa884bfc8a3b9054")
19 changes: 19 additions & 0 deletions cookbooks/td-agent/metadata.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
maintainer "Treasure Data, Inc."
maintainer_email "k@treasure-data.com"
license "All rights reserved"
description "Installs/Configures td-agent"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
version "0.0.1"
recipe "td-agent", "td-agent configuration"

%w{redhat centos debian ubuntu}.each do |os|
supports os
end

depends 'apt'
depends 'yum'

attribute "td_agent/api_key",
:display_name => "Treasure Data ApiKey",
:description => "ApiKey for Treasure Data Service",
:default => ''
68 changes: 68 additions & 0 deletions cookbooks/td-agent/recipes/default.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#
# Cookbook Name:: td-agent
# Recipe:: default
#
# Copyright 2011, Treasure Data, Inc.
#

td_api_key = node[:td_agent_api_key]

ey_cloud_report "Installing Treasure Data Agent" do
message "installing Treasure Data Agent"
end

#group 'td-agent' do
#group_name 'td-agent'
#gid 403
#action :create
#end

#user 'td-agent' do
#comment 'td-agent'
#uid 403
#group 'td-agent'
#home '/var/run/td-agent'
#shell '/bin/false'
#password nil
#supports :manage_home => true
#action :create, :manage
#end

directory "/etc/td-agent/" do
owner node[:owner_name]
group node[:owner_name]
mode 0755
action :create
end

#case node['platform']
#when "ubuntu"
#dist = node['lsb']['codename']
#source = (dist == 'precise') ? "http://packages.treasure-data.com/precise/" : "http://packages.treasure-data.com/debian/"
#apt_repository "treasure-data" do
#uri source
#distribution dist
#components ["contrib"]
#action :add
#end
#when "centos", "redhat"
#yum_repository "treasure-data" do
#url "http://packages.treasure-data.com/redhat/$basearch"
#action :add
#end
#end

template "/etc/td-agent/td-agent.conf" do
mode "0644"
source "td-agent.conf.erb"
end

#package "td-agent" do
#options "-f --force-yes"
#action :upgrade
#end

#service "td-agent" do
#action [ :enable, :start ]
#subscribes :restart, resources(:template => "/etc/td-agent/td-agent.conf")
#end
22 changes: 22 additions & 0 deletions cookbooks/td-agent/templates/default/td-agent.conf.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Source descriptions
## built-in TCP input
<source>
type tcp
port 24224
</source>

## HTTP input
<source>
type http
port 8888
</source>

# Match descriptions
## Treasure Data output
## match events whose tag is td.DATABASE.TABLE
<match td.*.*>
type tdlog
apikey <%= @td_agent_api_key%>
buffer_type file
buffer_path /var/log/td-agent/buffer/td
</match>