apache_server_status 0.1.1.pre.beta → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +35 -0
  3. data/apache_server_status.gemspec +1 -1
  4. data/lib/apache_server_status/ass/public/js/main.js +54 -0
  5. data/{ass → lib/apache_server_status/ass}/views/layout.erb +23 -28
  6. data/lib/apache_server_status/version.rb +1 -1
  7. data/lib/public/css/style.css +9 -0
  8. data/lib/public/js/main.js +2 -9
  9. data/lib/views/layout.erb +4 -18
  10. metadata +7 -29
  11. data/ass/Gemfile +0 -6
  12. data/ass/Gemfile.lock +0 -60
  13. data/ass/ass.rb +0 -53
  14. data/ass/config.ru +0 -3
  15. data/ass/public/css/style.css +0 -85
  16. data/ass/public/js/jquery-3.2.0.js +0 -10244
  17. data/ass/public/js/main.js +0 -51
  18. data/ass/public/vendor/bootstrap-3.3.7-dist/css/bootstrap-theme.css +0 -587
  19. data/ass/public/vendor/bootstrap-3.3.7-dist/css/bootstrap-theme.css.map +0 -1
  20. data/ass/public/vendor/bootstrap-3.3.7-dist/css/bootstrap-theme.min.css +0 -6
  21. data/ass/public/vendor/bootstrap-3.3.7-dist/css/bootstrap-theme.min.css.map +0 -1
  22. data/ass/public/vendor/bootstrap-3.3.7-dist/css/bootstrap.css +0 -6757
  23. data/ass/public/vendor/bootstrap-3.3.7-dist/css/bootstrap.css.map +0 -1
  24. data/ass/public/vendor/bootstrap-3.3.7-dist/css/bootstrap.min.css +0 -6
  25. data/ass/public/vendor/bootstrap-3.3.7-dist/css/bootstrap.min.css.map +0 -1
  26. data/ass/public/vendor/bootstrap-3.3.7-dist/fonts/glyphicons-halflings-regular.eot +0 -0
  27. data/ass/public/vendor/bootstrap-3.3.7-dist/fonts/glyphicons-halflings-regular.svg +0 -288
  28. data/ass/public/vendor/bootstrap-3.3.7-dist/fonts/glyphicons-halflings-regular.ttf +0 -0
  29. data/ass/public/vendor/bootstrap-3.3.7-dist/fonts/glyphicons-halflings-regular.woff +0 -0
  30. data/ass/public/vendor/bootstrap-3.3.7-dist/fonts/glyphicons-halflings-regular.woff2 +0 -0
  31. data/ass/public/vendor/bootstrap-3.3.7-dist/js/bootstrap.js +0 -2377
  32. data/ass/public/vendor/bootstrap-3.3.7-dist/js/bootstrap.min.js +0 -7
  33. data/ass/public/vendor/bootstrap-3.3.7-dist/js/npm.js +0 -13
  34. data/ass/views/index.erb +0 -44
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4760abacb59cfcc7ed9a9841e097bcdbefcb768b
4
- data.tar.gz: 68a2693839133b4a34e1db9132346c94528c60d5
3
+ metadata.gz: ac91341ec4e4391af856b59d60cb03702b6b21da
4
+ data.tar.gz: 022dccb1a8b70c311f42be7c0d5837312ec18538
5
5
  SHA512:
6
- metadata.gz: a178032c74022682a6f4cc96bf023af0d1058b9d149bff1279762f243701b143cea78418cd5e1a395a2c6b6090b7efc9571068ff021bb689e5897a6f8febff43
7
- data.tar.gz: 44c67c1046c04a0dc4d795bb9296e228b1242ec7226f03b3d2c4fea1cc47204243ed6bd5d8560077fbcbb48f7e58e1b1f8b20dd7284f95e8871540bfeae94c5a
6
+ metadata.gz: bf1277e6ff35966daa7e5e071fd1327d9fc836dc01fcfeeff735143abb10b1812180088dd67764d761378d1d97bd08074c591cbbf42cd978d8d9d0a9c015e0d1
7
+ data.tar.gz: 8da3e344375435f0a8ebac5e8fc42189529223c75f3bbcb3112cb757f3d4e0c22bc3a0c182566de41e2f6968a8fc91f6f481e22f369874e80b85804c9cf9a967
data/README.md CHANGED
@@ -0,0 +1,35 @@
1
+ # Apache Server Status - Ass
2
+
3
+ A simple ruby gem that provides a pretty web interface to track apache server status in real time.
4
+
5
+ ![Server Status](http://res.cloudinary.com/dvnjqhdxp/image/upload/v1490048069/ezgif.com-video-to-gif.gif)
6
+
7
+
8
+ ## PREREQUIREMENT (IMPORTANT)
9
+
10
+ You need to have mod_status installed in your server. Example of how to install: [CentOs specific example](http://www.tecmint.com/monitor-apache-web-server-load-and-page-statistics/). After installing make sure yoursevername.com/server-status is functioning.
11
+
12
+ ## Installation
13
+ Or install it yourself as:
14
+
15
+ $ gem install apache_server_status --pre
16
+
17
+
18
+ ## USAGE
19
+
20
+ Run the following command on your terminal:
21
+
22
+ $ ass
23
+
24
+ You should see the following message:
25
+
26
+ ```
27
+ $ Puma starting in single mode...
28
+ * Version 3.8.2 (ruby 2.3.3-p222), codename: Sassy Salamander
29
+ * Min threads: 0, max threads: 16
30
+ * Environment: development
31
+ * Listening on tcp://localhost:4567
32
+ Use Ctrl-C to stop
33
+ ```
34
+
35
+ Now navigate to 'localhost:4567' and you will see a web interface with a form to add domain. Provide full domain without 'http' or 'https', just 'yourDomaninName.com'. You can provide as many you want. And navigate through the servers to track status.
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ['suyeshb@gmail.com']
11
11
 
12
12
  spec.summary = 'Beautify apache server status'
13
- spec.description = 'Beautify apache server status'
13
+ spec.description = 'A simple ruby gem that provides a pretty web interface to track apache server status in real time.'
14
14
  spec.homepage = 'https://github.com/suyesh/apache_server_status'
15
15
  spec.license = 'MIT'
16
16
 
@@ -0,0 +1,54 @@
1
+ <<<<<<< HEAD
2
+ $(document).ready(function () {
3
+ $("#servers li a").click(function () {
4
+ $(this).parent().addClass('active').siblings().removeClass('active');
5
+ var server = $('li.active a').text();
6
+ $("#appname").text(server);
7
+ setInterval(function () {
8
+ $.getJSON(('http://localhost:4567/' + server), function (data) {
9
+ =======
10
+ $(document).ready(function() {
11
+ $("#servers li a").click(function() {
12
+ $(this).parent().addClass('active').siblings().removeClass('active');
13
+ var server = $('li.active a').text();
14
+ $("#appname").text(server);
15
+ setInterval(function() {
16
+ $.getJSON(('http://localhost:4567/' + server), function(data) {
17
+ >>>>>>> develop
18
+ $(".box-requests").text(data.requests);
19
+ $(".box-idle-workers").text(data.idle_workers);
20
+ $(".box-requests-per-second").text(data.requests_per_second);
21
+ $(".box-cpu").text(data.cpu);
22
+ $(".box-load-average").text(data.load_average);
23
+ $(".box-size-per-req").text(data.size_per_request);
24
+ $(".box-title").text(data.size_title);
25
+ });
26
+ }, 500);
27
+ <<<<<<< HEAD
28
+ });
29
+ });
30
+ =======
31
+ });
32
+ });
33
+
34
+ //TODO: Add servers from interface
35
+ // $("#domain-name-button").click(function() {
36
+ // var domain = $('#domain-name').val();
37
+ // $("#servers").append('<li role="separator" class="divider"></li>');
38
+ // $("#servers").append('<li><a href="#">' + domain + '</a></li>');
39
+ // $("#notification").append('<div class="alert alert-success alert-dismissible" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button><strong>Success!</strong><em>' +
40
+ // ' ' + domain + '</em> has been successfylly added to your servers list.');
41
+ // $("#notification").fadeOut(1000);
42
+ // });
43
+ //
44
+ // $("#domain-name").keypress(function(e) {
45
+ // if (e.which == 13) {
46
+ // var domain = $('#domain-name').val();
47
+ // $("#servers").append('<li role="separator" class="divider"></li>');
48
+ // $("#servers").append('<li><a href="#">' + domain + '</a></li>');
49
+ // $("#notification").append('<div class="alert alert-success alert-dismissible" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button><strong>Success!</strong><em>' +
50
+ // ' ' + domain + '</em> has been successfylly added to your servers list.');
51
+ // $("#notification").fadeOut(1000);
52
+ // }
53
+ // });
54
+ >>>>>>> develop
@@ -5,16 +5,8 @@
5
5
  <meta charset="utf-8">
6
6
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1">
8
- <meta http-equiv="cache-control" content="max-age=0"/>
9
- <meta http-equiv="cache-control" content="no-cache"/>
10
- <meta http-equiv="expires" content="0"/>
11
- <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT"/>
12
- <meta http-equiv="pragma" content="no-cache"/>
13
8
  <title>Apache Server Status</title>
14
- <!-- Latest compiled and minified CSS -->
15
9
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
16
-
17
- <!-- Optional theme -->
18
10
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
19
11
  <link rel="stylesheet" href="css/style.css">
20
12
  </head>
@@ -29,7 +21,11 @@
29
21
  <span class="icon-bar"></span>
30
22
  <span class="icon-bar"></span>
31
23
  </button>
24
+ <<<<<<< HEAD
25
+ <a class="navbar-brand" href="#">Apache Server Status
26
+ =======
32
27
  <a class="navbar-brand" href="/">Apache Server Status
28
+ >>>>>>> develop
33
29
  <strong id="appname"></strong>
34
30
  </a>
35
31
  </div>
@@ -48,32 +44,31 @@
48
44
  </ul>
49
45
  </li>
50
46
  </ul>
51
- <form class="navbar-form navbar-left">
47
+ <!-- <form class="navbar-form navbar-left">
52
48
  <div class="form-group">
53
49
  <input type="text" class="form-control" placeholder="domain name" id="domain-name">
54
50
  </div>
55
- <a href="#" class="btn btn-success" id="domain-name-button">Add Server</a>
56
- </form>
57
- </div>
51
+ <a href="#" class="btn btn-success" id="domain-name-button">Add Server</a>
52
+ </form> -->
58
53
  </div>
54
+ <<<<<<< HEAD
59
55
  </nav>
60
- <div class="container" id="notification"></div>
61
-
62
- </div>
63
- <div class="container">
64
- <!-- <ul class="nav nav-pills" id="servers">
65
- <% @servers.each do |server| %>
66
- <li>
67
- <a href="#"><%= server%></a>
68
- </li>
69
- <%end%>
70
- </ul> -->
71
56
  <%= yield %>
72
- </div>
73
- <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
74
- <!-- Latest compiled and minified JavaScript -->
75
- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
76
- <script src="js/main.js" type="text/javascript"></script>
57
+ <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
58
+ <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
59
+ <script src="js/main.js" type="text/javascript"></script>
60
+ </body>
61
+ =======
62
+ </div>
63
+ </nav>
64
+ <div class="container" id="notification"></div>
65
+
66
+ </div>
67
+ <%= yield %>
68
+ <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
69
+ <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
70
+ <script src="js/main.js" type="text/javascript"></script>
77
71
  </body>
72
+ >>>>>>> develop
78
73
 
79
74
  </html>
@@ -1,3 +1,3 @@
1
1
  module ApacheServerStatus
2
- VERSION = "0.1.1-beta"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -80,6 +80,15 @@
80
80
  height: 300px;
81
81
  }
82
82
 
83
+ .nav > li > a:hover {
84
+ background-color: #34495e;
85
+ }
86
+
83
87
  .nav-pills>li.active>a, .nav-pills>li.active>a:focus, .nav-pills>li.active>a:hover {
84
88
  background-color: #34495e;
85
89
  }
90
+
91
+ .nav > li > a {
92
+ color: white;
93
+ background-color: #337ab7;
94
+ }
@@ -29,23 +29,16 @@ $("#servers li a").click(addActiveClass);
29
29
 
30
30
  $("#domain-name-button").click(function() {
31
31
  var domain = $('#domain-name').val();
32
- $("#servers").append('<li role="separator" class="divider"></li>');
33
32
  $("#servers").append('<li><a href="#">' + domain + '</a></li>');
34
- $("#notification").append('<div class="alert alert-success alert-dismissible"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button><strong>Success!</strong><em>' +
35
- ' ' + domain + '</em> has been successfylly added to your servers list.');
36
- $("#notification").fadeOut(1000);
37
- $("#notification .alert").remove();
33
+ $('#domain-name').val('');
38
34
  $( "#servers li a").click(addActiveClass);
39
35
  });
40
36
 
41
37
  $("#domain-name").keypress(function(e) {
42
38
  if (e.which == 13) {
43
39
  var domain = $('#domain-name').val();
44
- $("#servers").append('<li role="separator" class="divider"></li>');
45
40
  $("#servers").append('<li><a href="#">' + domain + '</a></li>');
46
- $("#notification").append('<div class="alert alert-success alert-dismissible" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button><strong>Success!</strong><em>' +
47
- ' ' + domain + '</em> has been successfylly added to your servers list.');
48
- $("#notification").fadeOut(1000);
41
+ $('#domain-name').val('');
49
42
  $( "#servers li a").click(addActiveClass);
50
43
  }
51
44
  });
@@ -29,25 +29,11 @@
29
29
  <span class="icon-bar"></span>
30
30
  <span class="icon-bar"></span>
31
31
  </button>
32
- <a class="navbar-brand" href="/">Apache Server Status
32
+ <span class="navbar-brand">Apache Server Status
33
33
  <strong id="appname"></strong>
34
- </a>
34
+ </span>
35
35
  </div>
36
36
  <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
37
- <ul class="nav navbar-nav">
38
- <li class="dropdown">
39
- <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Servers<span class="caret"></span>
40
- </a>
41
- <ul class="dropdown-menu" id="servers">
42
- <% @servers.each do |server| %>
43
- <li role="separator" class="divider"></li>
44
- <li>
45
- <a href="#"><%= server%></a>
46
- </li>
47
- <%end%>
48
- </ul>
49
- </li>
50
- </ul>
51
37
  <form class="navbar-form navbar-left">
52
38
  <div class="form-group">
53
39
  <input type="text" class="form-control" placeholder="domain name" id="domain-name">
@@ -61,13 +47,13 @@
61
47
 
62
48
  </div>
63
49
  <div class="container">
64
- <!-- <ul class="nav nav-pills" id="servers">
50
+ <ul class="nav nav-pills" id="servers">
65
51
  <% @servers.each do |server| %>
66
52
  <li>
67
53
  <a href="#"><%= server%></a>
68
54
  </li>
69
55
  <%end%>
70
- </ul> -->
56
+ </ul>
71
57
  <%= yield %>
72
58
  </div>
73
59
  <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apache_server_status
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1.pre.beta
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Suyesh Bhandari
@@ -106,7 +106,8 @@ dependencies:
106
106
  - - "~>"
107
107
  - !ruby/object:Gem::Version
108
108
  version: 0.19.4
109
- description: Beautify apache server status
109
+ description: A simple ruby gem that provides a pretty web interface to track apache
110
+ server status in real time.
110
111
  email:
111
112
  - suyeshb@gmail.com
112
113
  executables:
@@ -121,35 +122,12 @@ files:
121
122
  - README.md
122
123
  - Rakefile
123
124
  - apache_server_status.gemspec
124
- - ass/Gemfile
125
- - ass/Gemfile.lock
126
- - ass/ass.rb
127
- - ass/config.ru
128
- - ass/public/css/style.css
129
- - ass/public/js/jquery-3.2.0.js
130
- - ass/public/js/main.js
131
- - ass/public/vendor/bootstrap-3.3.7-dist/css/bootstrap-theme.css
132
- - ass/public/vendor/bootstrap-3.3.7-dist/css/bootstrap-theme.css.map
133
- - ass/public/vendor/bootstrap-3.3.7-dist/css/bootstrap-theme.min.css
134
- - ass/public/vendor/bootstrap-3.3.7-dist/css/bootstrap-theme.min.css.map
135
- - ass/public/vendor/bootstrap-3.3.7-dist/css/bootstrap.css
136
- - ass/public/vendor/bootstrap-3.3.7-dist/css/bootstrap.css.map
137
- - ass/public/vendor/bootstrap-3.3.7-dist/css/bootstrap.min.css
138
- - ass/public/vendor/bootstrap-3.3.7-dist/css/bootstrap.min.css.map
139
- - ass/public/vendor/bootstrap-3.3.7-dist/fonts/glyphicons-halflings-regular.eot
140
- - ass/public/vendor/bootstrap-3.3.7-dist/fonts/glyphicons-halflings-regular.svg
141
- - ass/public/vendor/bootstrap-3.3.7-dist/fonts/glyphicons-halflings-regular.ttf
142
- - ass/public/vendor/bootstrap-3.3.7-dist/fonts/glyphicons-halflings-regular.woff
143
- - ass/public/vendor/bootstrap-3.3.7-dist/fonts/glyphicons-halflings-regular.woff2
144
- - ass/public/vendor/bootstrap-3.3.7-dist/js/bootstrap.js
145
- - ass/public/vendor/bootstrap-3.3.7-dist/js/bootstrap.min.js
146
- - ass/public/vendor/bootstrap-3.3.7-dist/js/npm.js
147
- - ass/views/index.erb
148
- - ass/views/layout.erb
149
125
  - bin/console
150
126
  - bin/setup
151
127
  - exe/ass
152
128
  - lib/apache_server_status.rb
129
+ - lib/apache_server_status/ass/public/js/main.js
130
+ - lib/apache_server_status/ass/views/layout.erb
153
131
  - lib/apache_server_status/version.rb
154
132
  - lib/public/css/style.css
155
133
  - lib/public/js/jquery-3.2.0.js
@@ -188,9 +166,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
188
166
  version: '0'
189
167
  required_rubygems_version: !ruby/object:Gem::Requirement
190
168
  requirements:
191
- - - ">"
169
+ - - ">="
192
170
  - !ruby/object:Gem::Version
193
- version: 1.3.1
171
+ version: '0'
194
172
  requirements: []
195
173
  rubyforge_project:
196
174
  rubygems_version: 2.6.11
@@ -1,6 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'sinatra'
4
- gem 'nokogiri'
5
- gem 'mechanize'
6
- gem 'sinatra-contrib'
@@ -1,60 +0,0 @@
1
- GEM
2
- remote: https://rubygems.org/
3
- specs:
4
- backports (3.6.8)
5
- domain_name (0.5.20170223)
6
- unf (>= 0.0.5, < 1.0.0)
7
- http-cookie (1.0.3)
8
- domain_name (~> 0.5)
9
- mechanize (2.7.5)
10
- domain_name (~> 0.5, >= 0.5.1)
11
- http-cookie (~> 1.0)
12
- mime-types (>= 1.17.2)
13
- net-http-digest_auth (~> 1.1, >= 1.1.1)
14
- net-http-persistent (~> 2.5, >= 2.5.2)
15
- nokogiri (~> 1.6)
16
- ntlm-http (~> 0.1, >= 0.1.1)
17
- webrobots (>= 0.0.9, < 0.2)
18
- mime-types (3.1)
19
- mime-types-data (~> 3.2015)
20
- mime-types-data (3.2016.0521)
21
- mini_portile2 (2.1.0)
22
- multi_json (1.12.1)
23
- net-http-digest_auth (1.4.1)
24
- net-http-persistent (2.9.4)
25
- nokogiri (1.7.1)
26
- mini_portile2 (~> 2.1.0)
27
- ntlm-http (0.1.1)
28
- rack (1.6.5)
29
- rack-protection (1.5.3)
30
- rack
31
- rack-test (0.6.3)
32
- rack (>= 1.0)
33
- sinatra (1.4.8)
34
- rack (~> 1.5)
35
- rack-protection (~> 1.4)
36
- tilt (>= 1.3, < 3)
37
- sinatra-contrib (1.4.7)
38
- backports (>= 2.0)
39
- multi_json
40
- rack-protection
41
- rack-test
42
- sinatra (~> 1.4.0)
43
- tilt (>= 1.3, < 3)
44
- tilt (2.0.7)
45
- unf (0.1.4)
46
- unf_ext
47
- unf_ext (0.0.7.2)
48
- webrobots (0.1.2)
49
-
50
- PLATFORMS
51
- ruby
52
-
53
- DEPENDENCIES
54
- mechanize
55
- nokogiri
56
- sinatra
57
- sinatra-contrib
58
-
59
- BUNDLED WITH
60
- 1.14.6
data/ass/ass.rb DELETED
@@ -1,53 +0,0 @@
1
- require 'rubygems'
2
- require 'sinatra'
3
- require 'sinatra/contrib'
4
- require 'sinatra/json'
5
- require 'nokogiri'
6
- require 'open-uri'
7
-
8
- class Ass < Sinatra::Application
9
- get '/' do
10
- @servers = ARGV
11
- erb :index
12
- end
13
-
14
- get '/:server' do
15
- begin
16
- begin
17
- url = "http://#{params[:server]}/server-status"
18
- doc = Nokogiri::HTML(open(url))
19
- json(cpu: doc.css('dl')[1].children[15].text.split[7][0..-2],
20
- load_average1: doc.css('dl')[1].children[11].text.split[2],
21
- load_average2: doc.css('dl')[1].children[11].text.split[3],
22
- load_average3: doc.css('dl')[1].children[11].text.split[4],
23
- requests_per_second: doc.css('dl')[1].children[17].text.split[0],
24
- requests: doc.css('dl')[1].children[19].text.split[0],
25
- idle_workers: doc.css('dl')[1].children[19].text.split[5],
26
- size_per_request: doc.css('dl')[1].children[17].text.split[6],
27
- size_title: doc.css('dl')[1].children[17].text.split[7])
28
- rescue
29
- url = "https://#{params[:server]}/server-status"
30
- doc = Nokogiri::HTML(open(url))
31
- json(cpu: doc.css('dl')[1].children[15].text.split[7][0..-2],
32
- load_average1: doc.css('dl')[1].children[11].text.split[2],
33
- load_average2: doc.css('dl')[1].children[11].text.split[3],
34
- load_average3: doc.css('dl')[1].children[11].text.split[4],
35
- requests_per_second: doc.css('dl')[1].children[17].text.split[0],
36
- requests: doc.css('dl')[1].children[19].text.split[0],
37
- idle_workers: doc.css('dl')[1].children[19].text.split[5],
38
- size_per_request: doc.css('dl')[1].children[17].text.split[6],
39
- size_title: doc.css('dl')[1].children[17].text.split[7])
40
- end
41
- rescue
42
- json(cpu: '--/--',
43
- load_average1: '--/--',
44
- load_average2: '--/--',
45
- load_average3: '--/--',
46
- requests_per_second: '--/--',
47
- requests: '--/--',
48
- idle_workers: '--/--',
49
- size_per_request: '--/--',
50
- size_title: '--/--')
51
- end
52
- end
53
- end