my_nagios 0.0.14 → 0.0.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 08675c59ec122b34650ee7c21c7218af30ef7d3f
4
- data.tar.gz: 6f9e8ea47b9b8479717f96071bb8d61fadfcf0d6
3
+ metadata.gz: 69de582704e1d1281a717ac8c297cb41d1c229be
4
+ data.tar.gz: 8f47dcce1b50d80cc04013d6628ca42b66826cbf
5
5
  SHA512:
6
- metadata.gz: 78340047fcaa7568bbafc843576160fc8e93606afd41def2ec9ab1bd9c27162dde607d13f4c6cba86ee16404955784285ba53a18a8b27087aa5b37b70ff3b0c8
7
- data.tar.gz: d958f8248b1c8891990cc9fab96c858fd41e7f219930a54622618d2d0e7e8c910782bf074449cb36f3c59ea44cbb21e666c83eb1126b4d63f26799307f76adeb
6
+ metadata.gz: 733dd9e8261faf8f757108048e174a7c2d878e6498cb5d296e45888654232f677869a83febcf89019641a70b6da69a055cc32d60507f526052303e9a9ff87715
7
+ data.tar.gz: a05b85d8b88a3f31c98a022acbc6638657bfd59cecba86578fee68a7d1ac0d79e758ca244314dc91d697600e6bf70f6025b5911f7e2b0ea0a78a81c0fe93bdba
@@ -15,7 +15,7 @@ class ScheduleByIntervalJob
15
15
  end
16
16
 
17
17
  # Optimized variant, group checks, run all necessary checks with one ssh connection
18
- MyNagios::Check.where(interval: options['interval']).group_by{|check| { host: check.host, user: check.user, pem_key: check.pem_key } }.each do |config, checks|
18
+ MyNagios::Check.enabled.where(interval: options['interval']).group_by{|check| { host: check.host, user: check.user, pem_key: check.pem_key } }.each do |config, checks|
19
19
  MonitoringJob.perform_async(checks.map(&:id), config)
20
20
  end
21
21
  end
@@ -13,7 +13,7 @@ module MyNagios
13
13
  begin
14
14
  self.update(state: :running)
15
15
 
16
- Net::SSH.start( self.host, self.user, config: true, keys: [self.pem_key], non_interactive: true ) do| ssh |
16
+ Net::SSH.start( self.host, self.user, MyNagios::Check.ssh_config(self.pem_key) ) do |ssh|
17
17
  result = ssh.exec! self.command
18
18
  status = self.determinate_status_by_response(result)
19
19
 
@@ -32,7 +32,7 @@ module MyNagios
32
32
  begin
33
33
  check_list.update_all(state: :running)
34
34
 
35
- Net::SSH.start( config['host'], config['user'], config: true, keys: [config['pem_key']], non_interactive: true ) do |ssh|
35
+ Net::SSH.start( config['host'], config['user'], MyNagios::Check.ssh_config(config['pem_key']) ) do |ssh|
36
36
  check_list.each do |check|
37
37
  result = ssh.exec! check.command
38
38
  status = check.determinate_status_by_response(result)
@@ -54,5 +54,13 @@ module MyNagios
54
54
  return :info if response.nil? or not response.scan('No such file or directory').blank?
55
55
  :success
56
56
  end
57
+
58
+ def self.ssh_config(pem_key = nil)
59
+ config = { config: true, non_interactive: true, auth_methods: ['publickey', 'hostbased'] }
60
+ config[:keys] = [pem_key] unless pem_key.blank?
61
+
62
+ config
63
+ end
64
+
57
65
  end
58
66
  end
@@ -1,3 +1,3 @@
1
1
  module MyNagios
2
- VERSION = "0.0.14"
2
+ VERSION = "0.0.15"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: my_nagios
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vitaly Omelchenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-21 00:00:00.000000000 Z
11
+ date: 2016-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails