Initial mon_thresh cookbook

This commit is contained in:
Tim Kuhlman 2014-03-14 17:14:43 -06:00
commit dbb0d972e5
5 changed files with 184 additions and 0 deletions

31
README.md Normal file
View File

@ -0,0 +1,31 @@
mon_thresh Cookbook
===================
Requirements
------------
No special requirements at this time
Attributes
----------
<table>
<tr>
<th>Key</th>
<th>Type</th>
<th>Description</th>
<th>Default</th>
</tr>
<tr>
<td><tt>[:mon_thresh][:data_bag]</tt></td>
<td>String</td>
<td>Data bag to use</td>
<td><tt>mon_thresh</tt></td>
</tr>
</table>
Data Bags
---------
The node[:mon_thresh][:data_bag] data bag is used for all items.
The following data bag items are used:
- thresh - Holds basic configuration details of the threshold engine

3
attributes/default.rb Normal file
View File

@ -0,0 +1,3 @@
default[:mon_thresh][:data_bag] = 'mon_thresh'
default[:mon_thresh][:log_dir] = '/var/log/mon-thresh'

7
metadata.rb Normal file
View File

@ -0,0 +1,7 @@
name 'mon_thresh'
maintainer "Monitoring Team"
maintainer_email "hpcs-mon@hp.com"
license 'All rights reserved'
description 'Installs/Configures mon_thresh'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.1.0'

35
recipes/default.rb Normal file
View File

@ -0,0 +1,35 @@
# The user/group thresh are created by the package, as well as /etc/mon/
package 'mon-thresh' do #The package depends on openjdk-7-jre-headless
action :upgrade
end
service 'mon-thresh' do
action :enable
provider Chef::Provider::Service::Upstart
end
# Create the log file directory
directory node[:mon_thresh][:log_dir] do
action :create
recursive true
owner 'thresh'
group 'thresh'
mode 0755
end
# todo - I need an encrypted credentials data bag
credentials = { 'mysql' => { 'user' => 'thresh', 'password' => 'password'}}
settings = data_bag_item(node[:mon_thresh][:data_bag], 'mon_thresh')
template '/etc/mon/mon-thresh-config.yml' do
action :create
owner 'root'
group 'thresh'
mode '640'
source 'mon-thresh-config.yml.erb'
variables(
:credentials => credentials,
:settings => settings
)
notifies :restart, "service[mon-thresh]"
end

View File

@ -0,0 +1,108 @@
metricSpoutThreads: 1
metricSpoutTasks: 1
# log location? node['mon_thresh']['log_dir']
metricSpoutConfig:
#Kafka settings.
kafkaConsumerConfiguration:
# See http://kafka.apache.org/documentation.html#api for semantics and defaults.
topic: <%= @settings['kafka']['metric']['topic'] %>
numThreads: 1
groupId: <%= @settings['kafka']['metric']['group'] %>
zookeeperConnect: <%= @settings['zookeeper']['host'] %>
consumerId: 1
socketTimeoutMs: 30000
socketReceiveBufferBytes : 65536
fetchMessageMaxBytes: 1048576
autoCommitEnable: true
autoCommitIntervalMs: 60000
queuedMaxMessageChunks: 10
rebalanceMaxRetries: 4
fetchMinBytes: 1
fetchWaitMaxMs: 100
rebalanceBackoffMs: 2000
refreshLeaderBackoffMs: 200
autoOffsetReset: largest
consumerTimeoutMs: -1
clientId : 1
zookeeperSessionTimeoutMs : 6000
zookeeperConnectionTimeoutMs : 6000
zookeeperSyncTimeMs: 2000
eventSpoutConfig:
#Kafka settings.
kafkaConsumerConfiguration:
# See http://kafka.apache.org/documentation.html#api for semantics and defaults.
topic: <%= @settings['kafka']['event']['consumer_topic'] %>
numThreads: 1
groupId: <%= @settings['kafka']['event']['group'] %>
zookeeperConnect: <%= @settings['zookeeper']['host'] %>
consumerId: 1
socketTimeoutMs: 30000
socketReceiveBufferBytes : 65536
fetchMessageMaxBytes: 1048576
autoCommitEnable: true
autoCommitIntervalMs: 60000
queuedMaxMessageChunks: 10
rebalanceMaxRetries: 4
fetchMinBytes: 1
fetchWaitMaxMs: 100
rebalanceBackoffMs: 2000
refreshLeaderBackoffMs: 200
autoOffsetReset: largest
consumerTimeoutMs: -1
clientId : 1
zookeeperSessionTimeoutMs : 6000
zookeeperConnectionTimeoutMs : 6000
zookeeperSyncTimeMs: 2000
kafkaProducerConfiguration:
# See http://kafka.apache.org/documentation.html#api for semantics and defaults.
topic: <%= @settings['kafka']['event']['producer_topic'] %>
metadataBrokerList: <%= @settings['kafka']['event']['host'] %>
serializerClass: kafka.serializer.StringEncoder
partitionerClass:
requestRequiredAcks: 1
requestTimeoutMs: 10000
producerType: sync
keySerializerClass:
compressionCodec: none
compressedTopics:
messageSendMaxRetries: 3
retryBackoffMs: 100
topicMetadataRefreshIntervalMs: 600000
queueBufferingMaxMs: 5000
queueBufferingMaxMessages: 10000
queueEnqueueTimeoutMs: -1
batchNumMessages: 200
sendBufferBytes: 102400
clientId : Threshold_Engine
sporadicMetricNamespaces:
- foo
database:
driverClass: com.mysql.jdbc.Driver
url: jdbc:mysql://<%= @settings['mysql']['host'] %>/<%= @settings['mysql']['db'] %>
user: <%= @credentials['mysql']['user'] %>
password: <%= @credentials['mysql']['password'] %>
properties:
ssl: false
# the maximum amount of time to wait on an empty pool before throwing an exception
maxWaitForConnection: 1s
# the SQL query to run when validating a connection's liveness
validationQuery: "/* MyService Health Check */ SELECT 1"
# the minimum number of connections to keep open
minSize: 8
# the maximum number of connections to keep open
maxSize: 41