stackeye 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +7 -0
  2. data/.DS_Store +0 -0
  3. data/.fasterer.yml +19 -0
  4. data/.gitignore +13 -0
  5. data/.reek.yml +20 -0
  6. data/.rspec +3 -0
  7. data/.rubocop.yml +18 -0
  8. data/.travis.yml +5 -0
  9. data/CHANGELOG.md +11 -0
  10. data/CODE_OF_CONDUCT.md +74 -0
  11. data/Gemfile +8 -0
  12. data/Gemfile.lock +119 -0
  13. data/LICENSE.txt +21 -0
  14. data/README.md +92 -0
  15. data/Rakefile +8 -0
  16. data/app.rb +7 -0
  17. data/bin/console +15 -0
  18. data/bin/setup +9 -0
  19. data/examples/web-ui.png +0 -0
  20. data/lib/generators/stackeye/install_generator.rb +12 -0
  21. data/lib/generators/stackeye/templates/install.rb +5 -0
  22. data/lib/stackeye.rb +7 -0
  23. data/lib/stackeye/application.rb +32 -0
  24. data/lib/stackeye/configuration.rb +31 -0
  25. data/lib/stackeye/helpers/base.rb +56 -0
  26. data/lib/stackeye/helpers/init.rb +5 -0
  27. data/lib/stackeye/metrics/all.rb +25 -0
  28. data/lib/stackeye/metrics/base.rb +113 -0
  29. data/lib/stackeye/metrics/init.rb +5 -0
  30. data/lib/stackeye/metrics/mysql.rb +42 -0
  31. data/lib/stackeye/metrics/server.rb +74 -0
  32. data/lib/stackeye/public/fonts/feather.eot +0 -0
  33. data/lib/stackeye/public/fonts/feather.svg +1050 -0
  34. data/lib/stackeye/public/fonts/feather.ttf +0 -0
  35. data/lib/stackeye/public/fonts/feather.woff +0 -0
  36. data/lib/stackeye/public/images/favicon.ico +0 -0
  37. data/lib/stackeye/public/images/stackeye.png +0 -0
  38. data/lib/stackeye/public/images/ubuntu.svg +1 -0
  39. data/lib/stackeye/public/javascripts/3PL.js +15 -0
  40. data/lib/stackeye/public/javascripts/application.js +242 -0
  41. data/lib/stackeye/public/stylesheets/3PL.css +5 -0
  42. data/lib/stackeye/public/stylesheets/application.css +13 -0
  43. data/lib/stackeye/routes/base.rb +21 -0
  44. data/lib/stackeye/routes/init.rb +5 -0
  45. data/lib/stackeye/routes/metrics.rb +17 -0
  46. data/lib/stackeye/tools/cli.rb +27 -0
  47. data/lib/stackeye/tools/database.rb +69 -0
  48. data/lib/stackeye/tools/init.rb +5 -0
  49. data/lib/stackeye/tools/os.rb +48 -0
  50. data/lib/stackeye/version.rb +5 -0
  51. data/lib/stackeye/views/layout.erb +34 -0
  52. data/lib/stackeye/views/metrics/mysql/_queries.erb +73 -0
  53. data/lib/stackeye/views/metrics/mysql/index.erb +10 -0
  54. data/lib/stackeye/views/metrics/server/_cpu.erb +73 -0
  55. data/lib/stackeye/views/metrics/server/_disk.erb +35 -0
  56. data/lib/stackeye/views/metrics/server/_memory.erb +73 -0
  57. data/lib/stackeye/views/metrics/server/_processes.erb +52 -0
  58. data/lib/stackeye/views/metrics/server/index.erb +23 -0
  59. data/lib/stackeye/views/shared/_header.erb +20 -0
  60. data/lib/stackeye/views/shared/_navbar.erb +57 -0
  61. data/lib/stackeye/views/unsupported.erb +13 -0
  62. data/stackeye.gemspec +31 -0
  63. metadata +218 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b2c1568a155fce40b3530a7e6349e1541ce2de8d5d5365802299b1202730be12
4
+ data.tar.gz: 7832f03eb11394b17177c9975daf1470c0cde536a15435fc3fa553146b3b0003
5
+ SHA512:
6
+ metadata.gz: fb56d402194855d3f05c6798a3bf2fd56d3b6166e435796bc0369fabffa4b71cc596b688158e5cfdd99007b8934304ea32fc41201cdef5b490253222f1742aa4
7
+ data.tar.gz: 3c3fca6b0182a7d49cae9401d9731df066517dbad845feb7ff14688e1a0d7d6ae25f80dec6b2dc92072e04db818aff29cae1fb6a38cdd5fac1943f7b1f49e02a
Binary file
@@ -0,0 +1,19 @@
1
+ speedups:
2
+ rescue_vs_respond_to: true
3
+ module_eval: true
4
+ shuffle_first_vs_sample: true
5
+ for_loop_vs_each: true
6
+ each_with_index_vs_while: false
7
+ map_flatten_vs_flat_map: true
8
+ reverse_each_vs_reverse_each: true
9
+ select_first_vs_detect: true
10
+ sort_vs_sort_by: true
11
+ fetch_with_argument_vs_block: true
12
+ keys_each_vs_each_key: true
13
+ hash_merge_bang_vs_hash_brackets: true
14
+ block_vs_symbol_to_proc: true
15
+ proc_call_vs_yield: true
16
+ gsub_vs_tr: true
17
+ select_last_vs_reverse_detect: true
18
+ getter_vs_attr_reader: true
19
+ setter_vs_attr_writer: true
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ /log/
10
+ /stackeye/
11
+
12
+ # rspec failure tracking
13
+ .rspec_status
@@ -0,0 +1,20 @@
1
+ ---
2
+ detectors:
3
+ DuplicateMethodCall:
4
+ enabled: false
5
+ InstanceVariableAssumption:
6
+ enabled: false
7
+ IrresponsibleModule:
8
+ enabled: false
9
+ NestedIterators:
10
+ enabled: false
11
+ NilCheck:
12
+ enabled: false
13
+ RepeatedConditional:
14
+ enabled: false
15
+ TooManyStatements:
16
+ enabled: false
17
+ UncommunicativeVariableName:
18
+ enabled: false
19
+ UtilityFunction:
20
+ enabled: false
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,18 @@
1
+ AllCops:
2
+ DisplayCopNames: true
3
+ DisplayStyleGuide: true
4
+ TargetRubyVersion: 2.5
5
+ Exclude:
6
+ - 'spec/**/**/*'
7
+ LineLength:
8
+ Max: 100
9
+ Layout/EmptyLinesAroundClassBody:
10
+ Enabled: false
11
+ Style/ClassAndModuleChildren:
12
+ Enabled: false
13
+ Style/Dir:
14
+ Enabled: false
15
+ Style/Documentation:
16
+ Enabled: false
17
+ Style/ExpandPathArguments:
18
+ Enabled: false
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.5.1
5
+ before_install: gem install bundler -v 1.16.2
@@ -0,0 +1,11 @@
1
+ # Changelog
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
+ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.1.0] - 2018-07-09
10
+ ### Added
11
+ - Initial working project release.
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at j.gomez@drexed.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ # Specify your gem's dependencies in stackeye.gemspec
8
+ gemspec
@@ -0,0 +1,119 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ stackeye (0.1.0)
5
+ sinatra
6
+ sinatra-contrib
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ activesupport (5.2.0)
12
+ concurrent-ruby (~> 1.0, >= 1.0.2)
13
+ i18n (>= 0.7, < 2)
14
+ minitest (~> 5.1)
15
+ tzinfo (~> 1.1)
16
+ ast (2.4.0)
17
+ axiom-types (0.1.1)
18
+ descendants_tracker (~> 0.0.4)
19
+ ice_nine (~> 0.11.0)
20
+ thread_safe (~> 0.3, >= 0.3.1)
21
+ backports (3.11.3)
22
+ codeclimate-engine-rb (0.4.1)
23
+ virtus (~> 1.0)
24
+ coercible (1.0.0)
25
+ descendants_tracker (~> 0.0.1)
26
+ colorize (0.8.1)
27
+ concurrent-ruby (1.0.5)
28
+ descendants_tracker (0.0.4)
29
+ thread_safe (~> 0.3, >= 0.3.1)
30
+ diff-lcs (1.3)
31
+ equalizer (0.0.11)
32
+ fasterer (0.4.1)
33
+ colorize (~> 0.7)
34
+ ruby_parser (~> 3.11.0)
35
+ i18n (1.0.1)
36
+ concurrent-ruby (~> 1.0)
37
+ ice_nine (0.11.2)
38
+ jaro_winkler (1.5.1)
39
+ kwalify (0.7.2)
40
+ minitest (5.11.3)
41
+ multi_json (1.13.1)
42
+ mustermann (1.0.2)
43
+ parallel (1.12.1)
44
+ parser (2.5.1.0)
45
+ ast (~> 2.4.0)
46
+ powerpack (0.1.2)
47
+ rack (2.0.5)
48
+ rack-protection (2.0.3)
49
+ rack
50
+ rainbow (3.0.0)
51
+ rake (12.3.1)
52
+ reek (5.0.1)
53
+ codeclimate-engine-rb (~> 0.4.0)
54
+ kwalify (~> 0.7.0)
55
+ parser (>= 2.5.0.0, < 2.6)
56
+ rainbow (>= 2.0, < 4.0)
57
+ rspec (3.7.0)
58
+ rspec-core (~> 3.7.0)
59
+ rspec-expectations (~> 3.7.0)
60
+ rspec-mocks (~> 3.7.0)
61
+ rspec-core (3.7.1)
62
+ rspec-support (~> 3.7.0)
63
+ rspec-expectations (3.7.0)
64
+ diff-lcs (>= 1.2.0, < 2.0)
65
+ rspec-support (~> 3.7.0)
66
+ rspec-mocks (3.7.0)
67
+ diff-lcs (>= 1.2.0, < 2.0)
68
+ rspec-support (~> 3.7.0)
69
+ rspec-support (3.7.1)
70
+ rubocop (0.57.2)
71
+ jaro_winkler (~> 1.5.1)
72
+ parallel (~> 1.10)
73
+ parser (>= 2.5)
74
+ powerpack (~> 0.1)
75
+ rainbow (>= 2.2.2, < 4.0)
76
+ ruby-progressbar (~> 1.7)
77
+ unicode-display_width (~> 1.0, >= 1.0.1)
78
+ ruby-progressbar (1.9.0)
79
+ ruby_parser (3.11.0)
80
+ sexp_processor (~> 4.9)
81
+ sexp_processor (4.11.0)
82
+ sinatra (2.0.3)
83
+ mustermann (~> 1.0)
84
+ rack (~> 2.0)
85
+ rack-protection (= 2.0.3)
86
+ tilt (~> 2.0)
87
+ sinatra-contrib (2.0.3)
88
+ activesupport (>= 4.0.0)
89
+ backports (>= 2.8.2)
90
+ multi_json
91
+ mustermann (~> 1.0)
92
+ rack-protection (= 2.0.3)
93
+ sinatra (= 2.0.3)
94
+ tilt (>= 1.3, < 3)
95
+ thread_safe (0.3.6)
96
+ tilt (2.0.8)
97
+ tzinfo (1.2.5)
98
+ thread_safe (~> 0.1)
99
+ unicode-display_width (1.4.0)
100
+ virtus (1.0.5)
101
+ axiom-types (~> 0.1)
102
+ coercible (~> 1.0)
103
+ descendants_tracker (~> 0.0, >= 0.0.3)
104
+ equalizer (~> 0.0, >= 0.0.9)
105
+
106
+ PLATFORMS
107
+ ruby
108
+
109
+ DEPENDENCIES
110
+ bundler
111
+ fasterer
112
+ rake
113
+ reek
114
+ rspec
115
+ rubocop
116
+ stackeye!
117
+
118
+ BUNDLED WITH
119
+ 1.16.2
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Juan Gomez
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,92 @@
1
+ # Stackeye
2
+
3
+ #### What is it?
4
+ Stackeye is small and lightweight metrics monitoring system.
5
+ It's meant for projects where longterm and highly detailed metrics
6
+ is not a priority (p.s. thats what Scout and New Relic are for).
7
+
8
+ #### What are the design decisions?
9
+ One of the main design aspects of this project was to have as little
10
+ dependencies as possible (currently just Sinatra). All metric commands
11
+ are executed locally and all data is stored locally in JSON files.
12
+
13
+ #### What does the future hold?
14
+ This project will continue to grow overtime but I would **love some help
15
+ from the community** to really make it blossom into a great project. The
16
+ following is a list of future must/nice to have:
17
+
18
+ * Metrics
19
+ * Ruby
20
+ * Rails
21
+ * SQLite
22
+ * PostgreSQL
23
+ * Redis
24
+ * Alerts
25
+ * Email
26
+ * SMS
27
+ * OS
28
+ * Windows
29
+ * Mac OS
30
+ * Unix
31
+
32
+ ![Web UI](https://github.com/drexed/stackeye/raw/master/examples/web-ui.png)
33
+
34
+ ## Installation
35
+
36
+ Add this line to your application's Gemfile:
37
+
38
+ ```ruby
39
+ gem 'stackeye'
40
+ ```
41
+
42
+ And then execute:
43
+
44
+ $ bundle
45
+
46
+ Or install it yourself as:
47
+
48
+ $ gem install stackeye
49
+
50
+ ## Usage
51
+
52
+ #### Standalone Sinatra app
53
+ ```ruby
54
+ ruby app.rb
55
+
56
+ # crontab
57
+ */5 * * * * /bin/bash -l -c 'cd /path/to/project && Stackeye::Metrics::All.set >> /dev/null'
58
+ 0 0 * * * /bin/bash -l -c 'cd /path/to/project && Stackeye::Tools::Database.truncate >> /dev/null'
59
+ ```
60
+
61
+ #### Mounted Rails app
62
+ ```ruby
63
+ # Run initializer generator:
64
+ rails generate stackeye:install
65
+
66
+ # config/routes.rb
67
+ mount Stackeye::Application, at: '/stackeye'
68
+
69
+ # The following could be used if you are using
70
+ # the whenever gem to manage your crons.
71
+
72
+ # config/schedule.rb
73
+ every 5.minutes do
74
+ runner 'Stackeye::Metrics::All.set'
75
+ end
76
+
77
+ every :day, at: '12:00 am' do
78
+ runner 'Stackeye::Tools::Database.truncate'
79
+ end
80
+ ```
81
+
82
+ ## Contributing
83
+
84
+ Bug reports and pull requests are welcome on GitHub at https://github.com/drexed/stackeye. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
85
+
86
+ ## License
87
+
88
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
89
+
90
+ ## Code of Conduct
91
+
92
+ Everyone interacting in the Stackeye project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/drexed/stackeye/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
data/app.rb ADDED
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH << File.expand_path(File.dirname(__FILE__)) + '/lib'
4
+
5
+ require 'stackeye'
6
+
7
+ Stackeye::Application.run!