foreman_abrt 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -31
- data/app/controllers/concerns/foreman_abrt/dashboard_controller_extensions.rb +12 -0
- data/app/helpers/abrt_reports_helper.rb +16 -0
- data/app/models/abrt_report.rb +6 -6
- data/app/views/abrt_reports/_list.html.erb +1 -1
- data/app/views/dashboard/_foreman_abrt_widget.html.erb +2 -0
- data/lib/foreman_abrt/engine.rb +4 -0
- data/lib/foreman_abrt/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e90f9c2daa852c6ac8d2debd86a5d6e6f816641
|
4
|
+
data.tar.gz: aa3047b35ec9493988d41327ebde7ed4add6e507
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90ea5b440d83acf850edb42699fcd3ad1985fef6f4fb5f2cae338909f93e5cdb08082831d5a78a172a9bb0efa045dda41ac2a3f2255021739d6276d8584d3b7e
|
7
|
+
data.tar.gz: 003b81e150d41deab12c8ee4d40a8e4df164d91868b5d0dd331693f5997f9d2190c9309c9400a29096336f37ba1bb1e300adf930d963f167f916ffc98f0f8d95
|
data/README.md
CHANGED
@@ -43,6 +43,10 @@ To be able to see ABRT bug reports in your Foreman instance, you need to
|
|
43
43
|
install the plugin itself, install ABRT plugin for your smart proxies and
|
44
44
|
configure your hosts to send the bug reports to their smart proxy.
|
45
45
|
|
46
|
+
Both plugins are available as RPMs in [Foremay YUM repositories](http://yum.theforeman.org/).
|
47
|
+
|
48
|
+
The plugins require both Foreman and smart-proxy to be version 1.6 or later.
|
49
|
+
|
46
50
|
### Installing the Foreman plugin
|
47
51
|
|
48
52
|
To install the Foreman plugin, follow the [plugin installation
|
@@ -50,28 +54,9 @@ instructions](http://projects.theforeman.org/projects/foreman/wiki/How_to_Instal
|
|
50
54
|
|
51
55
|
### Setting up smart proxies
|
52
56
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
- If you want to use the report aggregation (reports are grouped on the proxy
|
57
|
-
and the same reports are sent only once), you have to install the satyr ruby
|
58
|
-
gem:
|
59
|
-
|
60
|
-
```
|
61
|
-
~# yum install satyr rubygem-ffi
|
62
|
-
~# gem install satyr
|
63
|
-
```
|
64
|
-
|
65
|
-
- Install the ABRT smart-proxy plugin:
|
66
|
-
|
67
|
-
```
|
68
|
-
~$ git clone https://github.com/abrt/smart-proxy-abrt.git
|
69
|
-
~$ cd smart-proxy-abrt
|
70
|
-
~/smart-proxy-abrt$ gem build smart_proxy_abrt.gemspec
|
71
|
-
~/smart-proxy-abrt$ yum install rubygems-devel rubygem-minitest
|
72
|
-
~/smart-proxy-abrt$ rpmbuild --define "_sourcedir `pwd`" -ba extra/rubygem-smart_proxy_abrt.spec
|
73
|
-
~/smart-proxy-abrt$ yum install ~/rpmbuild/RPMS/noarch/rubygem-smart_proxy_abrt*rpm
|
74
|
-
```
|
57
|
+
Follow the [smart-proxy plugin installation
|
58
|
+
instructions](http://projects.theforeman.org/projects/foreman/wiki/How_to_Install_a_Smart-Proxy_Plugin).
|
59
|
+
The plugin needs some configuration in order to work correctly.
|
75
60
|
|
76
61
|
- Edit `/etc/foreman-proxy/settings.yml` to configure the main Foreman host,
|
77
62
|
which is normally not needed. Assuming Foreman runs on `f19-foreman.tld` the
|
@@ -82,17 +67,15 @@ install the ABRT plugin.
|
|
82
67
|
:foreman_url: https://f19-foreman.tld
|
83
68
|
```
|
84
69
|
|
85
|
-
-
|
70
|
+
- Ensure that `/etc/foreman-proxy/settings.d/abrt.yml` contains the following line:
|
86
71
|
```
|
87
|
-
|
88
|
-
/etc/foreman-proxy/settings.d/$ mv abrt.yml.example abrt.yml
|
72
|
+
:enabled: true
|
89
73
|
```
|
90
74
|
|
91
|
-
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
```
|
75
|
+
- Cron is used to transfer the captured bug reports to Foreman in batches.
|
76
|
+
Ensure that the `smart-proxy-abrt-send` command is run periodically. The
|
77
|
+
provided RPM package contains a cron snippet that runs the command every 30
|
78
|
+
minutes.
|
96
79
|
|
97
80
|
### Configuring hosts to send bug reports to Foreman
|
98
81
|
|
@@ -164,7 +147,6 @@ configuration screen (*Administer*->*Settings*).
|
|
164
147
|
|
165
148
|
## TODO
|
166
149
|
|
167
|
-
- Graph with number of reports vs. time on the dashboard.
|
168
150
|
- Forwarding reports on the proxy - drop it altogether, or forward the server
|
169
151
|
response to the client?
|
170
152
|
- Use puppet to configure managed hosts to send ureports to Foreman.
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module ForemanAbrt::DashboardControllerExtensions
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
|
4
|
+
included do
|
5
|
+
before_filter :prefetch_abrt_data, :only => :index
|
6
|
+
end
|
7
|
+
|
8
|
+
def prefetch_abrt_data
|
9
|
+
# fetch reports from last 24 hours
|
10
|
+
@abrt_reports = AbrtReport.authorized(:view_abrt_reports).where(:created_at => (Time.now - 24.hours)..Time.now).search_for(params[:search])
|
11
|
+
end
|
12
|
+
end
|
@@ -6,4 +6,20 @@ module AbrtReportsHelper
|
|
6
6
|
str
|
7
7
|
end
|
8
8
|
end
|
9
|
+
|
10
|
+
def count_abrt_reports abrt_reports
|
11
|
+
data = []
|
12
|
+
interval = 1.hours
|
13
|
+
start = Time.now.utc - 24.hours
|
14
|
+
(0..23).each do |i|
|
15
|
+
t = start + (interval * i)
|
16
|
+
data << [24-i, abrt_reports.where(:created_at => t..(t+interval)).count]
|
17
|
+
end
|
18
|
+
data
|
19
|
+
end
|
20
|
+
|
21
|
+
def render_abrt_graph abrt_reports, options = {}
|
22
|
+
data = count_abrt_reports abrt_reports
|
23
|
+
flot_bar_chart 'abrt_graph', _('Hours Ago'), _('Number of crashes'), data, options
|
24
|
+
end
|
9
25
|
end
|
data/app/models/abrt_report.rb
CHANGED
@@ -30,13 +30,13 @@ class AbrtReport < ActiveRecord::Base
|
|
30
30
|
scoped_search :on => :response_message, :complete_value => true, :rename => :response
|
31
31
|
scoped_search :on => :response_bthash, :complete_value => true, :rename => :bthash
|
32
32
|
|
33
|
-
scoped_search :in => :
|
34
|
-
scoped_search :in => :
|
35
|
-
scoped_search :in => :
|
33
|
+
scoped_search :in => :abrt_report_response_destinations, :on => :reporter, :complete_value => true, :rename => :destination_reporter
|
34
|
+
scoped_search :in => :abrt_report_response_destinations, :on => :desttype, :complete_value => true, :rename => :destination_type
|
35
|
+
scoped_search :in => :abrt_report_response_destinations, :on => :value , :complete_value => true, :rename => :destination_value
|
36
36
|
|
37
|
-
scoped_search :in => :
|
38
|
-
scoped_search :in => :
|
39
|
-
scoped_search :in => :
|
37
|
+
scoped_search :in => :abrt_report_response_solutions, :on => :cause, :complete_value => true, :rename => :solution_cause
|
38
|
+
scoped_search :in => :abrt_report_response_solutions, :on => :note, :complete_value => true, :rename => :solution_note
|
39
|
+
scoped_search :in => :abrt_report_response_solutions, :on => :url, :complete_value => true, :rename => :solution_url
|
40
40
|
|
41
41
|
def self.import(json)
|
42
42
|
host = Host.find_by_name(json[:host])
|
@@ -15,7 +15,7 @@
|
|
15
15
|
<% if abrt_report.host.nil? %>
|
16
16
|
<td></td>
|
17
17
|
<% else %>
|
18
|
-
<td><%= link_to abrt_report.host, host_abrt_reports_path(abrt_report) %></td>
|
18
|
+
<td><%= link_to abrt_report.host, host_abrt_reports_path(abrt_report.host) %></td>
|
19
19
|
<% end %>
|
20
20
|
<% end %>
|
21
21
|
<td> <%= link_to(_("%s ago") % time_ago_in_words(abrt_report.reported_at.getlocal), abrt_report_path(abrt_report)) %> </td>
|
data/lib/foreman_abrt/engine.rb
CHANGED
@@ -39,6 +39,9 @@ module ForemanAbrt
|
|
39
39
|
:caption => _('Bug reports'),
|
40
40
|
:parent => :monitor_menu,
|
41
41
|
:after => :reports
|
42
|
+
|
43
|
+
# add dashboard widget
|
44
|
+
widget 'foreman_abrt_widget', :name => N_('Bug report chart'), :sizex => 6, :sizey => 1
|
42
45
|
end
|
43
46
|
end
|
44
47
|
|
@@ -46,6 +49,7 @@ module ForemanAbrt
|
|
46
49
|
config.to_prepare do
|
47
50
|
begin
|
48
51
|
Host::Managed.send(:include, ForemanAbrt::HostExtensions)
|
52
|
+
DashboardController.send(:include, ForemanAbrt::DashboardControllerExtensions)
|
49
53
|
rescue => e
|
50
54
|
puts "ForemanAbrt: skipping engine hook (#{e.to_s})"
|
51
55
|
end
|
data/lib/foreman_abrt/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_abrt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Milata
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deface
|
@@ -32,6 +32,7 @@ executables: []
|
|
32
32
|
extensions: []
|
33
33
|
extra_rdoc_files: []
|
34
34
|
files:
|
35
|
+
- app/controllers/concerns/foreman_abrt/dashboard_controller_extensions.rb
|
35
36
|
- app/controllers/api/v2/abrt_reports_controller.rb
|
36
37
|
- app/controllers/abrt_reports_controller.rb
|
37
38
|
- app/assets/javascripts/abrt_reports.js
|
@@ -49,6 +50,7 @@ files:
|
|
49
50
|
- app/views/abrt_reports/index.html.erb
|
50
51
|
- app/views/abrt_reports/_list.html.erb
|
51
52
|
- app/views/abrt_reports/show.html.erb
|
53
|
+
- app/views/dashboard/_foreman_abrt_widget.html.erb
|
52
54
|
- config/routes.rb
|
53
55
|
- db/migrate/20140414095631_create_abrt_reports.rb
|
54
56
|
- lib/foreman_abrt/version.rb
|