perus 0.1.15 → 0.1.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/perus/pinger/pinger.rb +1 -1
- data/lib/perus/server/db.rb +1 -1
- data/lib/perus/server/migrations/008_create_metrics.rb +1 -1
- data/lib/perus/server/migrations/015_configs_have_maintenance_window.rb +13 -0
- data/lib/perus/server/models/config.rb +17 -1
- data/lib/perus/server/models/script.rb +1 -1
- data/lib/perus/server/models/system.rb +2 -0
- data/lib/perus/server/server.rb +5 -1
- data/lib/perus/server/views/configs/form.erb +1 -0
- data/lib/perus/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c4b29dd1042da5633dbfe9fea75bca98cac4514
|
4
|
+
data.tar.gz: 7fea3792cac47ccc059e36d2ebd7737132d80b61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a13fbf9079d45005f7ac934791f706987b786281fe8b4a35e701bbfcb6960780f2ceb10f12a7933d17e20e713b48f8b5687b24cdbb5edccf57868fe446f6bc5a
|
7
|
+
data.tar.gz: 6b8d5737db4686ad3f6a50ae4b6fd69b34b0daa4343aa78e51f114a141afc4eb5d1a1e65bfc89080a321efba36d24e497d8a735d117efee15661ecffb0c8f5d3
|
data/lib/perus/pinger/pinger.rb
CHANGED
data/lib/perus/server/db.rb
CHANGED
@@ -17,7 +17,7 @@ module Perus::Server
|
|
17
17
|
Sequel.extension :inflector
|
18
18
|
|
19
19
|
# connect/create the database and run any new migrations
|
20
|
-
@db = Sequel.postgres('perus', host: 'localhost')
|
20
|
+
@db = Sequel.postgres('perus', host: 'localhost', username: Server.options.db['username'], password: Server.options.db['password'])
|
21
21
|
Sequel::Migrator.run(@db, File.join(__dir__, 'migrations'))
|
22
22
|
|
23
23
|
# load models - these rely on an existing db connection
|
@@ -2,7 +2,7 @@ module Perus::Server
|
|
2
2
|
class Config < Sequel::Model
|
3
3
|
plugin :validation_helpers
|
4
4
|
one_to_many :systems
|
5
|
-
one_to_many :config_metrics, order:
|
5
|
+
one_to_many :config_metrics, order: :order
|
6
6
|
|
7
7
|
def metric_hashes
|
8
8
|
config_metrics.collect(&:config_hash)
|
@@ -20,6 +20,22 @@ module Perus::Server
|
|
20
20
|
systems_dataset.empty?
|
21
21
|
end
|
22
22
|
|
23
|
+
def in_maintenance?
|
24
|
+
return false unless maintenance.is_a?(String)
|
25
|
+
from, to = maintenance.split('-')
|
26
|
+
now = Time.now
|
27
|
+
|
28
|
+
from_hour, from_min = from.split(':').map(&:to_i)
|
29
|
+
return false if now.hour < from_hour
|
30
|
+
return false if now.hour == from_hour && now.min < from_min
|
31
|
+
|
32
|
+
to_hour, to_min = to.split(':').map(&:to_i)
|
33
|
+
return false if now.hour > to_hour
|
34
|
+
return false if now.hour == to_hour && now.min > to_min
|
35
|
+
|
36
|
+
true
|
37
|
+
end
|
38
|
+
|
23
39
|
def validate
|
24
40
|
super
|
25
41
|
validates_presence :name
|
@@ -65,6 +65,8 @@ module Perus::Server
|
|
65
65
|
# metrics
|
66
66
|
# ---------------------------------------
|
67
67
|
def save_metric_errors(params, timestamp)
|
68
|
+
# ignore errors during maintenance window
|
69
|
+
return if config.in_maintenance?
|
68
70
|
errors = JSON.parse(params['metric_errors'])
|
69
71
|
|
70
72
|
errors.each do |module_name, module_errors|
|
data/lib/perus/server/server.rb
CHANGED
@@ -7,12 +7,16 @@ DEFAULT_SERVER_OPTIONS = {
|
|
7
7
|
'uploads_url' => 'http://localhost:3000/uploads/',
|
8
8
|
'db_path' => './perus.db',
|
9
9
|
'listen' => '0.0.0.0',
|
10
|
-
'port' =>
|
10
|
+
'port' => 5000,
|
11
11
|
'site_name' => 'Perus',
|
12
12
|
'url_prefix' => '/',
|
13
13
|
'keep_hours' => 24,
|
14
14
|
'cache_alerts_secs' => 20,
|
15
15
|
'stats_path' => '/var/perus.stats'
|
16
|
+
},
|
17
|
+
'db' => {
|
18
|
+
'username' => '',
|
19
|
+
'password' => ''
|
16
20
|
}
|
17
21
|
}
|
18
22
|
|
data/lib/perus/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: perus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Will Cannings
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -266,6 +266,7 @@ files:
|
|
266
266
|
- lib/perus/server/migrations/012_create_config_metrics.rb
|
267
267
|
- lib/perus/server/migrations/013_create_active_alerts.rb
|
268
268
|
- lib/perus/server/migrations/014_alerts_can_have_errors.rb
|
269
|
+
- lib/perus/server/migrations/015_configs_have_maintenance_window.rb
|
269
270
|
- lib/perus/server/models/action.rb
|
270
271
|
- lib/perus/server/models/active_alert.rb
|
271
272
|
- lib/perus/server/models/alert.rb
|