instrumental_tools 1.0.0.rc2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/BUILD.md +50 -0
  3. data/CHANGELOG.md +5 -1
  4. data/CUSTOM_METRICS.md +9 -1
  5. data/INSTALL.md +89 -0
  6. data/LICENSE +1 -1
  7. data/README.md +23 -3
  8. data/Rakefile +257 -0
  9. data/TEST.md +9 -0
  10. data/bin/instrument_server +48 -7
  11. data/chef/.kitchen.yml +16 -0
  12. data/chef/Berksfile +4 -0
  13. data/chef/Berksfile.lock +9 -0
  14. data/chef/instrumental_tools/attributes/default.rb +2 -0
  15. data/chef/instrumental_tools/metadata.rb +3 -0
  16. data/chef/instrumental_tools/recipes/default.rb +21 -0
  17. data/chef/instrumental_tools/templates/instrumental.yml.erb +6 -0
  18. data/conf/instrumental.yml +6 -0
  19. data/debian/after-install.sh +6 -0
  20. data/debian/after-remove.sh +4 -0
  21. data/debian/before-remove.sh +4 -0
  22. data/debian/instrument_server +46 -0
  23. data/examples/mysql/mysql_status.rb +3 -3
  24. data/instrumental_tools.gemspec +32 -4
  25. data/lib/instrumental_tools/metric_script_executor.rb +38 -34
  26. data/lib/instrumental_tools/server_controller.rb +122 -35
  27. data/lib/instrumental_tools/system_inspector/linux.rb +80 -42
  28. data/lib/instrumental_tools/version.rb +1 -1
  29. data/puppet/.kitchen.yml +26 -0
  30. data/puppet/.librarian/puppet/config +2 -0
  31. data/puppet/Puppetfile +4 -0
  32. data/puppet/Puppetfile.lock +17 -0
  33. data/puppet/instrumental_tools/manifests/init.pp +29 -0
  34. data/puppet/instrumental_tools/metadata.json +11 -0
  35. data/puppet/instrumental_tools/templates/instrumental.yml.erb +6 -0
  36. data/puppet/manifests/site.pp +3 -0
  37. data/rpm/after-install.sh +7 -0
  38. data/rpm/after-remove.sh +4 -0
  39. data/rpm/before-remove.sh +5 -0
  40. data/rpm/instrument_server +46 -0
  41. data/systemd/instrument_server.service +13 -0
  42. data/test/integration/default/serverspec/instrumental_tools_spec.rb +29 -0
  43. metadata +164 -11
  44. data/.gitignore +0 -3
@@ -0,0 +1,2 @@
1
+ ---
2
+ LIBRARIAN_PUPPET_PATH: "/var/folders/xm/2h3f2hxd3fb5h0g0g3_60yf80000gp/T/default-nocm-ubuntu-1204-sandbox-20150506-73288-12zf3mo/modules"
data/puppet/Puppetfile ADDED
@@ -0,0 +1,4 @@
1
+ forge "https://forgeapi.puppetlabs.com"
2
+
3
+ mod "computology-packagecloud"
4
+ mod "instrumental_tools", path: "instrumental_tools"
@@ -0,0 +1,17 @@
1
+ FORGE
2
+ remote: https://forgeapi.puppetlabs.com
3
+ specs:
4
+ computology-packagecloud (0.2.10)
5
+ puppetlabs-stdlib (>= 0)
6
+ puppetlabs-stdlib (4.6.0)
7
+
8
+ PATH
9
+ remote: instrumental_tools
10
+ specs:
11
+ instrumental_tools (0.0.1)
12
+ computology-packagecloud (>= 0)
13
+
14
+ DEPENDENCIES
15
+ computology-packagecloud (>= 0)
16
+ instrumental_tools (>= 0)
17
+
@@ -0,0 +1,29 @@
1
+ class instrumental_tools(
2
+ $api_key = ''
3
+ ) {
4
+
5
+ include packagecloud
6
+
7
+ case $operatingsystem {
8
+ 'RedHat', 'CentOS': { $package_type = 'rpm' }
9
+ 'Debian', 'Ubuntu': { $package_type = 'deb' }
10
+ }
11
+
12
+ packagecloud::repo { "expectedbehavior/instrumental":
13
+ type => $package_type,
14
+ }
15
+
16
+ package { "instrumental-tools":
17
+ ensure => latest,
18
+ require => Packagecloud::Repo["expectedbehavior/instrumental"]
19
+ }
20
+
21
+ file { "instrumental-config":
22
+ path => "/etc/instrumental.yml",
23
+ owner => "nobody",
24
+ mode => "0440",
25
+ require => Package["instrumental-tools"],
26
+ content => template("instrumental_tools/instrumental.yml.erb")
27
+ }
28
+
29
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "expectedbehavior-instrumental_tools",
3
+ "version": "0.0.1",
4
+ "author": "Expected Behavior",
5
+ "license": "MIT",
6
+ "source": "https://github.com/expectedbehavior/instrumental_tools",
7
+ "summary": "Installs the instrumental_tools package",
8
+ "dependencies": [
9
+ { "name": "computology/packagecloud", "version_requirement": ">=0.2.10" }
10
+ ]
11
+ }
@@ -0,0 +1,6 @@
1
+ ---
2
+ # Replace YOUR_API_KEY with the API key for your Instrumental project and
3
+ # remove the # from the beginning of the following line to have instrument_server
4
+ # start sending metrics to your account.
5
+
6
+ api_key: <%= scope.lookupvar('api_key') %>
@@ -0,0 +1,3 @@
1
+ node default {
2
+ include 'instrumental_tools'
3
+ }
@@ -0,0 +1,7 @@
1
+ #!/bin/sh
2
+ set -e
3
+ chkconfig --add instrument_server
4
+ chkconfig instrument_server on
5
+ service instrument_server start
6
+ echo "Remember to edit /etc/instrumental.yml with your Instrumental API key"
7
+ exit 0
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+ set -e
3
+ chkconfig --del instrument_server
4
+ exit 0
@@ -0,0 +1,5 @@
1
+ #!/bin/sh
2
+ set -e
3
+ service instrument_server stop
4
+ chkconfig instrument_server off
5
+ exit 0
@@ -0,0 +1,46 @@
1
+ #! /bin/sh
2
+ ### BEGIN INIT INFO
3
+ # Provides: instrument_server
4
+ # Required-Start: $all
5
+ # Required-Stop: $all
6
+ # Default-Start: 2 3 4 5
7
+ # Default-Stop: 0 1 6
8
+ # Short-Description: Start instrument_server at boot to provide system metrics
9
+ # Description: Report system level metrics to the Instrumental service (https://instrumentalapp.com/)
10
+ ### END INIT INFO
11
+
12
+ set -e
13
+
14
+ DIRECTORY="/opt/instrumental-tools/"
15
+ CONFIG_FILE="/etc/instrumental.yml"
16
+ TMPDIR=$DIRECTORY
17
+ PID="${DIRECTORY}instrument_server.pid"
18
+ LOG="${DIRECTORY}instrument_server.log"
19
+ SCRIPT_LOCATION="${DIRECTORY}.instrumental_scripts"
20
+ USER_TO_RUN_AS="nobody"
21
+ ARGS="-f ${CONFIG_FILE} -p ${PID} -l ${LOG} -s ${SCRIPT_LOCATION} -u ${USER_TO_RUN_AS} -t ${TMPDIR}"
22
+ PROCESS="${DIRECTORY}instrument_server ${ARGS}"
23
+
24
+ case "$1" in
25
+ start)
26
+ $PROCESS start
27
+ ;;
28
+ stop)
29
+ $PROCESS stop
30
+ ;;
31
+ restart)
32
+ $PROCESS restart
33
+ ;;
34
+ status)
35
+ $PROCESS status
36
+ ;;
37
+ force-reload)
38
+ $PROCESS stop && $PROCESS clean && $PROCESS start
39
+ ;;
40
+ *)
41
+ echo "Usage: /etc/init.d/instrumental-tools {start|stop|restart|status}"
42
+ exit 1
43
+ ;;
44
+ esac
45
+
46
+ exit 0
@@ -0,0 +1,13 @@
1
+ [Unit]
2
+ Description=instrument_server process for monitoring your system
3
+ After=syslog.target
4
+ After=network.target
5
+
6
+ [Service]
7
+ Type=simple
8
+ ExecStart=/opt/instrumental-tools/instrument_server -f /etc/instrumental.yml -p /opt/instrumental-tools/instrument_server.pid -l /opt/instrumental-tools/instrument_server.log -s /opt/instrumental-tools/.instrumental_scripts -t /opt/instrumental-tools/ foreground
9
+
10
+ TimeoutSec=60
11
+
12
+ [Install]
13
+ WantedBy=multi-user.target
@@ -0,0 +1,29 @@
1
+ require 'serverspec'
2
+
3
+ set :backend, :exec
4
+
5
+
6
+ describe package('instrumental-tools') do
7
+ it { should be_installed }
8
+ end
9
+
10
+ describe service('instrument_server') do
11
+ it { should be_enabled }
12
+ it { should be_running }
13
+ end
14
+
15
+ describe file('/opt/instrumental-tools/instrument_server.pid') do
16
+ it { should be_file }
17
+ it { should be_owned_by('nobody') }
18
+ end
19
+
20
+ describe file('/etc/instrumental.yml') do
21
+ it { should be_file }
22
+ it { should be_owned_by('nobody') }
23
+ end
24
+
25
+ describe process('ruby') do
26
+ it { should be_running }
27
+ its(:user) { should eq 'nobody' }
28
+ its(:args) { should match /instrument_server/ }
29
+ end
metadata CHANGED
@@ -1,17 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: instrumental_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
- - Elijah Miller
8
- - Christopher Zelenak
9
- - Kristopher Chambers
10
- - Matthew Hassfurder
7
+ - Expected Behavior
11
8
  autorequire:
12
9
  bindir: bin
13
10
  cert_chain: []
14
- date: 2015-03-10 00:00:00.000000000 Z
11
+ date: 2015-05-21 00:00:00.000000000 Z
15
12
  dependencies:
16
13
  - !ruby/object:Gem::Dependency
17
14
  name: instrumental_agent
@@ -55,6 +52,132 @@ dependencies:
55
52
  - - ">="
56
53
  - !ruby/object:Gem::Version
57
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: fpm
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 1.3.3
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 1.3.3
69
+ - !ruby/object:Gem::Dependency
70
+ name: package_cloud
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: test-kitchen
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: kitchen-vagrant
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: kitchen-puppet
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: berkshelf
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: librarian-puppet
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: puppet
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: serverspec
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
58
181
  description: A collection of scripts useful for monitoring servers and services with
59
182
  Instrumental (instrumentalapp.com)
60
183
  email:
@@ -64,14 +187,28 @@ executables:
64
187
  extensions: []
65
188
  extra_rdoc_files: []
66
189
  files:
67
- - ".gitignore"
190
+ - BUILD.md
68
191
  - CHANGELOG.md
69
192
  - CUSTOM_METRICS.md
70
193
  - Gemfile
194
+ - INSTALL.md
71
195
  - LICENSE
72
196
  - README.md
73
197
  - Rakefile
198
+ - TEST.md
74
199
  - bin/instrument_server
200
+ - chef/.kitchen.yml
201
+ - chef/Berksfile
202
+ - chef/Berksfile.lock
203
+ - chef/instrumental_tools/attributes/default.rb
204
+ - chef/instrumental_tools/metadata.rb
205
+ - chef/instrumental_tools/recipes/default.rb
206
+ - chef/instrumental_tools/templates/instrumental.yml.erb
207
+ - conf/instrumental.yml
208
+ - debian/after-install.sh
209
+ - debian/after-remove.sh
210
+ - debian/before-remove.sh
211
+ - debian/instrument_server
75
212
  - examples/README.md
76
213
  - examples/docker/README.md
77
214
  - examples/docker/docker.rb
@@ -87,8 +224,23 @@ files:
87
224
  - lib/instrumental_tools/system_inspector/linux.rb
88
225
  - lib/instrumental_tools/system_inspector/osx.rb
89
226
  - lib/instrumental_tools/version.rb
227
+ - puppet/.kitchen.yml
228
+ - puppet/.librarian/puppet/config
229
+ - puppet/Puppetfile
230
+ - puppet/Puppetfile.lock
231
+ - puppet/instrumental_tools/manifests/init.pp
232
+ - puppet/instrumental_tools/metadata.json
233
+ - puppet/instrumental_tools/templates/instrumental.yml.erb
234
+ - puppet/manifests/site.pp
235
+ - rpm/after-install.sh
236
+ - rpm/after-remove.sh
237
+ - rpm/before-remove.sh
238
+ - rpm/instrument_server
239
+ - systemd/instrument_server.service
240
+ - test/integration/default/serverspec/instrumental_tools_spec.rb
90
241
  homepage: http://github.com/expectedbehavior/instrumental_tools
91
- licenses: []
242
+ licenses:
243
+ - MIT
92
244
  metadata: {}
93
245
  post_install_message:
94
246
  rdoc_options: []
@@ -101,13 +253,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
101
253
  version: '1.9'
102
254
  required_rubygems_version: !ruby/object:Gem::Requirement
103
255
  requirements:
104
- - - ">"
256
+ - - ">="
105
257
  - !ruby/object:Gem::Version
106
- version: 1.3.1
258
+ version: '0'
107
259
  requirements: []
108
260
  rubyforge_project:
109
261
  rubygems_version: 2.2.2
110
262
  signing_key:
111
263
  specification_version: 4
112
264
  summary: Command line tools for Instrumental
113
- test_files: []
265
+ test_files:
266
+ - test/integration/default/serverspec/instrumental_tools_spec.rb
data/.gitignore DELETED
@@ -1,3 +0,0 @@
1
- Gemfile.lock
2
- /pkg
3
- *.gem