opstat-plugins 0.3.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +1 -0
  3. data/.gitlab-ci.yml +17 -0
  4. data/LICENSE +675 -0
  5. data/lib/app/models/apache2.rb +192 -0
  6. data/lib/app/models/bsdnet/bytes_in_out.rb +54 -0
  7. data/lib/app/models/bsdnet/current_entries.rb +34 -0
  8. data/lib/app/models/bsdnet.rb +12 -0
  9. data/lib/app/models/cpu.rb +86 -0
  10. data/lib/app/models/disk.rb +51 -0
  11. data/lib/app/models/disk_io.rb +53 -0
  12. data/lib/app/models/facts.rb +30 -0
  13. data/lib/app/models/fpm.rb +138 -0
  14. data/lib/app/models/haproxy.rb +57 -0
  15. data/lib/app/models/jvm.rb +51 -0
  16. data/lib/app/models/load.rb +99 -0
  17. data/lib/app/models/memory.rb +55 -0
  18. data/lib/app/models/nagios.rb +51 -0
  19. data/lib/app/models/network.rb +58 -0
  20. data/lib/app/models/oracle_fras_sizes.rb +41 -0
  21. data/lib/app/models/oracle_sessions.rb +43 -0
  22. data/lib/app/models/oracle_tablespaces_sizes.rb +51 -0
  23. data/lib/app/models/temper.rb +51 -0
  24. data/lib/app/models/webobjects.rb +83 -0
  25. data/lib/app/models/xen.rb +99 -0
  26. data/lib/data/hp_pdu.yml +191 -0
  27. data/lib/logging.rb +29 -0
  28. data/lib/opstat-plugins.rb +44 -0
  29. data/lib/parsers/apache2.rb +19 -0
  30. data/lib/parsers/bsdnet.rb +29 -0
  31. data/lib/parsers/cpu.rb +42 -0
  32. data/lib/parsers/disk.rb +49 -0
  33. data/lib/parsers/facts.rb +12 -0
  34. data/lib/parsers/fpm.rb +31 -0
  35. data/lib/parsers/freeswitch_fifos.rb +63 -0
  36. data/lib/parsers/haproxy.rb +34 -0
  37. data/lib/parsers/haproxy_tables.rb +25 -0
  38. data/lib/parsers/hp_pdu.rb +36 -0
  39. data/lib/parsers/jvm.rb +22 -0
  40. data/lib/parsers/load.rb +20 -0
  41. data/lib/parsers/memory.rb +29 -0
  42. data/lib/parsers/nagios.rb +39 -0
  43. data/lib/parsers/network.rb +37 -0
  44. data/lib/parsers/oracle_fras_sizes.rb +25 -0
  45. data/lib/parsers/oracle_sessions.rb +20 -0
  46. data/lib/parsers/oracle_tablespaces_sizes.rb +22 -0
  47. data/lib/parsers/temper.rb +17 -0
  48. data/lib/parsers/webobjects.rb +33 -0
  49. data/lib/parsers/xen.rb +39 -0
  50. data/lib/plugins/apache2.rb +76 -0
  51. data/lib/plugins/bsdnet.rb +13 -0
  52. data/lib/plugins/cpu.rb +13 -0
  53. data/lib/plugins/custom_sql_statement.rb +24 -0
  54. data/lib/plugins/disk.rb +31 -0
  55. data/lib/plugins/facts.rb +30 -0
  56. data/lib/plugins/fpm.rb +33 -0
  57. data/lib/plugins/freeswitch_fifos.rb +27 -0
  58. data/lib/plugins/haproxy.rb +24 -0
  59. data/lib/plugins/haproxy_tables.rb +28 -0
  60. data/lib/plugins/hp_pdu.rb +28 -0
  61. data/lib/plugins/jvm.rb +23 -0
  62. data/lib/plugins/load.rb +20 -0
  63. data/lib/plugins/memory.rb +18 -0
  64. data/lib/plugins/nagios.rb +39 -0
  65. data/lib/plugins/network.rb +21 -0
  66. data/lib/plugins/oracle_fras_sizes.rb +48 -0
  67. data/lib/plugins/oracle_sessions.rb +47 -0
  68. data/lib/plugins/oracle_tablespaces_sizes.rb +59 -0
  69. data/lib/plugins/temper.rb +21 -0
  70. data/lib/plugins/webobjects.rb +42 -0
  71. data/lib/plugins/xen.rb +22 -0
  72. data/opstat-plugins.gemspec +20 -0
  73. data/spec/cpu_spec.rb +39 -0
  74. data/spec/disk_io_spec.rb +31 -0
  75. data/spec/disk_spec.rb +31 -0
  76. data/spec/fixtures/parser_cpu_16_core.txt +24 -0
  77. data/spec/fixtures/parser_cpu_16_core_corrupted.txt +24 -0
  78. data/spec/fixtures/parser_cpu_single_core.txt +10 -0
  79. data/spec/fixtures/parser_cpu_single_core_corrupted.txt +9 -0
  80. data/spec/fixtures/parser_disk_3_mounts.txt +9 -0
  81. data/spec/fixtures/parser_disk_corrupted.txt +9 -0
  82. data/spec/fixtures/parser_disk_io.txt +2 -0
  83. data/spec/fixtures/parser_disk_io_corrupted.txt +2 -0
  84. data/spec/fixtures/parser_haproxy_correct.txt +2 -0
  85. data/spec/fixtures/parser_haproxy_corrupted.txt +2 -0
  86. data/spec/fixtures/parser_haproxy_many_frontend_many_backend.txt +6 -0
  87. data/spec/fixtures/parser_haproxy_single_frontend_single_backend_with_single_svname.txt +5 -0
  88. data/spec/fixtures/parser_load.txt +1 -0
  89. data/spec/fixtures/parser_load_corrupted.txt +2 -0
  90. data/spec/fixtures/parser_memory.txt +43 -0
  91. data/spec/fixtures/parser_memory_corrupted.txt +43 -0
  92. data/spec/fixtures/parser_network.txt +5 -0
  93. data/spec/fixtures/parser_network_corrupted.txt +5 -0
  94. data/spec/fixtures/parser_webobjects_many_apps_many_instances.result.yml +590 -0
  95. data/spec/fixtures/parser_webobjects_many_apps_many_instances.txt +2 -0
  96. data/spec/fixtures/parser_webobjects_one_app_many_instances.result.yml +305 -0
  97. data/spec/fixtures/parser_webobjects_one_app_many_instances.txt +395 -0
  98. data/spec/haproxy_spec.rb +68 -0
  99. data/spec/load_spec.rb +21 -0
  100. data/spec/memory_spec.rb +21 -0
  101. data/spec/network_spec.rb +21 -0
  102. data/spec/spec_helper.rb +102 -0
  103. data/spec/webobjects_spec.rb +28 -0
  104. metadata +189 -0
@@ -0,0 +1,102 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
4
+ # this file to always be loaded, without a need to explicitly require it in any
5
+ # files.
6
+ #
7
+ # Given that it is always loaded, you are encouraged to keep this file as
8
+ # light-weight as possible. Requiring heavyweight dependencies from this file
9
+ # will add to the boot time of your test suite on EVERY test run, even for an
10
+ # individual file that may not need all of that loaded. Instead, consider making
11
+ # a separate helper file that requires the additional dependencies and performs
12
+ # the additional setup, and require it from the spec files that actually need
13
+ # it.
14
+ #
15
+ # The `.rspec` file also contains a few flags that are not defaults but that
16
+ # users commonly want.
17
+ #
18
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
19
+ RSpec.configure do |config|
20
+ config.failure_color = :white
21
+ config.success_color = :blue
22
+ # rspec-expectations config goes here. You can use an alternate
23
+ # assertion/expectation library such as wrong or the stdlib/minitest
24
+ # assertions if you prefer.
25
+ config.expect_with :rspec do |expectations|
26
+ # This option will default to `true` in RSpec 4. It makes the `description`
27
+ # and `failure_message` of custom matchers include text for helper methods
28
+ # defined using `chain`, e.g.:
29
+ # be_bigger_than(2).and_smaller_than(4).description
30
+ # # => "be bigger than 2 and smaller than 4"
31
+ # ...rather than:
32
+ # # => "be bigger than 2"
33
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
34
+ end
35
+
36
+ # rspec-mocks config goes here. You can use an alternate test double
37
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
38
+ config.mock_with :rspec do |mocks|
39
+ # Prevents you from mocking or stubbing a method that does not exist on
40
+ # a real object. This is generally recommended, and will default to
41
+ # `true` in RSpec 4.
42
+ mocks.verify_partial_doubles = true
43
+ end
44
+
45
+ # The settings below are suggested to provide a good initial experience
46
+ # with RSpec, but feel free to customize to your heart's content.
47
+ =begin
48
+ # These two settings work together to allow you to limit a spec run
49
+ # to individual examples or groups you care about by tagging them with
50
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
51
+ # get run.
52
+ config.filter_run :focus
53
+ config.run_all_when_everything_filtered = true
54
+
55
+ # Allows RSpec to persist some state between runs in order to support
56
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
57
+ # you configure your source control system to ignore this file.
58
+ config.example_status_persistence_file_path = "spec/examples.txt"
59
+
60
+ # Limits the available syntax to the non-monkey patched syntax that is
61
+ # recommended. For more details, see:
62
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
63
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
64
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
65
+ config.disable_monkey_patching!
66
+
67
+ # This setting enables warnings. It's recommended, but in some cases may
68
+ # be too noisy due to issues in dependencies.
69
+ config.warnings = true
70
+
71
+ # Many RSpec users commonly either run the entire suite or an individual
72
+ # file, and it's useful to allow more verbose output when running an
73
+ # individual spec file.
74
+ if config.files_to_run.one?
75
+ # Use the documentation formatter for detailed output,
76
+ # unless a formatter has already been configured
77
+ # (e.g. via a command-line flag).
78
+ config.default_formatter = 'doc'
79
+ end
80
+
81
+ # Print the 10 slowest examples and example groups at the
82
+ # end of the spec run, to help surface which specs are running
83
+ # particularly slow.
84
+ config.profile_examples = 10
85
+
86
+ # Run specs in random order to surface order dependencies. If you find an
87
+ # order dependency and want to debug it, you can fix the order by providing
88
+ # the seed, which is printed after each run.
89
+ # --seed 1234
90
+ config.order = :random
91
+
92
+ # Seed global randomization in this process using the `--seed` CLI option.
93
+ # Setting this allows you to use `--seed` to deterministically reproduce
94
+ # test failures related to randomization by passing the same `--seed` value
95
+ # as the one that triggered the failure.
96
+ Kernel.srand config.seed
97
+ =end
98
+ end
99
+
100
+
101
+ #local part
102
+ require './lib/opstat-plugins.rb'
@@ -0,0 +1,28 @@
1
+ describe 'Webobjects' do
2
+ describe 'Parsers' do
3
+ describe 'webobjects parser' do
4
+ before :each do
5
+ Opstat::Plugins.load_parser("webobjects")
6
+ @parser = Opstat::Parsers::Webobjects.new
7
+ end
8
+
9
+ it 'returns report for many apps with many configured instances' do
10
+ data_in = File.read('./spec/fixtures/parser_webobjects_many_apps_many_instances.txt')
11
+ result_expected = YAML::load_file('./spec/fixtures/parser_webobjects_many_apps_many_instances.result.yml')
12
+ expect(@parser.parse_data(data_in)).to eq result_expected
13
+ end
14
+
15
+ it 'returns report for one app with many configured instances' do
16
+ data_in = File.read('./spec/fixtures/parser_webobjects_one_app_many_instances.txt')
17
+ result_expected = YAML::load_file('./spec/fixtures/parser_webobjects_one_app_many_instances.result.yml')
18
+ expect(@parser.parse_data(data_in)).to eq result_expected
19
+ end
20
+
21
+ #it 'return empty array where input data are corrupted' do
22
+ # haproxy_data = File.read('./spec/fixtures/parser_haproxy_corrupted.txt')
23
+ # empty = Hash.new
24
+ # expect(@haproxy_parser.parse_data(haproxy_data)).to eq empty = []
25
+ #end
26
+ end
27
+ end
28
+ end
metadata ADDED
@@ -0,0 +1,189 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: opstat-plugins
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.8
5
+ platform: ruby
6
+ authors:
7
+ - Krzysztof Tomczyk
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-09-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: log4r
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1'
27
+ description: All opstat plugins
28
+ email: ktomczyk@power.com.pl
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - ".gitignore"
34
+ - ".gitlab-ci.yml"
35
+ - LICENSE
36
+ - lib/app/models/apache2.rb
37
+ - lib/app/models/bsdnet.rb
38
+ - lib/app/models/bsdnet/bytes_in_out.rb
39
+ - lib/app/models/bsdnet/current_entries.rb
40
+ - lib/app/models/cpu.rb
41
+ - lib/app/models/disk.rb
42
+ - lib/app/models/disk_io.rb
43
+ - lib/app/models/facts.rb
44
+ - lib/app/models/fpm.rb
45
+ - lib/app/models/haproxy.rb
46
+ - lib/app/models/jvm.rb
47
+ - lib/app/models/load.rb
48
+ - lib/app/models/memory.rb
49
+ - lib/app/models/nagios.rb
50
+ - lib/app/models/network.rb
51
+ - lib/app/models/oracle_fras_sizes.rb
52
+ - lib/app/models/oracle_sessions.rb
53
+ - lib/app/models/oracle_tablespaces_sizes.rb
54
+ - lib/app/models/temper.rb
55
+ - lib/app/models/webobjects.rb
56
+ - lib/app/models/xen.rb
57
+ - lib/data/hp_pdu.yml
58
+ - lib/logging.rb
59
+ - lib/opstat-plugins.rb
60
+ - lib/parsers/apache2.rb
61
+ - lib/parsers/bsdnet.rb
62
+ - lib/parsers/cpu.rb
63
+ - lib/parsers/disk.rb
64
+ - lib/parsers/facts.rb
65
+ - lib/parsers/fpm.rb
66
+ - lib/parsers/freeswitch_fifos.rb
67
+ - lib/parsers/haproxy.rb
68
+ - lib/parsers/haproxy_tables.rb
69
+ - lib/parsers/hp_pdu.rb
70
+ - lib/parsers/jvm.rb
71
+ - lib/parsers/load.rb
72
+ - lib/parsers/memory.rb
73
+ - lib/parsers/nagios.rb
74
+ - lib/parsers/network.rb
75
+ - lib/parsers/oracle_fras_sizes.rb
76
+ - lib/parsers/oracle_sessions.rb
77
+ - lib/parsers/oracle_tablespaces_sizes.rb
78
+ - lib/parsers/temper.rb
79
+ - lib/parsers/webobjects.rb
80
+ - lib/parsers/xen.rb
81
+ - lib/plugins/apache2.rb
82
+ - lib/plugins/bsdnet.rb
83
+ - lib/plugins/cpu.rb
84
+ - lib/plugins/custom_sql_statement.rb
85
+ - lib/plugins/disk.rb
86
+ - lib/plugins/facts.rb
87
+ - lib/plugins/fpm.rb
88
+ - lib/plugins/freeswitch_fifos.rb
89
+ - lib/plugins/haproxy.rb
90
+ - lib/plugins/haproxy_tables.rb
91
+ - lib/plugins/hp_pdu.rb
92
+ - lib/plugins/jvm.rb
93
+ - lib/plugins/load.rb
94
+ - lib/plugins/memory.rb
95
+ - lib/plugins/nagios.rb
96
+ - lib/plugins/network.rb
97
+ - lib/plugins/oracle_fras_sizes.rb
98
+ - lib/plugins/oracle_sessions.rb
99
+ - lib/plugins/oracle_tablespaces_sizes.rb
100
+ - lib/plugins/temper.rb
101
+ - lib/plugins/webobjects.rb
102
+ - lib/plugins/xen.rb
103
+ - opstat-plugins.gemspec
104
+ - spec/cpu_spec.rb
105
+ - spec/disk_io_spec.rb
106
+ - spec/disk_spec.rb
107
+ - spec/fixtures/parser_cpu_16_core.txt
108
+ - spec/fixtures/parser_cpu_16_core_corrupted.txt
109
+ - spec/fixtures/parser_cpu_single_core.txt
110
+ - spec/fixtures/parser_cpu_single_core_corrupted.txt
111
+ - spec/fixtures/parser_disk_3_mounts.txt
112
+ - spec/fixtures/parser_disk_corrupted.txt
113
+ - spec/fixtures/parser_disk_io.txt
114
+ - spec/fixtures/parser_disk_io_corrupted.txt
115
+ - spec/fixtures/parser_haproxy_correct.txt
116
+ - spec/fixtures/parser_haproxy_corrupted.txt
117
+ - spec/fixtures/parser_haproxy_many_frontend_many_backend.txt
118
+ - spec/fixtures/parser_haproxy_single_frontend_single_backend_with_single_svname.txt
119
+ - spec/fixtures/parser_load.txt
120
+ - spec/fixtures/parser_load_corrupted.txt
121
+ - spec/fixtures/parser_memory.txt
122
+ - spec/fixtures/parser_memory_corrupted.txt
123
+ - spec/fixtures/parser_network.txt
124
+ - spec/fixtures/parser_network_corrupted.txt
125
+ - spec/fixtures/parser_webobjects_many_apps_many_instances.result.yml
126
+ - spec/fixtures/parser_webobjects_many_apps_many_instances.txt
127
+ - spec/fixtures/parser_webobjects_one_app_many_instances.result.yml
128
+ - spec/fixtures/parser_webobjects_one_app_many_instances.txt
129
+ - spec/haproxy_spec.rb
130
+ - spec/load_spec.rb
131
+ - spec/memory_spec.rb
132
+ - spec/network_spec.rb
133
+ - spec/spec_helper.rb
134
+ - spec/webobjects_spec.rb
135
+ homepage: http://rubygems.org/gems/opstat-plugins
136
+ licenses:
137
+ - GPL-3.0
138
+ metadata: {}
139
+ post_install_message:
140
+ rdoc_options: []
141
+ require_paths:
142
+ - lib
143
+ required_ruby_version: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - ">="
146
+ - !ruby/object:Gem::Version
147
+ version: '0'
148
+ required_rubygems_version: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ requirements: []
154
+ rubygems_version: 3.2.33
155
+ signing_key:
156
+ specification_version: 4
157
+ summary: Opstat plugins
158
+ test_files:
159
+ - spec/cpu_spec.rb
160
+ - spec/disk_io_spec.rb
161
+ - spec/disk_spec.rb
162
+ - spec/fixtures/parser_cpu_16_core.txt
163
+ - spec/fixtures/parser_cpu_16_core_corrupted.txt
164
+ - spec/fixtures/parser_cpu_single_core.txt
165
+ - spec/fixtures/parser_cpu_single_core_corrupted.txt
166
+ - spec/fixtures/parser_disk_3_mounts.txt
167
+ - spec/fixtures/parser_disk_corrupted.txt
168
+ - spec/fixtures/parser_disk_io.txt
169
+ - spec/fixtures/parser_disk_io_corrupted.txt
170
+ - spec/fixtures/parser_haproxy_correct.txt
171
+ - spec/fixtures/parser_haproxy_corrupted.txt
172
+ - spec/fixtures/parser_haproxy_many_frontend_many_backend.txt
173
+ - spec/fixtures/parser_haproxy_single_frontend_single_backend_with_single_svname.txt
174
+ - spec/fixtures/parser_load.txt
175
+ - spec/fixtures/parser_load_corrupted.txt
176
+ - spec/fixtures/parser_memory.txt
177
+ - spec/fixtures/parser_memory_corrupted.txt
178
+ - spec/fixtures/parser_network.txt
179
+ - spec/fixtures/parser_network_corrupted.txt
180
+ - spec/fixtures/parser_webobjects_many_apps_many_instances.result.yml
181
+ - spec/fixtures/parser_webobjects_many_apps_many_instances.txt
182
+ - spec/fixtures/parser_webobjects_one_app_many_instances.result.yml
183
+ - spec/fixtures/parser_webobjects_one_app_many_instances.txt
184
+ - spec/haproxy_spec.rb
185
+ - spec/load_spec.rb
186
+ - spec/memory_spec.rb
187
+ - spec/network_spec.rb
188
+ - spec/spec_helper.rb
189
+ - spec/webobjects_spec.rb