city-watch 0.5.8 → 0.5.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,27 @@
1
+ require 'mail'
2
+ require 'socket'
3
+
4
+ module OpenSSL
5
+ module SSL
6
+ remove_const :VERIFY_PEER
7
+ end
8
+ end
9
+ OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
10
+
1
11
  module Alerts
2
12
 
3
13
  def send_alert(message,dat=nil)
4
14
  CityWatch.redis.zadd "#{CityWatch.config[:prefix]}::#{host}::#{self.name}::alerts", rcv_time, Yajl::Encoder.encode({:message => message, :data => dat, :when => rcv_time})
15
+ if eml = CityWatch.config[:alert_by_email]
16
+ mail = Mail.new {
17
+ from "citywatch@#{Socket.gethostbyname(Socket.gethostname).first}"
18
+ to eml
19
+ subject "CityWatch: ALERT #{message}"
20
+ body "Alert data: #{data.inspect}"
21
+ }
22
+ mail.delivery_method :sendmail
23
+ mail.deliver!
24
+ end
5
25
  end
6
26
 
7
27
  def alerts
@@ -17,7 +37,7 @@ module Alerts
17
37
  end
18
38
 
19
39
  def get_alerts(host=host,num=5)
20
- CityWatch.redis.zrevrange "#{CityWatch.config[:prefix]}::#{host}::#{self.name}::alerts", 0, num - 1
40
+ CityWatch.redis.zrevrange("#{CityWatch.config[:prefix]}::#{host}::#{self.name}::alerts", 0, num - 1).map {|dat| Yajl::Parser.new(:symbolize_keys => true).parse(dat) }
21
41
  end
22
42
 
23
43
  def send_alerts!(*args)
@@ -36,7 +36,7 @@ module Collector
36
36
 
37
37
  data[:watchmen].each do |watchman,dat|
38
38
  if watch_obj = Watchmen.get(watchman)
39
- status, sum = watch_obj.process(dat,rcv_time,host)
39
+ _, sum = watch_obj.process(dat,rcv_time,host)
40
40
  summary[watchman] = sum if sum
41
41
  end
42
42
  end
@@ -9,8 +9,10 @@ module Watchmen
9
9
  end
10
10
 
11
11
  def self.data
12
- @watchmen.inject({}) do |acc,cmd|
13
- acc[cmd.name] = cmd.data
12
+ @watchmen.inject({}) do |acc,watchman|
13
+ if !CityWatch.config[:watchmen] || !CityWatch.config[:watchmen].includes?(watchman)
14
+ acc[watchman.name] = watchman.data
15
+ end
14
16
  acc
15
17
  end
16
18
  end
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module CityWatch
2
- VERSION = "0.5.8"
2
+ VERSION = "0.5.9"
3
3
  end
File without changes
File without changes
metadata CHANGED
@@ -1,106 +1,138 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: city-watch
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.9
4
5
  prerelease:
5
- version: 0.5.8
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - John Bragg
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2013-02-12 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
12
+ date: 2013-03-18 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
16
15
  name: redis
17
- prerelease: false
18
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
19
17
  none: false
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
24
22
  type: :runtime
25
- version_requirements: *id001
26
- - !ruby/object:Gem::Dependency
27
- name: rspec
28
23
  prerelease: false
29
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rspec
32
+ requirement: !ruby/object:Gem::Requirement
30
33
  none: false
31
- requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: "0"
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
35
38
  type: :runtime
36
- version_requirements: *id002
37
- - !ruby/object:Gem::Dependency
38
- name: rack
39
39
  prerelease: false
40
- requirement: &id003 !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
41
41
  none: false
42
- requirements:
43
- - - ">="
44
- - !ruby/object:Gem::Version
45
- version: "0"
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rack
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
46
54
  type: :runtime
47
- version_requirements: *id003
48
- - !ruby/object:Gem::Dependency
49
- name: rack-mount
50
55
  prerelease: false
51
- requirement: &id004 !ruby/object:Gem::Requirement
56
+ version_requirements: !ruby/object:Gem::Requirement
52
57
  none: false
53
- requirements:
54
- - - ">="
55
- - !ruby/object:Gem::Version
56
- version: "0"
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rack-mount
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
57
70
  type: :runtime
58
- version_requirements: *id004
59
- - !ruby/object:Gem::Dependency
60
- name: unicorn
61
71
  prerelease: false
62
- requirement: &id005 !ruby/object:Gem::Requirement
72
+ version_requirements: !ruby/object:Gem::Requirement
63
73
  none: false
64
- requirements:
65
- - - ">="
66
- - !ruby/object:Gem::Version
67
- version: "0"
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: unicorn
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
68
86
  type: :runtime
69
- version_requirements: *id005
70
- - !ruby/object:Gem::Dependency
71
- name: yajl-ruby
72
87
  prerelease: false
73
- requirement: &id006 !ruby/object:Gem::Requirement
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: yajl-ruby
96
+ requirement: !ruby/object:Gem::Requirement
74
97
  none: false
75
- requirements:
76
- - - ">="
77
- - !ruby/object:Gem::Version
78
- version: "0"
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
79
102
  type: :runtime
80
- version_requirements: *id006
81
- - !ruby/object:Gem::Dependency
82
- name: sysinfo
83
103
  prerelease: false
84
- requirement: &id007 !ruby/object:Gem::Requirement
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: sysinfo
112
+ requirement: !ruby/object:Gem::Requirement
85
113
  none: false
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: "0"
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
90
118
  type: :runtime
91
- version_requirements: *id007
92
- description: ""
93
- email:
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ description: ''
127
+ email:
94
128
  - john@cozy.co
95
- executables:
129
+ executables:
96
130
  - city_watch
97
131
  - watch_collector
98
132
  - watch_commander
99
133
  extensions: []
100
-
101
134
  extra_rdoc_files: []
102
-
103
- files:
135
+ files:
104
136
  - .DS_Store
105
137
  - .gitignore
106
138
  - Gemfile
@@ -183,34 +215,32 @@ files:
183
215
  - static/stylesheets/vs.css
184
216
  - static/stylesheets/xcode.css
185
217
  - static/stylesheets/zenburn.css
218
+ - views/watchmen/SystemInfo/detail.html.erb
219
+ - views/watchmen/SystemInfo/summary.html.erb
186
220
  - watch_collector.ru
187
221
  - watch_commander.ru
188
222
  homepage: http://cozy.co
189
223
  licenses: []
190
-
191
224
  post_install_message:
192
225
  rdoc_options: []
193
-
194
- require_paths:
226
+ require_paths:
195
227
  - lib
196
- required_ruby_version: !ruby/object:Gem::Requirement
228
+ required_ruby_version: !ruby/object:Gem::Requirement
197
229
  none: false
198
- requirements:
199
- - - ">="
200
- - !ruby/object:Gem::Version
230
+ requirements:
231
+ - - ! '>='
232
+ - !ruby/object:Gem::Version
201
233
  version: 1.9.2
202
- required_rubygems_version: !ruby/object:Gem::Requirement
234
+ required_rubygems_version: !ruby/object:Gem::Requirement
203
235
  none: false
204
- requirements:
205
- - - ">="
206
- - !ruby/object:Gem::Version
207
- version: "0"
236
+ requirements:
237
+ - - ! '>='
238
+ - !ruby/object:Gem::Version
239
+ version: '0'
208
240
  requirements: []
209
-
210
241
  rubyforge_project: city-watch
211
- rubygems_version: 1.8.24
242
+ rubygems_version: 1.8.23
212
243
  signing_key:
213
244
  specification_version: 3
214
245
  summary: Server/process monitoring
215
246
  test_files: []
216
-