sumo-check-sumo 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/sumo-check-new-relic-apdex.rb +160 -0
- data/bin/sumo-check-sumo_basic_contact_us_form.rb +54 -0
- data/bin/sumo-check-sumo_main_site_login_logout.rb +110 -0
- metadata +104 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3d6fb0f192134fd82e63b3d83fcc0079c600bd93
|
4
|
+
data.tar.gz: cd079adaf6449d996f908d4caf5751ed6d10ae2a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2c9f8b8be9a7fb308f6c718896be05e7e4eda180d3e6544f614c12af2f226590036d6889c7479703c5a09237e322a6388e5913df54c56abee1303ba80ea84a58
|
7
|
+
data.tar.gz: 453e0a563678b3192e5f87efe02ca6fa64eb7b4fe1a5a06e882b36c12184fefef0fa1f8fe1408d76b07a538952a05d2ad737e566a0ab6401bab3fce5e8c47bd0
|
@@ -0,0 +1,160 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# gem "webdrivers", "~> 3.0"
|
3
|
+
require 'watir'
|
4
|
+
require 'webdrivers'
|
5
|
+
require 'sensu-plugin/check/cli'
|
6
|
+
|
7
|
+
class SensuSumoNewRelicAppdex < Sensu::Plugin::Check::CLI
|
8
|
+
|
9
|
+
option :server,
|
10
|
+
:short => "-s https://newrelic.com/",
|
11
|
+
:long => "--server https://newrelic.com/",
|
12
|
+
:default => 'https://newrelic.com/',
|
13
|
+
:description => "New Relic Site URL"
|
14
|
+
|
15
|
+
option :email,
|
16
|
+
:short => "-e email",
|
17
|
+
:long => "--email bob@smith.com",
|
18
|
+
:default => 'ogg@sr375.com',
|
19
|
+
:description => "email address of sumo account to test"
|
20
|
+
|
21
|
+
option :password,
|
22
|
+
:short => "-p urabus",
|
23
|
+
:long => "--password urabus",
|
24
|
+
:default => 'urabus',
|
25
|
+
:description => "Password to use for test"
|
26
|
+
|
27
|
+
option :app,
|
28
|
+
:short => "-a urabus",
|
29
|
+
:long => "--application urabus",
|
30
|
+
:default => 'urabus',
|
31
|
+
:description => "New Relic Application to Monitor"
|
32
|
+
|
33
|
+
option :error_rate_crit,
|
34
|
+
:short => "-K 5",
|
35
|
+
:long => "--error-rate-crit 5",
|
36
|
+
:default => 5,
|
37
|
+
:description => "Error rate critial in PERCENT"
|
38
|
+
|
39
|
+
option :error_rate_warn,
|
40
|
+
:short => "-k 3",
|
41
|
+
:long => "--error-rate-warn 3",
|
42
|
+
:default => 3,
|
43
|
+
:description => "Error rate warning in PERCENT"
|
44
|
+
|
45
|
+
option :apdex_crit,
|
46
|
+
:short => "-Z 0.94",
|
47
|
+
:long => "--apdex-crit 0.94",
|
48
|
+
:default => 0.94,
|
49
|
+
:description => "Apdex critial"
|
50
|
+
|
51
|
+
option :apdex_warn,
|
52
|
+
:short => "-z 0.96",
|
53
|
+
:long => "--apdex-warn 0.96",
|
54
|
+
:default => 0.96,
|
55
|
+
:description => "Apdex Warn"
|
56
|
+
|
57
|
+
option :interactive,
|
58
|
+
:short => "-i",
|
59
|
+
:default => false,
|
60
|
+
:boolean => true,
|
61
|
+
:description => "Run Chrome in an interactive window"
|
62
|
+
|
63
|
+
|
64
|
+
def run
|
65
|
+
|
66
|
+
args = ['--disable-popup-blocking', '--disable-translate']
|
67
|
+
if config[:interactive]
|
68
|
+
browser = Watir::Browser.new :chrome, options: {args: args}, headless: false
|
69
|
+
else
|
70
|
+
browser = Watir::Browser.new :chrome, options: {args: args}, headless: true
|
71
|
+
end
|
72
|
+
|
73
|
+
browser.goto config[:server]
|
74
|
+
|
75
|
+
begin
|
76
|
+
|
77
|
+
browser.link(:id =>"desk-login").click
|
78
|
+
browser.element(:xpath,'//*[@id="login_submit"]').wait_until_present
|
79
|
+
browser.execute_script("
|
80
|
+
form = document.forms[\"login\"];
|
81
|
+
username = form.elements[\"login_email\"];
|
82
|
+
username.value = \"#{config[:email]}\";
|
83
|
+
")
|
84
|
+
browser.execute_script("
|
85
|
+
form = document.forms[\"login\"];
|
86
|
+
username = form.elements[\"login_password\"];
|
87
|
+
username.value = \"#{config[:password]}\";
|
88
|
+
")
|
89
|
+
browser.element(:xpath => '//*[@id="login_submit"]').click # Click the login button
|
90
|
+
# browser.link(:text =>"SumoMe Production").click
|
91
|
+
browser.link(:text =>config[:app]).click
|
92
|
+
|
93
|
+
monitor_url = browser.url
|
94
|
+
|
95
|
+
# APDEX SCORE
|
96
|
+
browser.element(:xpath => '//*[@id="primary_content"]/div[2]/div[2]/div[1]/h2[1]').wait_until_present
|
97
|
+
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
|
98
|
+
|
99
|
+
# ERROR RATE PERCENT
|
100
|
+
browser.element(:xpath => '//*[@id="hosts_content_container"]/section/h3/div/p').wait_until_present
|
101
|
+
error_rate_percent = browser.element(:xpath => '//*[@id="hosts_content_container"]/section/h3/div/p').text.strip.to_f
|
102
|
+
|
103
|
+
rescue Exception => e
|
104
|
+
critical(e.message)
|
105
|
+
ensure
|
106
|
+
browser.close
|
107
|
+
end
|
108
|
+
|
109
|
+
|
110
|
+
def crital_check(apdex,error)
|
111
|
+
if apdex_score < config[:apdex_crit].to_f && error_rate_percent > config[:error_rate_crit]
|
112
|
+
# Both things are critical
|
113
|
+
critical("Application: #{config[:app]}, Apdex score CRITICAL: #{apdex_score}, Error rate CRITICAL: #{error_rate_percent}%, URL: #{monitor_url}")
|
114
|
+
elsif apdex_score < config[:apdex_crit].to_f
|
115
|
+
# apdex is critial
|
116
|
+
if error_rate_percent > config[:error_rate_warn]
|
117
|
+
# error rate is also wanring
|
118
|
+
critical("Application: #{config[:app]}, Apdex score CRITICAL: #{apdex_score}, Error rate WARNING: #{error_rate_percent}%, URL: #{monitor_url}")
|
119
|
+
else
|
120
|
+
critical("Application: #{config[:app]}, Apdex score CRITICAL: #{apdex_score}, Error rate ok: #{error_rate_percent}%, URL: #{monitor_url}")
|
121
|
+
end
|
122
|
+
|
123
|
+
elsif error_rate_percent > config[:error_rate_crit]
|
124
|
+
# error rate is critial
|
125
|
+
if apdex_score < config[:apdex_warn].to_f
|
126
|
+
critical("Application: #{config[:app]}, Apdex score WARNING: #{apdex_score}, Error rate CRITICAL: #{error_rate_percent}%, URL: #{monitor_url}")
|
127
|
+
else
|
128
|
+
critical("Application: #{config[:app]}, Apdex score ok: #{apdex_score}, Error rate CRITICAL: #{error_rate_percent}%, URL: #{monitor_url}")
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
def warn_check(apdex,error)
|
134
|
+
# Somthings warning....
|
135
|
+
if apdex_score < config[:apdex_warn].to_f && error_rate_percent > config[:error_rate_warn]
|
136
|
+
warning("Application: #{config[:app]}, Apdex score WARNING: #{apdex_score}, Error rate WARNING: #{error_rate_percent}%, URL: #{monitor_url}")
|
137
|
+
elsif apdex_score < config[:apdex_warn].to_f
|
138
|
+
# apdex is warning
|
139
|
+
warning("Application: #{config[:app]}, Apdex score WARNING: #{apdex_score}, Error rate ok: #{error_rate_percent}%, URL: #{monitor_url}")
|
140
|
+
elsif error_rate_percent > config[:error_rate_warn]
|
141
|
+
# error rate is wanring
|
142
|
+
warning("Application: #{config[:app]}, Apdex score ok: #{apdex_score}, Error rate WARNING: #{error_rate_percent}%, URL: #{monitor_url}")
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
|
147
|
+
if apdex_score < config[:apdex_crit].to_f || error_rate_percent > config[:error_rate_crit]
|
148
|
+
# Somthings critial...
|
149
|
+
crital_check(config[:apdex_crit].to_f,config[:error_rate_crit])
|
150
|
+
elsif apdex_score < config[:apdex_warn].to_f || error_rate_percent > config[:error_rate_warn]
|
151
|
+
# Somthings warning...
|
152
|
+
warn_check(config[:apdex_crit].to_f,config[:error_rate_crit])
|
153
|
+
else
|
154
|
+
ok("Application: #{config[:app]} is ok, Apdex Score: #{apdex_score}, Error rate: #{error_rate_percent}%, URL: #{monitor_url}")
|
155
|
+
end
|
156
|
+
|
157
|
+
browser.close
|
158
|
+
end
|
159
|
+
|
160
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# gem "webdrivers", "~> 3.0"
|
3
|
+
require 'watir'
|
4
|
+
require 'webdrivers'
|
5
|
+
require 'sensu-plugin/check/cli'
|
6
|
+
|
7
|
+
# url = "http://test.sr375.com/test-1.html"
|
8
|
+
# url = "http://test.sr375.com/test-2.html"
|
9
|
+
|
10
|
+
class SensuSumoBasicClientTest < Sensu::Plugin::Check::CLI
|
11
|
+
option :server,
|
12
|
+
short: '-s http://localhost',
|
13
|
+
long: '--server',
|
14
|
+
description: 'URL of test suite',
|
15
|
+
default: 'http://sumotest.sumo.com/test-1.html'
|
16
|
+
|
17
|
+
option :interactive,
|
18
|
+
short: '-i',
|
19
|
+
long: '--interactive',
|
20
|
+
boolean: true,
|
21
|
+
default: false,
|
22
|
+
description: 'Run Chrome in an interactive window'
|
23
|
+
|
24
|
+
def run
|
25
|
+
|
26
|
+
args = ['--disable-popup-blocking', '--disable-translate']
|
27
|
+
if config[:interactive]
|
28
|
+
browser = Watir::Browser.new :chrome, options: {args: args}, headless: false
|
29
|
+
else
|
30
|
+
browser = Watir::Browser.new :chrome, options: {args: args}, headless: true
|
31
|
+
end
|
32
|
+
|
33
|
+
browser.goto config[:server]
|
34
|
+
|
35
|
+
logs = browser.driver.manage.logs.get :browser
|
36
|
+
critical(logs.join("\n")) if logs.length > 0
|
37
|
+
|
38
|
+
begin
|
39
|
+
browser.element(:xpath,'//*[@id="sumome-contactform-bp"]/div/div[2]/div[3]/a').wait_until_present
|
40
|
+
browser.element(:xpath,'//*[@id="sumome-contactform-bp"]/div/div[2]/div[3]/a').exists? # Powered by Sumo
|
41
|
+
browser.element(:xpath,'//*[@id="contactform_email_address"]').exists? # Emain address input box
|
42
|
+
browser.element(:xpath, '//*[@id="contactform_message"]').exists? # contact from message
|
43
|
+
rescue Exception => e
|
44
|
+
critical(e.message)
|
45
|
+
ensure
|
46
|
+
browser.close
|
47
|
+
end
|
48
|
+
|
49
|
+
browser.close
|
50
|
+
ok("Checks Passed")
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# gem "webdrivers", "~> 3.0"
|
3
|
+
require 'watir'
|
4
|
+
require 'webdrivers'
|
5
|
+
require 'sensu-plugin/check/cli'
|
6
|
+
|
7
|
+
class SensuSumoLoginLogoutTest < Sensu::Plugin::Check::CLI
|
8
|
+
|
9
|
+
option :server,
|
10
|
+
:short => "-s http://sumo.com",
|
11
|
+
:long => "--server http://sumo.com",
|
12
|
+
:default => 'http://sumo.com',
|
13
|
+
:description => "webserver to run our test on"
|
14
|
+
|
15
|
+
option :email,
|
16
|
+
:short => "-e email",
|
17
|
+
:long => "--email bob@smith.com",
|
18
|
+
:default => 'ogg@sr375.com',
|
19
|
+
:description => "email address of sumo account to test"
|
20
|
+
|
21
|
+
option :password,
|
22
|
+
:short => "-p urabus",
|
23
|
+
:long => "--password urabus",
|
24
|
+
:default => 'urabus',
|
25
|
+
:description => "Password to use for test"
|
26
|
+
|
27
|
+
option :site_name,
|
28
|
+
:short => "-n sr375.com",
|
29
|
+
:long => "--name sr375.com",
|
30
|
+
:default => 'sr375.com',
|
31
|
+
:description => "Site name to check for upon login"
|
32
|
+
|
33
|
+
option :interactive,
|
34
|
+
:short => "-i",
|
35
|
+
:default => false,
|
36
|
+
:boolean => true,
|
37
|
+
:description => "Run Chrome in an interactive window"
|
38
|
+
|
39
|
+
|
40
|
+
def run
|
41
|
+
|
42
|
+
args = ['--disable-popup-blocking', '--disable-translate']
|
43
|
+
if config[:interactive]
|
44
|
+
browser = Watir::Browser.new :chrome, options: {args: args}, headless: false
|
45
|
+
else
|
46
|
+
browser = Watir::Browser.new :chrome, options: {args: args}, headless: true
|
47
|
+
end
|
48
|
+
|
49
|
+
browser.goto config[:server]
|
50
|
+
|
51
|
+
logs = browser.driver.manage.logs.get :browser
|
52
|
+
critical(logs.join("\n")) if logs.length > 0
|
53
|
+
|
54
|
+
begin
|
55
|
+
|
56
|
+
logs = browser.driver.manage.logs.get :browser
|
57
|
+
critical(logs.join("\n")) if logs.length > 0
|
58
|
+
|
59
|
+
browser.link(:title =>"Log In").click
|
60
|
+
|
61
|
+
logs = browser.driver.manage.logs.get :browser
|
62
|
+
critical(logs.join("\n")) if logs.length > 0
|
63
|
+
|
64
|
+
browser.element(:xpath,'//*[@id="loginForm"]/div[2]/div/div/div/fieldset/h3').wait_until_present
|
65
|
+
browser.execute_script("
|
66
|
+
form = document.forms[\"loginForm\"];
|
67
|
+
username = form.elements[\"email\"];
|
68
|
+
username.value = \"#{config[:email]}\";
|
69
|
+
")
|
70
|
+
browser.execute_script("
|
71
|
+
form = document.forms[\"loginForm\"];
|
72
|
+
username = form.elements[\"password\"];
|
73
|
+
username.value = \"#{config[:password]}\";
|
74
|
+
")
|
75
|
+
|
76
|
+
# browser.element(:xpath => '//*[@id="loginForm"]/div[2]/div/div/div/fieldset/div[3]/div/button').click
|
77
|
+
browser.element(:xpath => '//*[@id="loginForm"]/div[2]/div/div/div[1]/fieldset/div[4]/div/button').click
|
78
|
+
|
79
|
+
# browser.element(:xpath,'/html/body/div[1]/div/div[2]/div/ul/li[1]/a').wait_until_present
|
80
|
+
browser.element(:xpath,'/html/body/div/div/div[2]/div/div/div[3]/div/a').wait_until_present
|
81
|
+
|
82
|
+
|
83
|
+
logs = browser.driver.manage.logs.get :browser
|
84
|
+
critical(logs.join("\n")) if logs.length > 0
|
85
|
+
|
86
|
+
critical("Login Unsuccessful") if !browser.text.include? config[:site_name]
|
87
|
+
|
88
|
+
browser.element(:xpath => "/html/body/div[1]/div/div[1]/div[2]/div/div/div[3]/div/a").hover
|
89
|
+
browser.link(:title =>"Log Out").click
|
90
|
+
|
91
|
+
logs = browser.driver.manage.logs.get :browser
|
92
|
+
critical(logs.join("\n")) if logs.length > 0
|
93
|
+
|
94
|
+
browser.element(:xpath,'/html/body/div[1]/div/div[2]/div[4]/div/form/div/div/div/div[2]').wait_until_present
|
95
|
+
|
96
|
+
critical("Log Out Unsuccessful") if browser.text.include? config[:site_name]
|
97
|
+
|
98
|
+
|
99
|
+
rescue Exception => e
|
100
|
+
critical(e.message)
|
101
|
+
ensure
|
102
|
+
browser.close
|
103
|
+
end
|
104
|
+
|
105
|
+
#browser.close
|
106
|
+
ok("Login Logout Test Passed")
|
107
|
+
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|
metadata
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sumo-check-sumo
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dr. Ogg
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-10-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: sensu-plugin
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.3'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: selenium-webdriver
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.6'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.6'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: webdrivers
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.2'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: watir
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '6.8'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '6.8'
|
69
|
+
description:
|
70
|
+
email:
|
71
|
+
executables:
|
72
|
+
- sumo-check-sumo_basic_contact_us_form.rb
|
73
|
+
- sumo-check-sumo_main_site_login_logout.rb
|
74
|
+
- sumo-check-new-relic-apdex.rb
|
75
|
+
extensions: []
|
76
|
+
extra_rdoc_files: []
|
77
|
+
files:
|
78
|
+
- bin/sumo-check-new-relic-apdex.rb
|
79
|
+
- bin/sumo-check-sumo_basic_contact_us_form.rb
|
80
|
+
- bin/sumo-check-sumo_main_site_login_logout.rb
|
81
|
+
homepage:
|
82
|
+
licenses: []
|
83
|
+
metadata: {}
|
84
|
+
post_install_message:
|
85
|
+
rdoc_options: []
|
86
|
+
require_paths:
|
87
|
+
- lib
|
88
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
requirements: []
|
99
|
+
rubyforge_project:
|
100
|
+
rubygems_version: 2.6.13
|
101
|
+
signing_key:
|
102
|
+
specification_version: 4
|
103
|
+
summary: Sumo Sensu gem for testing our front end website
|
104
|
+
test_files: []
|