foreman_monitoring 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/app/controllers/concerns/foreman_monitoring/hosts_controller_extensions.rb +15 -14
- data/app/helpers/concerns/foreman_monitoring/hosts_helper_ext.rb +12 -11
- data/app/models/concerns/foreman_monitoring/host_extensions.rb +12 -10
- data/lib/foreman_monitoring/engine.rb +4 -4
- data/lib/foreman_monitoring/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f742aa658a66234e28555d6dbba4beca116e6ba3d49db3c02898bd7cc295a5d9
|
4
|
+
data.tar.gz: f11b41bb8dc37e78431df10c3fc255f7680039293e7e0c9ff0268a4c975d49ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7dbdfc58ea1b7669eefff4b603ccc4f813b87a3aadbb4cd4a48ad86de3899403b440709d1b2a1f9145dc5b4b4487875ad0a33de031142d70e47d139278043d1
|
7
|
+
data.tar.gz: 39f27d2331c23bd24392d1abcaa47dc4ec9757463a27503518d501581ba2b276acc2528fa58b2e76f632f58ac00cb91801060d09a821a9853e0754ced75342dc
|
@@ -1,17 +1,18 @@
|
|
1
1
|
module ForemanMonitoring
|
2
2
|
module HostsControllerExtensions
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
before_action :find_resource_with_monitoring, :only => [:downtime]
|
7
|
+
before_action :find_multiple_with_monitoring, :only => %i[select_multiple_downtime update_multiple_downtime
|
8
|
+
select_multiple_monitoring_proxy update_multiple_monitoring_proxy]
|
9
|
+
before_action :validate_host_downtime_params, :only => [:downtime]
|
10
|
+
before_action :validate_hosts_downtime_params, :only => [:update_multiple_downtime]
|
11
|
+
before_action :validate_multiple_monitoring_proxy, :only => :update_multiple_monitoring_proxy
|
12
|
+
|
13
|
+
alias_method :find_resource_with_monitoring, :find_resource
|
14
|
+
alias_method :find_multiple_with_monitoring, :find_multiple
|
15
|
+
alias_method_chain :update_multiple_power_state, :monitoring
|
15
16
|
end
|
16
17
|
|
17
18
|
def downtime
|
@@ -64,7 +65,7 @@ module ForemanMonitoring
|
|
64
65
|
update_multiple_proxy(_('Monitoring'), :monitoring_proxy=)
|
65
66
|
end
|
66
67
|
|
67
|
-
def
|
68
|
+
def update_multiple_power_state_with_monitoring
|
68
69
|
options = {
|
69
70
|
:comment => 'Power state changed in Foreman',
|
70
71
|
:author => "Foreman User #{User.current}",
|
@@ -85,7 +86,7 @@ module ForemanMonitoring
|
|
85
86
|
end
|
86
87
|
end
|
87
88
|
end
|
88
|
-
|
89
|
+
update_multiple_power_state_without_monitoring
|
89
90
|
end
|
90
91
|
|
91
92
|
private
|
@@ -1,17 +1,18 @@
|
|
1
1
|
module ForemanMonitoring
|
2
2
|
module HostsHelperExt
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
alias_method_chain :host_title_actions, :monitoring
|
7
|
+
alias_method_chain :multiple_actions, :monitoring
|
8
|
+
end
|
9
|
+
|
10
|
+
def multiple_actions_with_monitoring
|
11
|
+
return multiple_actions_without_monitoring unless authorized_for(:controller => :hosts, :action => :select_multiple_downtime)
|
12
|
+
multiple_actions_without_monitoring + [[_('Set downtime'), select_multiple_downtime_hosts_path], [_('Change Monitoring Proxy'), select_multiple_monitoring_proxy_hosts_path]]
|
12
13
|
end
|
13
14
|
|
14
|
-
def
|
15
|
+
def host_title_actions_with_monitoring(host)
|
15
16
|
title_actions(
|
16
17
|
button_group(
|
17
18
|
display_link_if_authorized(_('Downtime'),
|
@@ -26,7 +27,7 @@ module ForemanMonitoring
|
|
26
27
|
:target => '#set_host_downtime' })
|
27
28
|
)
|
28
29
|
)
|
29
|
-
|
30
|
+
host_title_actions_without_monitoring(host)
|
30
31
|
end
|
31
32
|
|
32
33
|
def host_monitoring_result_icon_class(result)
|
@@ -1,13 +1,15 @@
|
|
1
1
|
module ForemanMonitoring
|
2
2
|
module HostExtensions
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
included do
|
5
|
+
include Orchestration::Monitoring
|
6
6
|
|
7
|
-
|
7
|
+
after_build :downtime_host_build
|
8
8
|
|
9
|
-
|
10
|
-
|
9
|
+
alias_method_chain :smart_proxy_ids, :monitoring_proxy
|
10
|
+
alias_method_chain :hostgroup_inherited_attributes, :monitoring
|
11
|
+
|
12
|
+
has_many :monitoring_results, :dependent => :destroy, :foreign_key => 'host_id'
|
11
13
|
end
|
12
14
|
|
13
15
|
def monitoring_status(options = {})
|
@@ -40,12 +42,12 @@ module ForemanMonitoring
|
|
40
42
|
monitoring_proxy.present?
|
41
43
|
end
|
42
44
|
|
43
|
-
def
|
44
|
-
|
45
|
+
def hostgroup_inherited_attributes_with_monitoring
|
46
|
+
hostgroup_inherited_attributes_without_monitoring + ['monitoring_proxy_id']
|
45
47
|
end
|
46
48
|
|
47
|
-
def
|
48
|
-
ids =
|
49
|
+
def smart_proxy_ids_with_monitoring_proxy
|
50
|
+
ids = smart_proxy_ids_without_monitoring_proxy
|
49
51
|
[monitoring_proxy, hostgroup.try(:monitoring_proxy)].compact.each do |proxy|
|
50
52
|
ids << proxy.id
|
51
53
|
end
|
@@ -71,10 +71,10 @@ module ForemanMonitoring
|
|
71
71
|
|
72
72
|
config.to_prepare do
|
73
73
|
begin
|
74
|
-
::Host::Managed.send
|
75
|
-
::Hostgroup.send
|
76
|
-
::HostsHelper.send(:
|
77
|
-
::HostsController.send
|
74
|
+
::Host::Managed.send :include, ForemanMonitoring::HostExtensions
|
75
|
+
::Hostgroup.send :include, ForemanMonitoring::HostgroupExtensions
|
76
|
+
::HostsHelper.send(:include, ForemanMonitoring::HostsHelperExt)
|
77
|
+
::HostsController.send :include, ForemanMonitoring::HostsControllerExtensions
|
78
78
|
rescue => e
|
79
79
|
Rails.logger.warn "ForemanMonitoring: skipping engine hook (#{e})"
|
80
80
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_monitoring
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Timo Goebel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
125
|
version: '0'
|
126
126
|
requirements: []
|
127
127
|
rubyforge_project:
|
128
|
-
rubygems_version: 2.
|
128
|
+
rubygems_version: 2.7.3
|
129
129
|
signing_key:
|
130
130
|
specification_version: 4
|
131
131
|
summary: Foreman plugin for monitoring system integration.
|