capistrano-nrsysmond 0.0.1

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.
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 David Collom
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # Capistrano-nrsysmond
2
+
3
+ ## This is a work in progress
4
+
5
+ Capistrano recipe for installing the newrelic sysmond service on multiple operating systems.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ gem 'capistrano-nrsysmond'
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install capistrano-nrsysmond
20
+
21
+ Prepend your config/deploy.rb with the following lines
22
+
23
+ require 'capistrano-nrsysmond'
24
+ set :newrelic_licencekey, '<< NEWRELIC LICENCE KEY >>'
25
+
26
+ ## Usage
27
+
28
+ $ cap newrelic:sysmond
29
+
30
+ ## Tested on:
31
+ * Ubuntu 10.04
32
+ * CentOS 5.9 (Final)
33
+
34
+
35
+ # Credits
36
+ * Jamis Buck ([Capistrano's](https://github.com/capistrano) original author)
37
+ * [Patrick Reagan](http://stackoverflow.com/users/206390/patrick-reagan) for the `remote_file_exists?` method example from [How can you check to see if a file exists (on the remote server) in Capistrano?](http://stackoverflow.com/questions/1661586/how-can-you-check-to-see-if-a-file-exists-on-the-remote-server-in-capistrano)
38
+ [NewRelic](http://www.newrelic.com/)
39
+ * Mitchell Hashimoto [@mitchellh](https://twitter.com/mitchellh) (http://tech.pro/tutorial/1226/basic-rubygem-development)
40
+
41
+ ## Contributing
42
+
43
+ 1. Fork it
44
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
45
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
46
+ 4. Push to the branch (`git push origin my-new-feature`)
47
+ 5. Create new Pull Request
48
+
49
+ ## Bugs & Feedback
50
+
51
+ http://github.com/davidcollom/capistrano-nrsysmond/issues
52
+
@@ -0,0 +1,63 @@
1
+ Capistrano::Configuration.instance(:must_exist).load do
2
+
3
+ set :newrelic_licencekey, nil
4
+
5
+ namespace :newrelic do
6
+ desc 'Installs the newrelic sysmond'
7
+ namespace :sysmond do
8
+ task :default do
9
+ if newrelic_licencekey.nil?
10
+ abort <<-ERROR
11
+ define :newrelic_licencekey
12
+
13
+ This can be done via:
14
+ config/deploy.rb:
15
+ set :newrelic_licencekey, 'sakjfhsdjkgd'
16
+ $ cap deploy -s newrelic_licencekey=325398572395
17
+ ERROR
18
+ end
19
+ install::default
20
+ end
21
+ namespace :install do
22
+ task :default do
23
+ unless remote_file_exists? '/etc/newrelic/nrsysmond.cfg'
24
+ debian if remote_file_exists? '/etc/debian_version'
25
+ redhat if remote_file_exists? '/etc/redhat-release'
26
+ end
27
+ end
28
+ task :debian do
29
+ run 'if [! -e /etc/apt/sources.list.d/newrelic.list ]; then echo "deb http://apt.newrelic.com/debian/ newrelic non-free" > /etc/apt/sources.list.d/newrelic.list; fi'
30
+ run 'wget -O- http://download.newrelic.com/548C16BF.gpg | sudo apt-key add -'
31
+ sudo 'apt-get update && apt-get install newrelic-sysmond'
32
+ end
33
+ task :redhat do
34
+ sudo "rpm -Uvh http://yum.newrelic.com/pub/newrelic/el5/$(uname -m)/newrelic-repo-5-3.noarch.rpm || true"
35
+ sudo "yum install -y newrelic-sysmond"
36
+ configure
37
+ end
38
+ end
39
+ desc 'configure the newrelic-sysmond service with the :newrelic_licencekey'
40
+ task :configure do
41
+ sudo "/usr/sbin/nrsysmond-config --set license_key=#{newrelic_licencekey}"
42
+ restart
43
+ end
44
+
45
+ %W{stop start restart}.each do |com|
46
+ desc "#{com}'s the newrelic-sysmond service"
47
+ task com.to_sym do
48
+ sudo "/etc/init.d/newrelic-sysmond #{com}"
49
+ end
50
+ end
51
+
52
+ def remote_file_exists?(path)
53
+ results = []
54
+
55
+ invoke_command("if [ -e '#{path}' ]; then echo -n 'true'; fi") do |ch, stream, out|
56
+ results << (out == 'true')
57
+ end
58
+
59
+ results == [true]
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,5 @@
1
+ module Capistrano
2
+ module Nrsysmond
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ Dir[File.join(File.dirname(__FILE__), 'capistrano-nrsysmond', '*')].each do |file|
2
+ require file
3
+ end
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-nrsysmond
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - David Collom
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2013-04-19 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: capistrano
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 3
29
+ segments:
30
+ - 0
31
+ version: "0"
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ description: Capistrano recipe for installing the newrelic sysmond service on multiple operating systems
35
+ email:
36
+ - david@collom.co.uk
37
+ executables: []
38
+
39
+ extensions: []
40
+
41
+ extra_rdoc_files: []
42
+
43
+ files:
44
+ - lib/capistrano-nrsysmond/capistrano.rb
45
+ - lib/capistrano-nrsysmond/version.rb
46
+ - lib/capistrano-nrsysmond.rb
47
+ - README.md
48
+ - LICENSE
49
+ homepage: https://github.com/davidcollom/capistrano-nrsysmond
50
+ licenses: []
51
+
52
+ post_install_message:
53
+ rdoc_options: []
54
+
55
+ require_paths:
56
+ - lib
57
+ required_ruby_version: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ hash: 3
63
+ segments:
64
+ - 0
65
+ version: "0"
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ hash: 3
72
+ segments:
73
+ - 0
74
+ version: "0"
75
+ requirements: []
76
+
77
+ rubyforge_project:
78
+ rubygems_version: 1.8.24
79
+ signing_key:
80
+ specification_version: 3
81
+ summary: newrelic sysmond recipe
82
+ test_files: []
83
+
84
+ has_rdoc: