commit fae5899244afb3499067b0fdfcccea23869d8899 Author: Tim Kuhlman Date: Wed Mar 12 17:15:31 2014 -0600 Initial cookbook creation diff --git a/README.md b/README.md new file mode 100644 index 0000000..da14dcc --- /dev/null +++ b/README.md @@ -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 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
KeyTypeDescriptionDefault
[:mon_notification][:user]StringSystem user for the daemonmon-notification
[:mon_notification][:group]StringSystem group for the daemonmon-notification
[:mon_notification][:conf_dir]StringConfiguration Directory/etc/mon
[:mon_notification][:log_dir]StringDaemon log directory/var/log/mon-notification
+ +Usage +----- +Simply include the mon_notification default recipe in a role. diff --git a/attributes/default.rb b/attributes/default.rb new file mode 100644 index 0000000..435a239 --- /dev/null +++ b/attributes/default.rb @@ -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' diff --git a/metadata.rb b/metadata.rb new file mode 100644 index 0000000..5cf0682 --- /dev/null +++ b/metadata.rb @@ -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' diff --git a/recipes/default.rb b/recipes/default.rb new file mode 100644 index 0000000..6789f52 --- /dev/null +++ b/recipes/default.rb @@ -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 diff --git a/templates/default/mon-notification.conf.erb b/templates/default/mon-notification.conf.erb new file mode 100644 index 0000000..cfa7d2b --- /dev/null +++ b/templates/default/mon-notification.conf.erb @@ -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 diff --git a/templates/default/notification.yaml.erb b/templates/default/notification.yaml.erb new file mode 100644 index 0000000..e4ea4e5 --- /dev/null +++ b/templates/default/notification.yaml.erb @@ -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