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 +4 -4
- data/app/jobs/schedule_by_interval_job.rb +1 -1
- data/app/models/my_nagios/check.rb +10 -2
- data/lib/my_nagios/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69de582704e1d1281a717ac8c297cb41d1c229be
|
4
|
+
data.tar.gz: 8f47dcce1b50d80cc04013d6628ca42b66826cbf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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,
|
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
|
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
|
data/lib/my_nagios/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2016-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|