sumo-check-sumo 0.0.5 → 0.0.6

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: 6b6d2dd74de46a9e4a2501f88a62fcefc435c1e5
4
- data.tar.gz: 65b1ec4385c41f3f78fddd608f249792c1d0768d
3
+ metadata.gz: d773c4e4933743f368a57908cac40f2180a6a1f8
4
+ data.tar.gz: 5f26a4048788a223d10f1938fab9213bac1419dc
5
5
  SHA512:
6
- metadata.gz: 12353d2c31d73d2577ed904605a39a0f58d009b553d650326ba547a6d1567a3f3775b79df39355fa788ef60d2bc33f48d986e9b377b20265577a30020ec7fb51
7
- data.tar.gz: 6f369a3ff1e8f6370d46d7261791f6032277075062a6a2f82c97ee87109ba1ae5495e4ae84f5aa5ce07342f93e3d6affad626c8465f42baaf326e86e01d72b27
6
+ metadata.gz: 8d06bd80c957767d9a09badce28c280db53a6961b94810bb4c46ff65af8d0f27c909eea8fa3544bfe13d4e1d0fc135c9b5793bafa2d32f7d7ce562e42a676d50
7
+ data.tar.gz: acd3652ff878d7c7aee2d664929fddb96586323dc453e7957daef351e8e44d2af5d8d73b03625c92de54c0c8cab7035f298f7fa90447a90719912c3b6ccd1caa
@@ -35,7 +35,6 @@ class SensuSumoNewRelicAppdex < Sensu::Plugin::Check::CLI
35
35
  :long => "--error-rate-crit 5",
36
36
  :default => 5,
37
37
  :description => "Error rate critial in PERCENT"
38
-
39
38
  option :error_rate_warn,
40
39
  :short => "-k 3",
41
40
  :long => "--error-rate-warn 3",
@@ -63,6 +62,7 @@ class SensuSumoNewRelicAppdex < Sensu::Plugin::Check::CLI
63
62
 
64
63
  def run
65
64
 
65
+
66
66
  args = ['--disable-popup-blocking', '--disable-translate','--no-sandbox']
67
67
  if config[:interactive]
68
68
  browser = Watir::Browser.new :chrome, options: {args: args}, headless: false
@@ -92,15 +92,15 @@ class SensuSumoNewRelicAppdex < Sensu::Plugin::Check::CLI
92
92
  # browser.link(:text =>"SumoMe Production").click
93
93
  browser.link(:text =>config[:app]).click
94
94
 
95
- monitor_url = browser.url
95
+ @monitor_url = browser.url
96
96
 
97
97
  # APDEX SCORE
98
98
  browser.element(:xpath => '//*[@id="primary_content"]/div[2]/div[2]/div[1]/h2[1]').wait_until_present
99
- apdex_score = browser.element(:xpath => '//*[@id="primary_content"]/div[2]/div[2]/div[1]/h2[1]/div/p[1]').text.strip.split(' ')[0].to_f
99
+ @apdex_score = browser.element(:xpath => '//*[@id="primary_content"]/div[2]/div[2]/div[1]/h2[1]/div/p[1]').text.strip.split(' ')[0].to_f
100
100
 
101
101
  # ERROR RATE PERCENT
102
102
  browser.element(:xpath => '//*[@id="hosts_content_container"]/section/h3/div/p').wait_until_present
103
- error_rate_percent = browser.element(:xpath => '//*[@id="hosts_content_container"]/section/h3/div/p').text.strip.to_f
103
+ @error_rate_percent = browser.element(:xpath => '//*[@id="hosts_content_container"]/section/h3/div/p').text.strip.to_f
104
104
 
105
105
  rescue Exception => e
106
106
  critical(e.message)
@@ -110,50 +110,50 @@ class SensuSumoNewRelicAppdex < Sensu::Plugin::Check::CLI
110
110
 
111
111
 
112
112
  def crital_check(apdex,error)
113
- if apdex_score < config[:apdex_crit].to_f && error_rate_percent > config[:error_rate_crit]
113
+ if @apdex_score < config[:apdex_crit].to_f && @error_rate_percent > config[:error_rate_crit].to_f
114
114
  # Both things are critical
115
- critical("Application: #{config[:app]}, Apdex score CRITICAL: #{apdex_score}, Error rate CRITICAL: #{error_rate_percent}%, URL: #{monitor_url}")
116
- elsif apdex_score < config[:apdex_crit].to_f
115
+ critical("Application: #{config[:app]}, Apdex score CRITICAL: #{@apdex_score}, Error rate CRITICAL: #{@error_rate_percent}%, URL: #{@monitor_url}")
116
+ elsif @apdex_score < config[:apdex_crit].to_f
117
117
  # apdex is critial
118
- if error_rate_percent > config[:error_rate_warn]
118
+ if @error_rate_percent > config[:error_rate_warn].to_f.to_f
119
119
  # error rate is also wanring
120
- critical("Application: #{config[:app]}, Apdex score CRITICAL: #{apdex_score}, Error rate WARNING: #{error_rate_percent}%, URL: #{monitor_url}")
120
+ critical("Application: #{config[:app]}, Apdex score CRITICAL: #{@apdex_score}, Error rate WARNING: #{@error_rate_percent}%, URL: #{@monitor_url}")
121
121
  else
122
- critical("Application: #{config[:app]}, Apdex score CRITICAL: #{apdex_score}, Error rate ok: #{error_rate_percent}%, URL: #{monitor_url}")
122
+ critical("Application: #{config[:app]}, Apdex score CRITICAL: #{@apdex_score}, Error rate ok: #{@error_rate_percent}%, URL: #{@monitor_url}")
123
123
  end
124
124
 
125
- elsif error_rate_percent > config[:error_rate_crit]
125
+ elsif @error_rate_percent > config[:error_rate_crit].to_f
126
126
  # error rate is critial
127
- if apdex_score < config[:apdex_warn].to_f
128
- critical("Application: #{config[:app]}, Apdex score WARNING: #{apdex_score}, Error rate CRITICAL: #{error_rate_percent}%, URL: #{monitor_url}")
127
+ if @apdex_score < config[:apdex_warn].to_f
128
+ critical("Application: #{config[:app]}, Apdex score WARNING: #{@apdex_score}, Error rate CRITICAL: #{@error_rate_percent}%, URL: #{@monitor_url}")
129
129
  else
130
- critical("Application: #{config[:app]}, Apdex score ok: #{apdex_score}, Error rate CRITICAL: #{error_rate_percent}%, URL: #{monitor_url}")
130
+ critical("Application: #{config[:app]}, Apdex score ok: #{@apdex_score}, Error rate CRITICAL: #{@error_rate_percent}%, URL: #{@monitor_url}")
131
131
  end
132
132
  end
133
133
  end
134
134
 
135
135
  def warn_check(apdex,error)
136
136
  # Somthings warning....
137
- if apdex_score < config[:apdex_warn].to_f && error_rate_percent > config[:error_rate_warn]
138
- warning("Application: #{config[:app]}, Apdex score WARNING: #{apdex_score}, Error rate WARNING: #{error_rate_percent}%, URL: #{monitor_url}")
139
- elsif apdex_score < config[:apdex_warn].to_f
137
+ if @apdex_score < config[:apdex_warn].to_f && @error_rate_percent > config[:error_rate_warn].to_f
138
+ warning("Application: #{config[:app]}, Apdex score WARNING: #{@apdex_score}, Error rate WARNING: #{@error_rate_percent}%, URL: #{@monitor_url}")
139
+ elsif @apdex_score < config[:apdex_warn].to_f
140
140
  # apdex is warning
141
- warning("Application: #{config[:app]}, Apdex score WARNING: #{apdex_score}, Error rate ok: #{error_rate_percent}%, URL: #{monitor_url}")
142
- elsif error_rate_percent > config[:error_rate_warn]
141
+ warning("Application: #{config[:app]}, Apdex score WARNING: #{@apdex_score}, Error rate ok: #{@error_rate_percent}%, URL: #{@monitor_url}")
142
+ elsif @error_rate_percent > config[:error_rate_warn].to_f
143
143
  # error rate is wanring
144
- warning("Application: #{config[:app]}, Apdex score ok: #{apdex_score}, Error rate WARNING: #{error_rate_percent}%, URL: #{monitor_url}")
144
+ warning("Application: #{config[:app]}, Apdex score ok: #{@apdex_score}, Error rate WARNING: #{@error_rate_percent}%, URL: #{@monitor_url}")
145
145
  end
146
146
  end
147
147
 
148
148
 
149
- if apdex_score < config[:apdex_crit].to_f || error_rate_percent > config[:error_rate_crit]
149
+ if @apdex_score < config[:apdex_crit].to_f || @error_rate_percent > config[:error_rate_crit].to_f
150
150
  # Somthings critial...
151
- crital_check(config[:apdex_crit].to_f,config[:error_rate_crit])
152
- elsif apdex_score < config[:apdex_warn].to_f || error_rate_percent > config[:error_rate_warn]
151
+ crital_check(config[:apdex_crit].to_f,config[:error_rate_crit].to_f)
152
+ elsif @apdex_score < config[:apdex_warn].to_f || @error_rate_percent > config[:error_rate_warn].to_f
153
153
  # Somthings warning...
154
- warn_check(config[:apdex_crit].to_f,config[:error_rate_crit])
154
+ warn_check(config[:apdex_crit].to_f,config[:error_rate_crit].to_f)
155
155
  else
156
- ok("Application: #{config[:app]} is ok, Apdex Score: #{apdex_score}, Error rate: #{error_rate_percent}%, URL: #{monitor_url}")
156
+ ok("Application: #{config[:app]} is ok, Apdex Score: #{@apdex_score}, Error rate: #{@error_rate_percent}%, URL: #{@monitor_url}")
157
157
  end
158
158
 
159
159
  browser.close
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sumo-check-sumo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dr. Ogg