chef-monitor 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,121 @@
1
+ #CHEF-MONITOR
2
+
3
+ Chef monitor has two executables:
4
+ - chef-logmon (this will be activated on all frontend servers)
5
+ - chef-worker (this will be activated on your monitor/backend server)
6
+
7
+ #CHEF HA
8
+
9
+ When you have Chef in HA mode, your environment will look something like this:
10
+
11
+ HA Setup
12
+
13
+ public zone | dmz zone | db zone
14
+ ---------------|------------------------|-----------------------
15
+ | |
16
+ | frontend-server | backend-server
17
+ | webserver01 | / dbserver01
18
+ | 10.1.1.10/24 | / 10.1.5.110/24
19
+ | | /
20
+ internet | | vip <
21
+ | | ^ \
22
+ | frontend-server | | \ backend-server
23
+ | webserver02 | | \ dbserver02
24
+ | 10.1.1.20/24 | | 10.1.5.120/24
25
+ |
26
+ ----------------
27
+ 10.1.5.90/24 | monitor-server |
28
+ keepalived | monserver01 |
29
+ | 10.1.5.130/24 |
30
+ ----------------
31
+
32
+ When running this environment, I suggest you configure the new monitor server.
33
+ The Back-end server and monitor server can also be only one single server.
34
+ If you don't have HA mode, then the environment will look something like this:
35
+
36
+ Single Setup
37
+
38
+ public zone | cloud server |
39
+ ---------------|------------------------|
40
+ | |
41
+ | chefserver |
42
+ internet | chefserver01 |
43
+ | 10.1.1.10/24 |
44
+ | |
45
+
46
+
47
+ #CHEF-LOGMON:
48
+
49
+ The logmon tool will run on every frontend server within your HA environment or on the
50
+ chefserver in a more basic environment and is responsible for the following tasks:
51
+
52
+ - Tail your NGINX log and record all POST/PUTS/DELETES
53
+ - This information is sent to your Rabbit-MQ server (which comes default with chef)
54
+
55
+ Basically every change that's being made to chef is registered within RabbitMQ.
56
+
57
+ #CHEF-WORKER:
58
+
59
+ The worker tool will run on your monitor server within the HA environment or on the
60
+ chefserver in a more basic environment and is responsible for the following tasks:
61
+
62
+ - Get the messages from RabbitMQ
63
+ - Download the objects from chef that are changed
64
+ - Commit the changes within a GIT repository
65
+
66
+ In this way every modified object is registered with a GIT commit and a POST-COMMIT script
67
+ will email the differences to any configured email address. This POST-COMMIT part is not
68
+ within the GEM, but comes with the chef-monitor chef cookbook.
69
+
70
+ #CONFIGURATION:
71
+
72
+ In order to execute both tools, you will need the following configuration settings:
73
+
74
+ chef_url "https://10.1.5.90"
75
+ node_name "monitor"
76
+ client_key "/opt/chef-monitor/monitor.pem"
77
+ mq_server "10.1.5.90"
78
+ mq_queue "monitor_tasks"
79
+ download_path "/opt/chef-monitor/orgs"
80
+ log_dir "/var/log/chef-monitor"
81
+ pid_dir "/var/run/chef-monitor"
82
+ mon_file "/var/log/opscode/nginx/access.log"
83
+
84
+ Save these settings into /opt/chef-monitor/config.rb (the cookbook will do this for you)
85
+ Make sure your monitor user is created on your chef server and has enough rights to download
86
+ all objects within your organization that you want to monitor.
87
+
88
+ Create a directory within your [download_path] with the same name as your organization.
89
+ Initialize this directory with the following commands:
90
+
91
+ git init
92
+ touch dummy
93
+ git add .
94
+ git commit -am "enable git control"
95
+
96
+ Add some git configuration settings for the POST-COMMIT script and chef-monitor tools.
97
+
98
+ git config hooks.mailinglist sander.botman@gmail.com
99
+ git config hooks.emailprefix <YOUR_ORGANIZATION>
100
+ git config hooks.emaildomain @your.domain.com
101
+
102
+ Set the project name within the gitrepo, so you can identify your chef environment.
103
+
104
+ echo MYCHEF > ./.git/description
105
+
106
+
107
+ #EXECUTION:
108
+
109
+ After these settings, you should be able to run the tools:
110
+ On all your frontend servers:
111
+
112
+ chef-logmon run -- -C /opt/chef-monitor/config.rb #<run interactive>
113
+ chef-logmon start -- -C /opt/chef-monitor/config.rb #<run as service>
114
+ chef-logmon stop #<stop service>
115
+
116
+ On your monitor server:
117
+
118
+ chef-worker run -- -C /opt/chef-monitor/config.rb #<run interactive>
119
+ chef-worker start -- -C /opt/chef-monitor/config.rb #<run as service>
120
+ chef-worker stop #<stop service>
121
+ chef-worker run -- -C /opt/chef-monitor/config.rb -O my_org #<populates the repo: my_org for the first time>
@@ -15,6 +15,7 @@
15
15
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
16
  # See the License for the specific language governing permissions and
17
17
  # limitations under the License.
18
+ #
18
19
 
19
20
  require "chef_logmon"
20
21
  require 'rubygems'
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- #!/opt/chef/embedded/bin/ruby
3
2
  #
4
3
  # Author:: Sander Botman (<sander.botman@gmail.com>)
5
4
  # Copyright:: Copyright (c) 2014 Sander Botman.
@@ -16,7 +15,8 @@
16
15
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
16
  # See the License for the specific language governing permissions and
18
17
  # limitations under the License.
19
- # $:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
18
+ #
19
+
20
20
  require "chef_worker"
21
21
  require 'rubygems'
22
22
  require 'bunny'
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.extra_rdoc_files = ["LICENSE"]
11
11
  s.authors = ["Sander Botman"]
12
12
  s.email = ["sander.botman@gmail.com"]
13
- s.homepage = "https://github.com/schubergphilis/chef-monitor"
13
+ s.homepage = "https://github.com/schubergphilis/chef-monitor-gem"
14
14
  s.summary = %q{Chef Monitoring tool to monitor all changes made}
15
15
  s.description = s.summary
16
16
  s.files = `git ls-files`.split("\n")
@@ -32,7 +32,8 @@ class Monitor
32
32
  mon.backward(1)
33
33
  mon.tail { |line|
34
34
  data = scan(line)
35
- unless data.nil? || data['org'].nil?
35
+ # skipping the objects 'checksum-.*' and 'reports'
36
+ unless data.nil? || data['org'].nil? || data['object'] =~ /(^checksum-.*$|^reports$)/
36
37
  Monitor::Log.new(data, "INFO")
37
38
  q.publish(data, :persistent => true, :content_type => "application/json")
38
39
  end
@@ -16,6 +16,6 @@
16
16
  # limitations under the License.
17
17
 
18
18
  class Monitor
19
- VERSION = "0.1.5"
19
+ VERSION = "0.1.6"
20
20
  MAJOR, MINOR, TINY = VERSION.split('.')
21
21
  end
@@ -15,7 +15,6 @@
15
15
  # See the License for the specific language governing permissions and
16
16
  # limitations under the License.
17
17
 
18
-
19
18
  class Monitor
20
19
  class Worker
21
20
  def run
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-monitor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-02-11 00:00:00.000000000 Z
12
+ date: 2014-04-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bunny
@@ -69,9 +69,8 @@ extensions: []
69
69
  extra_rdoc_files:
70
70
  - LICENSE
71
71
  files:
72
- - .gitignore
73
72
  - LICENSE
74
- - README
73
+ - README.md
75
74
  - Rakefile
76
75
  - bin/chef-logmon
77
76
  - bin/chef-worker
@@ -85,7 +84,7 @@ files:
85
84
  - lib/chef_monitor/version.rb
86
85
  - lib/chef_monitor/worker.rb
87
86
  - lib/chef_worker.rb
88
- homepage: https://github.com/schubergphilis/chef-monitor
87
+ homepage: https://github.com/schubergphilis/chef-monitor-gem
89
88
  licenses:
90
89
  - Apache 2.0
91
90
  post_install_message:
@@ -106,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
105
  version: '0'
107
106
  requirements: []
108
107
  rubyforge_project:
109
- rubygems_version: 1.8.24
108
+ rubygems_version: 1.8.25
110
109
  signing_key:
111
110
  specification_version: 3
112
111
  summary: Chef Monitoring tool to monitor all changes made
data/.gitignore DELETED
@@ -1,4 +0,0 @@
1
- /bin/test*
2
- /pkg
3
- /config
4
- /orgs
data/README DELETED
@@ -1,131 +0,0 @@
1
- #
2
- # Author:: Sander Botman (<sander.botman@gmail.com>)
3
- # Copyright:: Copyright (c) 2014 Sander Botman.
4
- # License:: Apache License, Version 2.0
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
-
18
- CHEF-MONITOR
19
-
20
- Chef monitor has two executables:
21
- - chef-logmon (this will be activated on all frontend servers)
22
- - chef-worker (this will be activated on your monitor/backend server)
23
-
24
-
25
- Chef HA configuration:
26
-
27
- When you have Chef in HA mode, your environment will look something like this:
28
-
29
- public zone | dmz zone | db zone
30
- ---------------|------------------------|-----------------------
31
- | |
32
- | frontend-server | backend-server
33
- | webserver01 | / dbserver01
34
- | 10.1.1.10/24 | / 10.1.5.110/24
35
- | | /
36
- internet | | vip <
37
- | | ^ \
38
- | frontend-server | | \ backend-server
39
- | webserver02 | | \ dbserver02
40
- | 10.1.1.20/24 | | 10.1.5.120/24
41
- |
42
- ----------------
43
- 10.1.5.90/24 | monitor-server |
44
- keepalived | monserver01 |
45
- | 10.1.5.130/24 |
46
- ----------------
47
-
48
- When running this environment, I suggest you configure the new monitor server.
49
- The frondend server and monitor server can also be only one single server.
50
- If you don't have HA mode, then the environment will look something like this:
51
-
52
- public zone | cloud server |
53
- ---------------|------------------------|
54
- | |
55
- | chefserver |
56
- internet | chefserver01 |
57
- | 10.1.1.10/24 |
58
- | |
59
-
60
-
61
- CHEF-LOGMON:
62
-
63
- The logmon tool will run on every frontend server within your HA environment or on the
64
- chefserver in a more basic environment and is responsible for the following tasks:
65
-
66
- - Tail your NGINX log and record all POST/PUTS/DELETES
67
- - This information is sent to your Rabbit-MQ server (which comes default with chef)
68
-
69
- Basically every change that's being made to chef is registered within RabbitMQ.
70
-
71
-
72
- CHEF-WORKER:
73
-
74
- The worker tool will run on your monitor server within the HA environment or on the
75
- chefserver in a more basic environment and is responsible for the following tasks:
76
-
77
- - Get the messages from RabbitMQ
78
- - Download the objects from chef that are changed
79
- - Commit the changes within a GIT repository
80
-
81
- In this way every modified object is registered with a GIT commit and a POST-COMMIT script
82
- will email the differences to any configured email address. This POST-COMMIT part is not
83
- within the GEM, but comes with the chef-monitor chef cookbook.
84
-
85
- CONFIGURATION:
86
-
87
- In order to execute both tools, you will need the following configuration settings:
88
-
89
- chef_url "https://10.1.5.90"
90
- node_name "monitor"
91
- client_key "/opt/chef-monitor/monitor.pem"
92
- mq_server "10.1.5.90"
93
- mq_queue "monitor_tasks"
94
- download_path "/opt/chef-monitor/orgs"
95
- log_dir "/var/log/chef-monitor"
96
- pid_dir "/var/run/chef-monitor"
97
- mon_file "/var/log/opscode/nginx/access.log"
98
-
99
- Save these settings into /opt/chef-monitor/config.rb
100
- Make sure your monitor user is created on your chef server and has enough rights to download
101
- all objects within your organizaton that you want to monitor.
102
-
103
- Create an directory within your [download_path] with the same name as your organization.
104
- Initialize this directory with the following commands:
105
- git init
106
- touch dummy
107
- git add .
108
- git commit -am "enable git control"
109
-
110
- Add some git configuration settings for the POST-COMMIT script and chef-monitor tools.
111
- git config hooks.mailinglist sander.botman@gmail.com
112
- git config hooks.emailprefix <YOUR_ORGANIZATION>
113
- git config hooks.emaildomain @your.domain.com
114
-
115
- Set the project name within the gitrepo, so you can identify your chef environment.
116
- echo MYCHEF > ./.git/description
117
-
118
-
119
- EXECUTION:
120
-
121
- After these settings, you should be able to run the tools:
122
- On all your frontend servers:
123
- chef-logmon run -- -C /opt/chef-monitor/config.rb <run interactive>
124
- chef-logmon start -- -C /opt/chef-monitor/config.rb <run as service>
125
- chef-logmon stop <stop service>
126
-
127
- On your monitor server:
128
- chef-worker run -- -C /opt/chef-monitor/config.rb <run interactive>
129
- chef-worker start -- -C /opt/chef-monitor/config.rb <run as service>
130
- chef-worker stop <stop service>
131
-