commit dbb0d972e5606eab50c9884a79a2dea31f146ba9 Author: Tim Kuhlman Date: Fri Mar 14 17:14:43 2014 -0600 Initial mon_thresh cookbook diff --git a/README.md b/README.md new file mode 100644 index 0000000..89bb016 --- /dev/null +++ b/README.md @@ -0,0 +1,31 @@ +mon_thresh Cookbook +=================== + +Requirements +------------ +No special requirements at this time + +Attributes +---------- + + + + + + + + + + + + + +
KeyTypeDescriptionDefault
[:mon_thresh][:data_bag]StringData bag to usemon_thresh
+ +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 + diff --git a/attributes/default.rb b/attributes/default.rb new file mode 100644 index 0000000..d733aa8 --- /dev/null +++ b/attributes/default.rb @@ -0,0 +1,3 @@ +default[:mon_thresh][:data_bag] = 'mon_thresh' + +default[:mon_thresh][:log_dir] = '/var/log/mon-thresh' diff --git a/metadata.rb b/metadata.rb new file mode 100644 index 0000000..a67eded --- /dev/null +++ b/metadata.rb @@ -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' diff --git a/recipes/default.rb b/recipes/default.rb new file mode 100644 index 0000000..90914c1 --- /dev/null +++ b/recipes/default.rb @@ -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 diff --git a/templates/default/mon-thresh-config.yml.erb b/templates/default/mon-thresh-config.yml.erb new file mode 100755 index 0000000..02c6a9d --- /dev/null +++ b/templates/default/mon-thresh-config.yml.erb @@ -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