tweek 0.9.6 → 0.9.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +135 -15
- data/bin/tweek +2 -2
- data/lib/tweek/version.rb +1 -1
- data/{sample.set → settings/sample.set} +0 -0
- metadata +4 -11
- data/.gitignore +0 -9
- data/.travis.yml +0 -5
- data/Gemfile +0 -4
- data/Rakefile +0 -10
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/tweek.gemspec +0 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8a1c3d0861a2205884049ffbe0ed958cf76595f
|
4
|
+
data.tar.gz: 5f160e90b0d80b153653befacc767eccde42cdfe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e7bb10c67867e1e8d5612f6b14ca50d2db6b7399927d9f11ee1fb49ae8fccf17f9e88b7d39e6805389d905a0d8e95594a1891ebd71152021fcc3550ffd6905e
|
7
|
+
data.tar.gz: 17cd1c8d386f9d78cda50497b9e2614b98860f77fd730a7eaccc43ae686fc59fe3ac64f05423be29dd29eaedd56b853577c0f8db07f2d63230f989cde347f8eb
|
data/README.md
CHANGED
@@ -1,38 +1,158 @@
|
|
1
1
|
# Tweek
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
Tweek is a command line utility that allows multiple aspects of a Linux configuration to
|
4
|
+
be recorded and checked against a file of settings. Think of it as a series of
|
5
|
+
configuration tests that can be executed, with the results being presented as a number of
|
6
|
+
passes and failures. The number of failures is returned as the exit code of the process
|
7
|
+
which allows it's use in scripts. This is particularly useful when checking multiple
|
8
|
+
machines via a utility like `pssh` or `mush`.
|
9
|
+
|
10
|
+
Although existing configuration management systems such as Puppet, Chef or Ansible can
|
11
|
+
perform the same checks, they tend to require a high level of support infrastructure to be
|
12
|
+
useful. The purpose of Tweek is to check that after these more sophisticated systems have
|
13
|
+
done their thing, that the performance-important settings are actually correct.
|
14
|
+
|
15
|
+
Another benefit is that the configuration test syntax is extremely simple text, and by
|
16
|
+
abstracting the actual commands used, it is much easier for a relatively unsophisticated
|
17
|
+
user to check obscure settings without actually knowing the commands needed.
|
18
|
+
|
19
|
+
One of the objectives of the Tweek GitHub repository is to serve as a repository for sets
|
20
|
+
of configuration parameters that have been found by the community to be useful in
|
21
|
+
maximizing performance for certain machines and workloads. It is hoped people will submit
|
22
|
+
pull requests to add settings files to the `settings` subdirectory of this project.
|
6
23
|
|
7
24
|
## Installation
|
8
25
|
|
9
|
-
|
26
|
+
Tweek has been written to use Ruby 1.8.7 or above which is available on all Linux systems
|
27
|
+
within the last five years or so. It also requires `rubygems`.
|
28
|
+
|
29
|
+
### Do I need to be the 'root' user?
|
30
|
+
|
31
|
+
The utility will work fine as a non-root user, although some settings may not be
|
32
|
+
accessible, and so the tests will fail.
|
33
|
+
|
34
|
+
### Installing Ruby
|
35
|
+
|
36
|
+
Depending on your distribution issuing the following commands:
|
37
|
+
|
38
|
+
* On Debian (eg. Ubuntu) systems run: `apt-get install ruby rubygems`
|
39
|
+
* On RPM (eg. RedHat, CentOS) systems run: `yum install ruby rubygems`
|
40
|
+
|
41
|
+
Then to install the Tweek gem run this command:
|
10
42
|
|
11
43
|
```ruby
|
12
|
-
gem
|
44
|
+
gem install tweek
|
13
45
|
```
|
14
46
|
|
15
|
-
|
47
|
+
Depending on the setup of the system's Ruby, you may need to run `sudo` for this to be
|
48
|
+
successful. You should now be able to type `tweek -?` to see the available options.
|
16
49
|
|
17
|
-
|
50
|
+
## Usage
|
18
51
|
|
19
|
-
|
52
|
+
Tweek can be used in the following modes:
|
20
53
|
|
21
|
-
|
54
|
+
* To check a default configuration
|
55
|
+
* To create a sample settings file that you can edit manually
|
56
|
+
* To generate a settings file based on the current machine settings
|
57
|
+
* To check the current configuration against a file of settings.
|
22
58
|
|
23
|
-
|
59
|
+
In the first case Tweek uses a built-in set of defaults. To check using these simply run:
|
60
|
+
|
61
|
+
```
|
62
|
+
tweek
|
63
|
+
```
|
64
|
+
|
65
|
+
Tweek will read the sample settings from the default file `settings/sample.set` and check
|
66
|
+
that. The output is self-explanatory.
|
67
|
+
|
68
|
+
All the other uses involve the settings file. Documentation is contained within the
|
69
|
+
sample settings and you should read that for a full understanding of what is possible.
|
70
|
+
|
71
|
+
## Settings File Format
|
72
|
+
|
73
|
+
The file is a plain-text file that may contain UTF-8 if you are running Ruby 2.0 and
|
74
|
+
above, or US-ASCII otherwise.
|
75
|
+
|
76
|
+
The overall syntax of the file was designed to be Ruby-like so enabling syntax
|
77
|
+
highlighting using Ruby as the language makes it very readable.
|
78
|
+
|
79
|
+
### Comments
|
80
|
+
|
81
|
+
Comments are of two sorts:
|
82
|
+
* Inline: after the first # on any line
|
83
|
+
* Block: Following the Ruby convention these are begun with `=begin` and end with `=end`
|
24
84
|
|
25
|
-
|
85
|
+
### Sections
|
86
|
+
|
87
|
+
The file is split into sections, each of which starts with one of several predefined keywords
|
88
|
+
(in capitals) followed by an optional parameter narrowing the scope of the keyword. The
|
89
|
+
keywords are:
|
90
|
+
* BLKDEV - Lists block devices and their configuration parameters. This must be followed
|
91
|
+
by a block device name, which may be a wildcard.
|
92
|
+
* CLOCKSOURCE - Establishes the desired clocksource. No parameter is required.
|
93
|
+
* KERNEL - Parameters passed to the Kernel at boot time (usually using Grub). No
|
94
|
+
parameter required.
|
95
|
+
* SYSCTL - Various system settings. No parameter required.
|
96
|
+
* NET - Settings appropriate to a particular network device. This must be followed by a
|
97
|
+
network device name eg. `eth0`. Wildcards are allowed.
|
98
|
+
* EXT4 - Settings for EXT4 filesystems. This must be followed by a parameter containing
|
99
|
+
either a block device or filesystem path corresponding to a mounted `ext4` filesystem.
|
100
|
+
Wildcards are allowed.
|
101
|
+
* XFS - Settings for XFS filesystems. This must be followed by a parameter containing
|
102
|
+
either a block device or filesystem path corresponding to a mounted `ext4` filesystem.
|
103
|
+
Wildcards are allowed.
|
104
|
+
|
105
|
+
### Parameters
|
106
|
+
|
107
|
+
After a section all lines up to the next section (or end of file) are interpreted as
|
108
|
+
parameter lines. These take the form:
|
109
|
+
|
110
|
+
```
|
111
|
+
parameter_name = parameter_value [if condition[,condition...]]
|
112
|
+
```
|
113
|
+
|
114
|
+
For a discussion of which parameters are supported please see the sample settings file.
|
115
|
+
|
116
|
+
### Conditionals
|
117
|
+
|
118
|
+
Parameter lines can be suffixed by the word `if` and one or more conditions. These are
|
119
|
+
used to limit the scope of the parameter check to those systems where the conditions hold
|
120
|
+
true. The list of conditions is and'ed together. A condition takes the form:
|
121
|
+
|
122
|
+
```
|
123
|
+
[k|d|v] op value
|
124
|
+
```
|
125
|
+
|
126
|
+
Where:
|
127
|
+
* `k` is the Kernel Version, `d` is the Distro name, and `v` is the Distro version.
|
128
|
+
* The operator `op` can be equality '==', regex equality '=~'or a version comparator as
|
129
|
+
per the [Rubygems](http://ruby-doc.org/stdlib-2.0.0/libdoc/rubygems/rdoc/Gem/Version.html) specification.
|
130
|
+
* The value is one of a plain string in quotes (for equality), a regex between /
|
131
|
+
delimiters, or a plain version string.
|
26
132
|
|
27
133
|
## Development
|
28
134
|
|
29
|
-
|
135
|
+
Tweek was developed using the gem `bundler`. Ensure you have both this and `rake` installed using:
|
136
|
+
|
137
|
+
```
|
138
|
+
gem install bundler rake
|
139
|
+
```
|
140
|
+
|
141
|
+
After checking out the repo, run `bundle install` to install dependencies. Make your code
|
142
|
+
changes, then run `bundle exec rake test` to run the tests. When ready to test on a machine use the
|
143
|
+
built-in Rake tasks. For a list of these type `rake -T`.
|
144
|
+
|
145
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
146
|
+
|
147
|
+
To release a new version to the public gem repository, contact the author.
|
30
148
|
|
31
|
-
|
149
|
+
The author will update the version number in `version.rb`, and then run `bundle exec rake
|
150
|
+
release`, which will create a git tag for the version, push git commits and tags, and push
|
151
|
+
the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
152
|
|
33
153
|
## Contributing
|
34
154
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
155
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/townsen/tweek. 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.
|
36
156
|
|
37
157
|
## License
|
38
158
|
|
@@ -40,4 +160,4 @@ The gem is available as open source under the terms of the [MIT License](http://
|
|
40
160
|
|
41
161
|
## Code of Conduct
|
42
162
|
|
43
|
-
Everyone interacting in the Tweek project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
163
|
+
Everyone interacting in the Tweek project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/townsen/tweek/blob/master/CODE_OF_CONDUCT.md).
|
data/bin/tweek
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
#
|
3
3
|
# A script to check a variety of Linux system settings
|
4
|
-
# See
|
4
|
+
# See settings/sample.set for a description of these.
|
5
5
|
# By Nick Townsend, June 2017
|
6
6
|
#
|
7
7
|
require 'rubygems'
|
@@ -83,7 +83,7 @@ if kernel_ver.nil?
|
|
83
83
|
end
|
84
84
|
cs = Tweek::App.new(gflag, true, distro, distro_ver, kernel_ver)
|
85
85
|
if ARGV.empty?
|
86
|
-
fh = File.open(File.expand_path('../../sample.set',__FILE__))
|
86
|
+
fh = File.open(File.expand_path('../../settings/sample.set',__FILE__))
|
87
87
|
else
|
88
88
|
fh = ARGF
|
89
89
|
end
|
data/lib/tweek/version.rb
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tweek
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Townsend
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -60,23 +60,16 @@ executables:
|
|
60
60
|
extensions: []
|
61
61
|
extra_rdoc_files: []
|
62
62
|
files:
|
63
|
-
- ".gitignore"
|
64
|
-
- ".travis.yml"
|
65
63
|
- CODE_OF_CONDUCT.md
|
66
|
-
- Gemfile
|
67
64
|
- LICENSE.txt
|
68
65
|
- README.md
|
69
|
-
- Rakefile
|
70
|
-
- bin/console
|
71
|
-
- bin/setup
|
72
66
|
- bin/tweek
|
73
67
|
- lib/tweek.rb
|
74
68
|
- lib/tweek/app.rb
|
75
69
|
- lib/tweek/section.rb
|
76
70
|
- lib/tweek/version.rb
|
77
|
-
- sample.set
|
78
|
-
|
79
|
-
homepage:
|
71
|
+
- settings/sample.set
|
72
|
+
homepage: https://github.com/townsen/tweek
|
80
73
|
licenses:
|
81
74
|
- MIT
|
82
75
|
metadata:
|
data/.gitignore
DELETED
data/.travis.yml
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "tweek"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start(__FILE__)
|
data/bin/setup
DELETED
data/tweek.gemspec
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path("../lib", __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require "tweek/version"
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "tweek"
|
8
|
-
spec.version = Tweek::VERSION
|
9
|
-
spec.authors = ["Nick Townsend"]
|
10
|
-
spec.email = ["nick.townsend@mac.com"]
|
11
|
-
|
12
|
-
spec.summary = %q{Read and compare Linux parameters for performance tweaking}
|
13
|
-
spec.license = "MIT"
|
14
|
-
|
15
|
-
if spec.respond_to?(:metadata)
|
16
|
-
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
17
|
-
else
|
18
|
-
raise "RubyGems 2.0 or newer is required to protect against " \
|
19
|
-
"public gem pushes."
|
20
|
-
end
|
21
|
-
|
22
|
-
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
23
|
-
f.match(%r{^(test|spec|features)/})
|
24
|
-
end
|
25
|
-
spec.bindir = "bin"
|
26
|
-
spec.executables = ['tweek']
|
27
|
-
spec.require_paths = ["lib"]
|
28
|
-
|
29
|
-
spec.add_development_dependency "bundler", "~> 1.15"
|
30
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
31
|
-
spec.add_development_dependency "minitest", "~> 5.0"
|
32
|
-
end
|