newrelic_postgres_plugin 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +61 -1
- data/config/newrelic_plugin.yml +2 -1
- data/lib/newrelic_postgres_plugin.rb +1 -1
- data/lib/newrelic_postgres_plugin/agent.rb +15 -13
- data/newrelic_postgres_plugin.gemspec +3 -2
- data/postgresql.png +0 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbe18cb196091deffd2bc167b9248c79b54c5d5c
|
4
|
+
data.tar.gz: 85eca77e7b685dab29a1de2639e5161a145c9aea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4b3e7dcb3f6f318f94b443a03165823f4b88f8a99a493df0479b3a432bcaeb250a5081b8aebb2e510513dd42edd0161e2def7a10eebeb18386ab627613ac592
|
7
|
+
data.tar.gz: f6b1501ab4440e7cec1100cb3710cd41c64fbc46dd9d8a1efab32040c28aa5d6a72d132261509a8ca3dfe9f8dd1d87abe5ba398a9b4fcc8fcfe007a5ec2994ce
|
data/README.md
CHANGED
@@ -1,4 +1,64 @@
|
|
1
|
-
|
1
|
+
NewRelic Postgres Plugin
|
2
2
|
========================
|
3
3
|
|
4
4
|
A NewRelic Platform Postgres Plugin
|
5
|
+
|
6
|
+
The New Relic Postgres Plugin enables integrated monitoring of your Postgres database in a custom NewRelic dashboard. Currently the following metrics are recorded:
|
7
|
+
|
8
|
+
* Index size, hit rate, and count
|
9
|
+
* Cache hit rate
|
10
|
+
* Idle and active connection counts
|
11
|
+
* BGWriter metrics
|
12
|
+
* Tuple metrics
|
13
|
+
* Transactions committed and rolled back
|
14
|
+
|
15
|
+
## Requirements
|
16
|
+
|
17
|
+
### Proxy host
|
18
|
+
|
19
|
+
You need a host to install the plugin on that is able to poll the desired Postgres database. That
|
20
|
+
host also needs Ruby (tested with 2.0.0), and support for rubygems.
|
21
|
+
|
22
|
+
|
23
|
+
### Postgres
|
24
|
+
|
25
|
+
This plugin has been tested with with a few different Postgres version and should work with any version compatible with the pg gem.
|
26
|
+
|
27
|
+
|
28
|
+
## Installation and Running
|
29
|
+
|
30
|
+
1. Install this gem from RubyGems:
|
31
|
+
|
32
|
+
```gem install newrelic_postgres_plugin```
|
33
|
+
|
34
|
+
2. Create an installation directory (like /opt/newrelic/postgres ).
|
35
|
+
3. In the installation directory, execute
|
36
|
+
|
37
|
+
```pg_monitor install -l LICENSE_KEY```
|
38
|
+
|
39
|
+
using the license key from your New Relic account.
|
40
|
+
4. Edit the +config/newrelic_plugin.yml+ file generated in step 4. Setup host/port/user/password/dbname for your postgres connection.
|
41
|
+
5. Execute
|
42
|
+
|
43
|
+
```pg_monitor run```
|
44
|
+
|
45
|
+
6. You should now see your results in the left-hand navigation of the NewRelic web UI under a tab labeled 'Postgres'.
|
46
|
+
|
47
|
+
## Heroku Instructions
|
48
|
+
|
49
|
+
Unlike the default NewRelic Postgres plugin, this plugin is designed to be fully compatible with monitoring Heroku Postgres. In fact, we've even created a simple app you can run on Heroku to monitor your existing apps.
|
50
|
+
|
51
|
+
Instructions for using Heroku as your proxy host can be found in the [heroku_postgres_monitor](https://github.com/GoBoundless/heroku_postgres_monitor) repo.
|
52
|
+
|
53
|
+
## Support
|
54
|
+
|
55
|
+
Please use Github issue for support. We will do our best to address issues in a timely fashion.
|
56
|
+
|
57
|
+
## Developer Instructions
|
58
|
+
|
59
|
+
1. Fork/Clone the repository
|
60
|
+
2. Install bundler and run:
|
61
|
+
|
62
|
+
```bundle install```
|
63
|
+
|
64
|
+
3. Run <b><tt>rake -T</tt></b> to see rake options, including tests.
|
data/config/newrelic_plugin.yml
CHANGED
@@ -23,4 +23,5 @@ agents:
|
|
23
23
|
user: 'username'
|
24
24
|
password: 'password'
|
25
25
|
dbname: 'database_name'
|
26
|
-
sslmode: 'require'
|
26
|
+
sslmode: 'require' # (disable|allow|prefer|require)
|
27
|
+
label: 'Production DB' # This label is optional and will default to the server hostname - it shows up in the NewRelic Web UI
|
@@ -21,8 +21,8 @@ module NewRelic::PostgresPlugin
|
|
21
21
|
|
22
22
|
agent_guid 'com.boundless.postgres'
|
23
23
|
agent_version '1.0.0'
|
24
|
-
agent_config_options :host, :port, :user, :password, :dbname, :sslmode
|
25
|
-
agent_human_labels('Postgres') { "#{host}" }
|
24
|
+
agent_config_options :host, :port, :user, :password, :dbname, :sslmode, :label
|
25
|
+
agent_human_labels('Postgres') { "#{label || host}" }
|
26
26
|
|
27
27
|
def initialize name, agent_info, options={}
|
28
28
|
@previous_metrics = {}
|
@@ -92,17 +92,19 @@ module NewRelic::PostgresPlugin
|
|
92
92
|
@connection.exec(database_query) do |result|
|
93
93
|
result.each do |row|
|
94
94
|
database_name = row['datname']
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
95
|
+
if database_name == dbname
|
96
|
+
report_metric "Database/#{database_name}/Backends", '', row['numbackends'].to_i
|
97
|
+
report_derived_metric "Database/#{database_name}/Transactions/Committed", '', row['xact_commit'].to_i
|
98
|
+
report_derived_metric "Database/#{database_name}/Transactions/Rolled Back", '', row['xact_rollback'].to_i
|
99
|
+
report_derived_metric "Database/#{database_name}/Tuples/Read from Disk", '', row['blks_read'].to_i
|
100
|
+
report_derived_metric "Database/#{database_name}/Tuples/Read Cache Hit", '', row['blks_hit'].to_i
|
101
|
+
report_derived_metric "Database/#{database_name}/Tuples/Returned/From Sequential", '', row['tup_returned'].to_i
|
102
|
+
report_derived_metric "Database/#{database_name}/Tuples/Returned/From Bitmap", '', row['tup_fetched'].to_i
|
103
|
+
report_derived_metric "Database/#{database_name}/Tuples/Writes/Inserts", '', row['tup_inserted'].to_i
|
104
|
+
report_derived_metric "Database/#{database_name}/Tuples/Writes/Updates", '', row['tup_updated'].to_i
|
105
|
+
report_derived_metric "Database/#{database_name}/Tuples/Writes/Deletes", '', row['tup_deleted'].to_i
|
106
|
+
report_derived_metric "Database/#{database_name}/Conflicts", '', row['conflicts'].to_i
|
107
|
+
end
|
106
108
|
end
|
107
109
|
end
|
108
110
|
end
|
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
|
|
13
13
|
## If your rubyforge_project name is different, then edit it and comment out
|
14
14
|
## the sub! line in the Rakefile
|
15
15
|
s.name = 'newrelic_postgres_plugin'
|
16
|
-
s.version = '0.1.
|
17
|
-
s.date = '2013-
|
16
|
+
s.version = '0.1.3'
|
17
|
+
s.date = '2013-07-10'
|
18
18
|
s.rubyforge_project = 'newrelic_postgres_plugin'
|
19
19
|
|
20
20
|
## Make sure your summary is short. The description may be as long
|
@@ -75,6 +75,7 @@ to find out how to install and run the plugin agent.
|
|
75
75
|
lib/newrelic_postgres_plugin.rb
|
76
76
|
lib/newrelic_postgres_plugin/agent.rb
|
77
77
|
newrelic_postgres_plugin.gemspec
|
78
|
+
postgresql.png
|
78
79
|
]
|
79
80
|
# = MANIFEST =
|
80
81
|
|
data/postgresql.png
ADDED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: newrelic_postgres_plugin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Hodgson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: newrelic_plugin
|
@@ -58,6 +58,7 @@ files:
|
|
58
58
|
- lib/newrelic_postgres_plugin.rb
|
59
59
|
- lib/newrelic_postgres_plugin/agent.rb
|
60
60
|
- newrelic_postgres_plugin.gemspec
|
61
|
+
- postgresql.png
|
61
62
|
homepage: http://boundless.com
|
62
63
|
licenses: []
|
63
64
|
metadata: {}
|