newrelic_postgres_plugin 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +24 -0
- data/LICENSE +21 -0
- data/README.md +4 -0
- data/Rakefile +155 -0
- data/bin/pg_monitor +57 -0
- data/config/newrelic_plugin.yml +26 -0
- data/lib/newrelic_postgres_plugin/agent.rb +176 -0
- data/lib/newrelic_postgres_plugin.rb +6 -0
- data/newrelic_postgres_plugin.gemspec +84 -0
- metadata +90 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c5dbbac674a6b9755b660189a8bb72673ac49196
|
4
|
+
data.tar.gz: 8e8a5df463aba43e10e2a07161f0243646b7ff27
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: dfac2bed440d8d21e6f84b40841a32990ff2f612ef887a9934d9b9335eabf2bcb761b795677e945798d0834ba49ac18bf27e0983724c468f91e5697134f849da
|
7
|
+
data.tar.gz: 9cb90edba403d5bffd8f8baf7a3c1afc872fe0d6c54478e112c51e0599bcc48454b3047a7ca4660989e216c898c6b194653c21c04c43205ba08bb5a0f5c2f3b3
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
GIT
|
2
|
+
remote: git@github.com:newrelic-platform/newrelic_plugin.git
|
3
|
+
revision: 913177005ae53883c73395833f3be0e9c6644eae
|
4
|
+
branch: release
|
5
|
+
specs:
|
6
|
+
newrelic_plugin (1.0.1)
|
7
|
+
faraday (>= 0.8.1)
|
8
|
+
json
|
9
|
+
|
10
|
+
GEM
|
11
|
+
remote: http://rubygems.org/
|
12
|
+
specs:
|
13
|
+
faraday (0.8.7)
|
14
|
+
multipart-post (~> 1.1)
|
15
|
+
json (1.8.0)
|
16
|
+
multipart-post (1.2.0)
|
17
|
+
pg (0.15.1)
|
18
|
+
|
19
|
+
PLATFORMS
|
20
|
+
ruby
|
21
|
+
|
22
|
+
DEPENDENCIES
|
23
|
+
newrelic_plugin!
|
24
|
+
pg
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2013 New Relic, Inc.
|
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.
|
data/README.md
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,155 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'date'
|
4
|
+
|
5
|
+
# https://raw.github.com/mojombo/rakegem
|
6
|
+
|
7
|
+
#############################################################################
|
8
|
+
#
|
9
|
+
# Helper functions
|
10
|
+
#
|
11
|
+
#############################################################################
|
12
|
+
|
13
|
+
def name
|
14
|
+
@name ||= Dir['*.gemspec'].first.split('.').first
|
15
|
+
end
|
16
|
+
|
17
|
+
def version
|
18
|
+
line = File.read("lib/#{name}.rb")[/^\s*VERSION\s*=\s*.*/]
|
19
|
+
line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
|
20
|
+
end
|
21
|
+
|
22
|
+
def date
|
23
|
+
Date.today.to_s
|
24
|
+
end
|
25
|
+
|
26
|
+
def rubyforge_project
|
27
|
+
name
|
28
|
+
end
|
29
|
+
|
30
|
+
def gemspec_file
|
31
|
+
"#{name}.gemspec"
|
32
|
+
end
|
33
|
+
|
34
|
+
def gem_file
|
35
|
+
"#{name}-#{version}.gem"
|
36
|
+
end
|
37
|
+
|
38
|
+
def replace_header(head, header_name)
|
39
|
+
head.sub!(/(\.#{header_name}\s*= ').*'/) { "#{$1}#{send(header_name)}'"}
|
40
|
+
end
|
41
|
+
|
42
|
+
#############################################################################
|
43
|
+
#
|
44
|
+
# Standard tasks
|
45
|
+
#
|
46
|
+
#############################################################################
|
47
|
+
|
48
|
+
task :default => :test
|
49
|
+
|
50
|
+
require 'rake/testtask'
|
51
|
+
Rake::TestTask.new(:test) do |test|
|
52
|
+
test.libs << 'lib' << 'test'
|
53
|
+
test.pattern = 'test/**/*_test.rb'
|
54
|
+
test.verbose = true
|
55
|
+
end
|
56
|
+
|
57
|
+
desc "Generate RCov test coverage and open in your browser"
|
58
|
+
task :coverage do
|
59
|
+
require 'rcov'
|
60
|
+
sh "rm -fr coverage"
|
61
|
+
sh "rcov test/test_*.rb"
|
62
|
+
sh "open coverage/index.html"
|
63
|
+
end
|
64
|
+
|
65
|
+
require 'rdoc/task'
|
66
|
+
Rake::RDocTask.new do |rdoc|
|
67
|
+
rdoc.rdoc_dir = 'rdoc'
|
68
|
+
rdoc.title = "#{name} #{version}"
|
69
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
70
|
+
rdoc.rdoc_files.include('README.rdoc')
|
71
|
+
rdoc.rdoc_files.include('LICENSE')
|
72
|
+
rdoc.rdoc_files.include('CHANGES')
|
73
|
+
rdoc.main = "README.rdoc"
|
74
|
+
end
|
75
|
+
|
76
|
+
desc "Open an irb session preloaded with this library"
|
77
|
+
task :console do
|
78
|
+
sh "irb -rubygems -I./lib -r ./lib/#{name}.rb"
|
79
|
+
end
|
80
|
+
|
81
|
+
#############################################################################
|
82
|
+
#
|
83
|
+
# Custom tasks (add your own tasks here)
|
84
|
+
#
|
85
|
+
#############################################################################
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
#############################################################################
|
90
|
+
#
|
91
|
+
# Packaging tasks
|
92
|
+
#
|
93
|
+
#############################################################################
|
94
|
+
|
95
|
+
desc "Create tag v#{version} and build and push #{gem_file} to Rubgems"
|
96
|
+
task :release => :build do
|
97
|
+
unless `git branch` =~ /^\* master$/
|
98
|
+
puts "You must be on the master branch to release!"
|
99
|
+
exit!
|
100
|
+
end
|
101
|
+
sh "git commit --allow-empty -a -m 'Release #{version}'"
|
102
|
+
sh "git tag v#{version}"
|
103
|
+
sh "git push origin master"
|
104
|
+
sh "git push origin v#{version}"
|
105
|
+
sh "gem push pkg/#{name}-#{version}.gem"
|
106
|
+
end
|
107
|
+
|
108
|
+
desc "Build #{gem_file} into the pkg directory"
|
109
|
+
task :build => :gemspec do
|
110
|
+
sh "mkdir -p pkg"
|
111
|
+
sh "gem build #{gemspec_file}"
|
112
|
+
sh "mv #{gem_file} pkg"
|
113
|
+
end
|
114
|
+
|
115
|
+
desc "Generate #{gemspec_file}"
|
116
|
+
task :gemspec => :validate do
|
117
|
+
# read spec file and split out manifest section
|
118
|
+
spec = File.read(gemspec_file)
|
119
|
+
head, manifest, tail = spec.split(" # = MANIFEST =\n")
|
120
|
+
|
121
|
+
# replace name version and date
|
122
|
+
replace_header(head, :name)
|
123
|
+
replace_header(head, :version)
|
124
|
+
replace_header(head, :date)
|
125
|
+
#comment this out if your rubyforge_project has a different name
|
126
|
+
replace_header(head, :rubyforge_project)
|
127
|
+
|
128
|
+
# determine file list from git ls-files
|
129
|
+
files = `git ls-files`.
|
130
|
+
split("\n").
|
131
|
+
sort.
|
132
|
+
reject { |file| file =~ /^\./ }.
|
133
|
+
reject { |file| file =~ /^(rdoc|pkg)/ }.
|
134
|
+
map { |file| " #{file}" }.
|
135
|
+
join("\n")
|
136
|
+
|
137
|
+
# piece file back together and write
|
138
|
+
manifest = " s.files = %w[\n#{files}\n ]\n"
|
139
|
+
spec = [head, manifest, tail].join(" # = MANIFEST =\n")
|
140
|
+
File.open(gemspec_file, 'w') { |io| io.write(spec) }
|
141
|
+
puts "Updated #{gemspec_file}"
|
142
|
+
end
|
143
|
+
|
144
|
+
desc "Validate #{gemspec_file}"
|
145
|
+
task :validate do
|
146
|
+
libfiles = Dir['lib/*'] - ["lib/#{name}.rb", "lib/#{name}"]
|
147
|
+
unless libfiles.empty?
|
148
|
+
puts "Directory `lib` should only contain a `#{name}.rb` file and `#{name}` dir."
|
149
|
+
exit!
|
150
|
+
end
|
151
|
+
unless Dir['VERSION*'].empty?
|
152
|
+
puts "A `VERSION` file at root level violates Gem best practices."
|
153
|
+
exit!
|
154
|
+
end
|
155
|
+
end
|
data/bin/pg_monitor
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$LOAD_PATH.unshift File.expand_path "../../lib", __FILE__
|
3
|
+
require "newrelic_postgres_plugin"
|
4
|
+
require 'optparse'
|
5
|
+
|
6
|
+
options = OptionParser.new do |opts|
|
7
|
+
opts.banner = <<-EOF
|
8
|
+
Usage:
|
9
|
+
newrelic_postgres_plugin ( run | install ) [options]
|
10
|
+
EOF
|
11
|
+
|
12
|
+
opts.on("-v", "--verbose", "Run verbosely") do
|
13
|
+
NewRelic::Plugin::Config.config.newrelic['verbose'] = 1
|
14
|
+
end
|
15
|
+
|
16
|
+
opts.on("-l", "--license LICENSE_KEY", "Your NewRelic account License Key") do | license_key |
|
17
|
+
$license_key = license_key
|
18
|
+
end
|
19
|
+
|
20
|
+
opts.on("-c", "--config FILE", "Override the location of the newrelic_plugin.yml") do | filename |
|
21
|
+
if !File.exists? filename
|
22
|
+
puts "File not found: #{filename.inspect}"
|
23
|
+
exit 1
|
24
|
+
end
|
25
|
+
NewRelic::Plugin::Config.config_file = filename
|
26
|
+
end
|
27
|
+
|
28
|
+
opts.on("-h", "--help") do
|
29
|
+
puts opts
|
30
|
+
if File.basename($0) == File.basename(__FILE__)
|
31
|
+
exit 0
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
args = options.parse!(ARGV)
|
38
|
+
|
39
|
+
if args.first == "run"
|
40
|
+
if $license_key
|
41
|
+
NewRelic::Plugin::Config.config.options['newrelic']['license_key'] = $license_key
|
42
|
+
end
|
43
|
+
NewRelic::PostgresPlugin.run
|
44
|
+
elsif args.first == "install"
|
45
|
+
config_file = File.read(File.expand_path("../../config/newrelic_plugin.yml", __FILE__))
|
46
|
+
if $license_key
|
47
|
+
config_file.gsub!("YOUR_LICENSE_KEY_HERE", $license_key)
|
48
|
+
end
|
49
|
+
require 'fileutils'
|
50
|
+
FileUtils.mkdir_p "config"
|
51
|
+
File.open("config/newrelic_plugin.yml", "w") do | io |
|
52
|
+
io.write(config_file)
|
53
|
+
end
|
54
|
+
puts "Saved agent config file #{File.expand_path("config/newrelic_plugin.yml")}"
|
55
|
+
else
|
56
|
+
puts options
|
57
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Please make sure to update the license_key information with the license key for your New Relic
|
2
|
+
# account.
|
3
|
+
#
|
4
|
+
#
|
5
|
+
newrelic:
|
6
|
+
#
|
7
|
+
# Update with your New Relic account license key:
|
8
|
+
#
|
9
|
+
license_key: 'YOUR_LICENSE_KEY_HERE'
|
10
|
+
#
|
11
|
+
# Set to '1' for verbose output, remove for normal output.
|
12
|
+
# All output goes to stdout/stderr.
|
13
|
+
#
|
14
|
+
# verbose: 1
|
15
|
+
#
|
16
|
+
# Agent Configuration:
|
17
|
+
#
|
18
|
+
agents:
|
19
|
+
# this is where configuration for agents belongs
|
20
|
+
postgres:
|
21
|
+
host: 'host'
|
22
|
+
port: 5432
|
23
|
+
user: 'username'
|
24
|
+
password: 'password'
|
25
|
+
dbname: 'database_name'
|
26
|
+
sslmode: 'require'
|
@@ -0,0 +1,176 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'newrelic_plugin'
|
6
|
+
require 'pg'
|
7
|
+
|
8
|
+
module NewRelic::PostgresPlugin
|
9
|
+
|
10
|
+
BACKEND_QUERY = %Q(
|
11
|
+
SELECT count(*) - ( SELECT count(*) FROM pg_stat_activity WHERE
|
12
|
+
#{
|
13
|
+
if nine_two?
|
14
|
+
"state <> 'idle'"
|
15
|
+
else
|
16
|
+
"current_query <> '<IDLE>'"
|
17
|
+
end
|
18
|
+
}
|
19
|
+
) AS backends_active, ( SELECT count(*) FROM pg_stat_activity WHERE
|
20
|
+
#{
|
21
|
+
if nine_two?
|
22
|
+
"AND state = 'idle'"
|
23
|
+
else
|
24
|
+
"AND current_query = '<IDLE>'"
|
25
|
+
end
|
26
|
+
}
|
27
|
+
) AS backends_idle FROM pg_stat_activity;
|
28
|
+
)
|
29
|
+
DATABASE_QUERY = %Q(
|
30
|
+
SELECT * FROM pg_stat_database;
|
31
|
+
)
|
32
|
+
BGWRITER_QUERY = %Q(
|
33
|
+
SELECT * FROM pg_stat_bgwriter;
|
34
|
+
)
|
35
|
+
INDEX_COUNT_QUERY = %Q(
|
36
|
+
SELECT count(1) as indexes FROM pg_class WHERE relkind = 'i';
|
37
|
+
)
|
38
|
+
INDEX_HIT_RATE_QUERY = %Q(
|
39
|
+
SELECT
|
40
|
+
'index hit rate' AS name,
|
41
|
+
(sum(idx_blks_hit)) / sum(idx_blks_hit + idx_blks_read) AS ratio
|
42
|
+
FROM pg_statio_user_indexes
|
43
|
+
UNION ALL
|
44
|
+
SELECT
|
45
|
+
'cache hit rate' AS name,
|
46
|
+
sum(heap_blks_hit) / (sum(heap_blks_hit) + sum(heap_blks_read)) AS ratio
|
47
|
+
FROM pg_statio_user_tables;
|
48
|
+
)
|
49
|
+
INDEX_SIZE_QUERY = %Q(
|
50
|
+
SELECT pg_size_pretty(sum(relpages*8192)) AS size
|
51
|
+
FROM pg_class
|
52
|
+
WHERE reltype = 0;
|
53
|
+
)
|
54
|
+
|
55
|
+
# Register and run the agent
|
56
|
+
def self.run
|
57
|
+
# Register this agent.
|
58
|
+
NewRelic::Plugin::Setup.install_agent :postgres, self
|
59
|
+
|
60
|
+
# Launch the agent; this never returns.
|
61
|
+
NewRelic::Plugin::Run.setup_and_run
|
62
|
+
end
|
63
|
+
|
64
|
+
|
65
|
+
class Agent < NewRelic::Plugin::Agent::Base
|
66
|
+
agent_guid 'com.boundless.postgres'
|
67
|
+
agent_version '1.0.0'
|
68
|
+
agent_config_options :host, :port, :user, :password, :dbname, :sslmode
|
69
|
+
agent_human_labels('Postgres') { "#{host}" }
|
70
|
+
|
71
|
+
def initialize name, agent_info, options={}
|
72
|
+
@previous_metrics = {}
|
73
|
+
super
|
74
|
+
end
|
75
|
+
|
76
|
+
#
|
77
|
+
# Required, but not used
|
78
|
+
#
|
79
|
+
def setup_metrics
|
80
|
+
end
|
81
|
+
|
82
|
+
#
|
83
|
+
# You do not have to specify the postgres port in the yaml if you don't want to.
|
84
|
+
#
|
85
|
+
def port
|
86
|
+
@port || 5432
|
87
|
+
end
|
88
|
+
|
89
|
+
#
|
90
|
+
# Get a connection to postgres
|
91
|
+
#
|
92
|
+
def connect
|
93
|
+
PG::Connection.new(host: host, port: port, user: user, password: password, sslmode: sslmode, dbname: dbname)
|
94
|
+
end
|
95
|
+
|
96
|
+
#
|
97
|
+
# Returns true if we're talking to Postgres version >= 9.2
|
98
|
+
#
|
99
|
+
def nine_two?
|
100
|
+
@connection.send(:postgresql_version) >= 90200
|
101
|
+
end
|
102
|
+
|
103
|
+
|
104
|
+
#
|
105
|
+
# This is called on every polling cycle
|
106
|
+
#
|
107
|
+
def poll_cycle
|
108
|
+
@connection = self.connect
|
109
|
+
|
110
|
+
report_backend_metrics
|
111
|
+
report_bgwriter_metrics
|
112
|
+
report_database_metrics
|
113
|
+
report_index_metrics
|
114
|
+
rescue => e
|
115
|
+
$stderr.puts "#{e}: #{e.backtrace.join("\n ")}"
|
116
|
+
end
|
117
|
+
|
118
|
+
def report_derived_metric(name, units, value)
|
119
|
+
if previous_value = @previous_metrics[name]
|
120
|
+
report_metric name, units, (value - previous_value)
|
121
|
+
else
|
122
|
+
report_metric name, units, 0
|
123
|
+
end
|
124
|
+
@previous_metrics[name] = value
|
125
|
+
end
|
126
|
+
|
127
|
+
|
128
|
+
def report_backend_metrics
|
129
|
+
@connection.exec(BACKEND_QUERY) do |result|
|
130
|
+
report_metric "Backends/Active", 'queries', result[0]['backends_active']
|
131
|
+
report_metric "Backends/Idle", 'queries', result[0]['backends_idle']
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
def report_database_metrics
|
136
|
+
@connection.exec(DATABASE_QUERY) do |result|
|
137
|
+
result.each do |row|
|
138
|
+
database_name = row['datname']
|
139
|
+
report_metric "Database/#{database_name}/Backends", '', row['numbackends'].to_i
|
140
|
+
report_derived_metric "Database/#{database_name}/Transactions/Committed", '', row['xact_commit'].to_i
|
141
|
+
report_derived_metric "Database/#{database_name}/Transactions/Rolled Back", '', row['xact_rollback'].to_i
|
142
|
+
report_derived_metric "Database/#{database_name}/Tuples/Read from Disk", '', row['blks_read'].to_i
|
143
|
+
report_derived_metric "Database/#{database_name}/Tuples/Read Cache Hit", '', row['blks_hit'].to_i
|
144
|
+
report_derived_metric "Database/#{database_name}/Tuples/Returned/From Sequential", '', row['tup_returned'].to_i
|
145
|
+
report_derived_metric "Database/#{database_name}/Tuples/Returned/From Bitmap", '', row['tup_fetched'].to_i
|
146
|
+
report_derived_metric "Database/#{database_name}/Tuples/Writes/Inserts", '', row['tup_inserted'].to_i
|
147
|
+
report_derived_metric "Database/#{database_name}/Tuples/Writes/Updates", '', row['tup_updated'].to_i
|
148
|
+
report_derived_metric "Database/#{database_name}/Tuples/Writes/Deletes", '', row['tup_deleted'].to_i
|
149
|
+
report_derived_metric "Database/#{database_name}/Conflicts", '', row['conflicts'].to_i
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
def report_bgwriter_metrics
|
155
|
+
@connection.exec(BGWRITER_QUERY) do |result|
|
156
|
+
report_derived_metric "Background Writer/Checkpoints/Scheduled", 'checkpoints', result[0]['checkpoints_timed'].to_i
|
157
|
+
report_derived_metric "Background Writer/Checkpoints/Requested", 'checkpoints', result[0]['checkpoints_requests'].to_i
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
def report_index_metrics
|
162
|
+
@connection.exec(INDEX_COUNT_QUERY) do |result|
|
163
|
+
report_metric "Indexes/Total", 'indexes', result[0]['indexes'].to_i
|
164
|
+
report_metric "Indexes/Disk Utilization", 'bytes', result[0]['size_indexes'].to_f
|
165
|
+
end
|
166
|
+
@connection.exec(INDEX_HIT_RATE_QUERY) do |result|
|
167
|
+
report_metric "Indexes/Hit Rate", '%', result[0]['ratio'].to_f
|
168
|
+
report_metric "Indexes/Cache Hit Rate", '%', result[1]['ratio'].to_f
|
169
|
+
end
|
170
|
+
@connection.exec(INDEX_SIZE_QUERY) do |result|
|
171
|
+
report_metric "Indexes/Size", 'bytes', result[0]['size'].to_f
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
end
|
176
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
## This is the rakegem gemspec template. Make sure you read and understand
|
2
|
+
## all of the comments. Some sections require modification, and others can
|
3
|
+
## be deleted if you don't need them. Once you understand the contents of
|
4
|
+
## this file, feel free to delete any comments that begin with two hash marks.
|
5
|
+
## You can find comprehensive Gem::Specification documentation, at
|
6
|
+
## http://docs.rubygems.org/read/chapter/20
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.specification_version = 2 if s.respond_to? :specification_version=
|
9
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
10
|
+
s.rubygems_version = '1.3.5'
|
11
|
+
|
12
|
+
## Leave these as is they will be modified for you by the rake gemspec task.
|
13
|
+
## If your rubyforge_project name is different, then edit it and comment out
|
14
|
+
## the sub! line in the Rakefile
|
15
|
+
s.name = 'newrelic_postgres_plugin'
|
16
|
+
s.version = '0.1.0'
|
17
|
+
s.date = '2013-06-20'
|
18
|
+
s.rubyforge_project = 'newrelic_postgres_plugin'
|
19
|
+
|
20
|
+
## Make sure your summary is short. The description may be as long
|
21
|
+
## as you like.
|
22
|
+
s.summary = "New Relic Postgres plugin"
|
23
|
+
s.description = <<-EOF
|
24
|
+
This is the New Relic plugin for monitoring Postgres developed by Boundless Inc.
|
25
|
+
EOF
|
26
|
+
|
27
|
+
## List the primary authors. If there are a bunch of authors, it's probably
|
28
|
+
## better to set the email to an email list or something. If you don't have
|
29
|
+
## a custom homepage, consider using your GitHub URL or the like.
|
30
|
+
s.authors = ["Matt Hodgson"]
|
31
|
+
s.email = 'matt@boundless.com'
|
32
|
+
s.homepage = 'http://boundless.com'
|
33
|
+
|
34
|
+
## This gets added to the $LOAD_PATH so that 'lib/NAME.rb' can be required as
|
35
|
+
## require 'NAME.rb' or'/lib/NAME/file.rb' can be as require 'NAME/file.rb'
|
36
|
+
s.require_paths = %w[lib]
|
37
|
+
|
38
|
+
## This sections is only necessary if you have C extensions.
|
39
|
+
# s.require_paths << 'ext'
|
40
|
+
# s.extensions = %w[ext/extconf.rb]
|
41
|
+
|
42
|
+
## If your gem includes any executables, list them here.
|
43
|
+
s.executables = ["pg_monitor"]
|
44
|
+
|
45
|
+
## Specify any RDoc options here. You'll want to add your README and
|
46
|
+
## LICENSE files to the extra_rdoc_files list.
|
47
|
+
s.rdoc_options = ["--charset=UTF-8",
|
48
|
+
"--main", "README.md"]
|
49
|
+
s.extra_rdoc_files = %w[README.md LICENSE]
|
50
|
+
|
51
|
+
## The newrelic_plugin needs to be installed. Prior to public release, the
|
52
|
+
# gem needs to be downloaded from git@github.com:newrelic-platform/newrelic_plugin.git
|
53
|
+
# and built using the "rake build" command
|
54
|
+
s.add_dependency('newrelic_plugin', ">= 0.2.11")
|
55
|
+
s.add_dependency('pg', ">= 0.15.1")
|
56
|
+
|
57
|
+
s.post_install_message = <<-EOF
|
58
|
+
To get started with this plugin, create a working directory and do
|
59
|
+
pg_monitor -h
|
60
|
+
to find out how to install and run the plugin agent.
|
61
|
+
EOF
|
62
|
+
|
63
|
+
## Leave this section as-is. It will be automatically generated from the
|
64
|
+
## contents of your Git repository via the gemspec task. DO NOT REMOVE
|
65
|
+
## THE MANIFEST COMMENTS, they are used as delimiters by the task.
|
66
|
+
# = MANIFEST =
|
67
|
+
s.files = %w[
|
68
|
+
Gemfile
|
69
|
+
Gemfile.lock
|
70
|
+
LICENSE
|
71
|
+
README.md
|
72
|
+
Rakefile
|
73
|
+
bin/pg_monitor
|
74
|
+
config/newrelic_plugin.yml
|
75
|
+
lib/newrelic_postgres_plugin.rb
|
76
|
+
lib/newrelic_postgres_plugin/agent.rb
|
77
|
+
newrelic_postgres_plugin.gemspec
|
78
|
+
]
|
79
|
+
# = MANIFEST =
|
80
|
+
|
81
|
+
## Test files will be grabbed from the file list. Make sure the path glob
|
82
|
+
## matches what you actually use.
|
83
|
+
s.test_files = s.files.select { |path| path =~ /^test\/test_.*\.rb/ }
|
84
|
+
end
|
metadata
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: newrelic_postgres_plugin
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Matt Hodgson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-06-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: newrelic_plugin
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.2.11
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.2.11
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: pg
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.15.1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.15.1
|
41
|
+
description: |
|
42
|
+
This is the New Relic plugin for monitoring Postgres developed by Boundless Inc.
|
43
|
+
email: matt@boundless.com
|
44
|
+
executables:
|
45
|
+
- pg_monitor
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files:
|
48
|
+
- README.md
|
49
|
+
- LICENSE
|
50
|
+
files:
|
51
|
+
- Gemfile
|
52
|
+
- Gemfile.lock
|
53
|
+
- LICENSE
|
54
|
+
- README.md
|
55
|
+
- Rakefile
|
56
|
+
- bin/pg_monitor
|
57
|
+
- config/newrelic_plugin.yml
|
58
|
+
- lib/newrelic_postgres_plugin.rb
|
59
|
+
- lib/newrelic_postgres_plugin/agent.rb
|
60
|
+
- newrelic_postgres_plugin.gemspec
|
61
|
+
homepage: http://boundless.com
|
62
|
+
licenses: []
|
63
|
+
metadata: {}
|
64
|
+
post_install_message: |
|
65
|
+
To get started with this plugin, create a working directory and do
|
66
|
+
pg_monitor -h
|
67
|
+
to find out how to install and run the plugin agent.
|
68
|
+
rdoc_options:
|
69
|
+
- --charset=UTF-8
|
70
|
+
- --main
|
71
|
+
- README.md
|
72
|
+
require_paths:
|
73
|
+
- lib
|
74
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - '>='
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
requirements: []
|
85
|
+
rubyforge_project: newrelic_postgres_plugin
|
86
|
+
rubygems_version: 2.0.2
|
87
|
+
signing_key:
|
88
|
+
specification_version: 2
|
89
|
+
summary: New Relic Postgres plugin
|
90
|
+
test_files: []
|