Initial cookbook creation

This commit is contained in:
Tim Kuhlman 2014-03-12 17:15:31 -06:00
commit fae5899244
6 changed files with 154 additions and 0 deletions

47
README.md Normal file
View File

@ -0,0 +1,47 @@
mon_notification Cookbook
=========================
Sets up the mon-notification daemon
Requirements
------------
The cookbook only requires access to the mon-notification package.
Attributes
----------
#### mon_notification::default
<table>
<tr>
<th>Key</th>
<th>Type</th>
<th>Description</th>
<th>Default</th>
</tr>
<tr>
<td><tt>[:mon_notification][:user]</tt></td>
<td>String</td>
<td>System user for the daemon</td>
<td><tt>mon-notification</tt></td>
</tr>
<tr>
<td><tt>[:mon_notification][:group]</tt></td>
<td>String</td>
<td>System group for the daemon</td>
<td><tt>mon-notification</tt></td>
</tr>
<tr>
<td><tt>[:mon_notification][:conf_dir]</tt></td>
<td>String</td>
<td>Configuration Directory</td>
<td><tt>/etc/mon</tt></td>
</tr>
<tr>
<td><tt>[:mon_notification][:log_dir]</tt></td>
<td>String</td>
<td>Daemon log directory</td>
<td><tt>/var/log/mon-notification</tt></td>
</tr>
</table>
Usage
-----
Simply include the mon_notification default recipe in a role.

4
attributes/default.rb Normal file
View File

@ -0,0 +1,4 @@
default[:mon_notification][:user] = 'mon-notification'
default[:mon_notification][:group] = 'mon-notification'
default[:mon_notification][:conf_dir] = '/etc/mon'
default[:mon_notification][:log_dir] = '/var/log/mon-notification'

7
metadata.rb Normal file
View File

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

49
recipes/default.rb Normal file
View File

@ -0,0 +1,49 @@
package 'mon-notification' do
action :upgrade
end
user node[:mon_notification][:group] do
action :create
end
user node[:mon_notification][:user] do
action :create
system true
gid node[:mon_notification][:group]
end
template '/etc/init/mon-notification.conf' do
action :create
source 'mon-notification.conf.erb'
owner 'root'
group 'root'
mode 0644
end
service 'mon-notification' do
action :enable
provider Chef::Provider::Service::Upstart
end
directory node[:mon_notification][:conf_dir] do
action :create
owner 'root'
group 'root'
mode 0755
end
directory node[:mon_notification][:log_dir] do
action :create
owner node[:mon_notification][:user]
group node[:mon_notification][:group]
mode 0775
end
# todo - setup a data bag for the config details and an encrypted one for credentials
template "#{node[:mon_notification][:conf_dir]}/notification.yaml" do
action :create
source 'notification.yaml.erb'
owner 'root'
group 'root'
mode 0644
notifies :restart, "service[mon-notification]"
end

View File

@ -0,0 +1,11 @@
# Startup script for the mon_notification
description "Mon Notification daemon"
start on runlevel [2345]
console log
respawn
setgid <%= node[:mon_notification][:group] %>
setuid <%= node[:mon_notification][:user] %>
exec /usr/bin/mon-notification

View File

@ -0,0 +1,36 @@
log_dir: <%= node[:mon_notification][:log_dir] %>
kafka:
url: 192.168.10.10:9092
group: <%= node[:mon_notification][:group] %>
alarm_topic: alarm-state-transitions
notification_topic: alarm-notifications
mysql:
host: 192.168.10.6
user: notification
passwd: password
db: mon
email:
server: smtp3.hp.com
port: 25
user:
password:
timeout: 60
from_addr: notifications@localhost.localdomain
processors:
alarm:
number: 2
notification:
number: 2
queues:
alarms_size: 256
finished_size: 256
notifications_size: 256
sent_notifications_size: 256
zookeeper:
url: 192.168.10.10:2181