my_nagios 0.0.21 → 0.0.22

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: c2c794797fd9afb6c4b351d3f18f97a82f91353d
4
- data.tar.gz: 083333d13eb6f26614edaa8810f3207f7fb0491f
3
+ metadata.gz: 005a2d3a1d87debfa2bd09ba55382e2a01e57d00
4
+ data.tar.gz: 80224bda33b1880e06e95cb83733e4962cc035a7
5
5
  SHA512:
6
- metadata.gz: b87f9ad9d59c82fa234c05072a428481e6da1887cf9c26b0fdd24dfc82bf1af4cbe14f85627f66fe042ffd8944d17d0c9f8b6ed31be1cd4bafb1978eaec18669
7
- data.tar.gz: fbad8116f69f35617a3bff242b80dc2543e0db5a768bb4d41cc85d84da5a72a38605eaed6c336ff417998c85e84d8362c9b67e45349c86633c99f3d3f91da049
6
+ metadata.gz: 73ae5dece408756ae52ef4d1205cd782dfcf204684e99a3cd05fcc7bbc4f2b418303b443d0465627169c62996c04a4edeca8e8eb67b5ca04d4b46258b070ea95
7
+ data.tar.gz: 40fbece622f7f4a993f5158ac08366cf8459b022f6daae10eb95612319020a7b64724a71affc66527613b0f5f44dd7daaf264dcabde89da1c613dd83bfdcf05a
@@ -7,7 +7,7 @@ class ScheduleByIntervalJob
7
7
 
8
8
  # Run each Check separately (new ssh connection for each check even common host)
9
9
  if one_by_one
10
- MyNagios::Check.where(interval: options['interval']).each do |check|
10
+ MyNagios::Check.enabled.not_snoozed.where(interval: options['interval']).each do |check|
11
11
  MonitoringJob.perform_async(check)
12
12
  end
13
13
 
@@ -23,10 +23,10 @@ module MyNagios
23
23
 
24
24
  self.additional_command_result = ssh.exec!(self.additional_command) if not self.additional_command.blank? and status.eql?(:critical)
25
25
 
26
- self.update(state: :completed, status: status, latest_state: result, latest_updated_at: Time.now)
26
+ self.update(state: :completed, status: status, latest_state: result, latest_updated_at: Time.now, retry_count: 0)
27
27
  end
28
28
  rescue => e
29
- self.update(state: :completed, status: :info, latest_state: e, latest_updated_at: Time.now)
29
+ self.update(state: :completed, status: :info, latest_state: e, latest_updated_at: Time.now, retry_count: (self.retry_count + 1))
30
30
  end
31
31
  end
32
32
 
@@ -43,12 +43,12 @@ module MyNagios
43
43
 
44
44
  check.additional_command_result = ssh.exec!(check.additional_command) if not check.additional_command.blank? and status.eql?(:critical)
45
45
 
46
- check.update(state: :completed, status: status, latest_state: result, latest_updated_at: Time.now)
46
+ check.update(state: :completed, status: status, latest_state: result, latest_updated_at: Time.now, retry_count: 0)
47
47
  end
48
48
  end
49
49
 
50
50
  rescue => e
51
- check_list.each { |check| check.update(state: :completed, status: :info, latest_state: e, latest_updated_at: Time.now) }
51
+ check_list.each { |check| check.update(state: :completed, status: :info, latest_state: e, latest_updated_at: Time.now, retry_count: (check.retry_count + 1)) }
52
52
  end
53
53
  end
54
54
 
@@ -22,6 +22,9 @@
22
22
  %span.label{ class: "label-#{status_to_label(check.status)}"}= check.status
23
23
  =check.latest_state
24
24
 
25
+ - if check.retry_count > 0
26
+ %strong= "(retries count: #{check.retry_count})"
27
+
25
28
  - if is_snooze
26
29
  %div.snooze_for
27
30
  Snooze for: #{check.snooze_for}
@@ -6,7 +6,7 @@
6
6
  =form_tag group_action_path do
7
7
  Please, set action for selected checks:
8
8
  =select_tag :check_group_action, options_for_select(['Disable', 'Enable', 'Snooze for'])
9
- =select_tag :snooze_time_select, options_for_select(['15 min', '30 min', '60 min'])
9
+ =select_tag :snooze_time_select, options_for_select([['15 min', '15'], ['30 min', '30'], ['1 h', '60'], ['3h', '180'], ['6h', '360'], ['12h', '720']])
10
10
  =hidden_field_tag :group_action_check_ids
11
11
  =submit_tag
12
12
 
@@ -0,0 +1,5 @@
1
+ class AddRetryCountToCheck < ActiveRecord::Migration
2
+ def change
3
+ add_column :my_nagios_checks, :retry_count, :integer, default: 0
4
+ end
5
+ end
@@ -1,3 +1,3 @@
1
1
  module MyNagios
2
- VERSION = "0.0.21"
2
+ VERSION = "0.0.22"
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.21
4
+ version: 0.0.22
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-08-23 00:00:00.000000000 Z
11
+ date: 2016-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -196,6 +196,7 @@ files:
196
196
  - db/migrate/20160601081654_add_regexp_to_check.rb
197
197
  - db/migrate/20160621080454_additional_command.rb
198
198
  - db/migrate/20160823134410_add_snooze_for_check.rb
199
+ - db/migrate/20160915190233_add_retry_count_to_check.rb
199
200
  - lib/my_nagios.rb
200
201
  - lib/my_nagios/engine.rb
201
202
  - lib/my_nagios/version.rb