-
Notifications
You must be signed in to change notification settings - Fork 5
Newrelic Support #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| require 'rubygems' | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Usage
|
||
| require 'json' | ||
|
|
||
| raise ArgumentError, "Required first parameter missing" if ARGV.length != 1 | ||
|
|
||
| service = ARGV[0] | ||
|
|
||
| parsed_vcap_services=JSON.parse(ENV['VCAP_SERVICES']) | ||
| parsed_vcap_services.each do |key, array| | ||
| array.each do |serviceMap| | ||
| if ( serviceMap["tags"].index(service) || serviceMap["name"].match(/#{service}/)) | ||
| serviceMap["credentials"].each do |index,value| | ||
| puts index+"="+value.to_s+"\n" | ||
| end | ||
| end | ||
| end | ||
| end | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| # global settings | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is the nginx-nr-agent.ini configuration to be used to run the nginx-nr-agent There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. more on the nginx-nr-agent and the dependencies can be found in the branch file https://github.com/muymoo/staticfile-buildpack/tree/files https://github.com/muymoo/staticfile-buildpack/blob/files/bin/build_nginx_nr_agent |
||
|
|
||
| [global] | ||
| newrelic_license_key=<%= ENV["NEW_RELIC_LICENSE_KEY"] %> | ||
| poll_interval=60 | ||
|
|
||
| # logging settings | ||
|
|
||
| [loggers] | ||
| keys=root | ||
|
|
||
| [handlers] | ||
| keys=consoleHandler,fileHandler | ||
|
|
||
| [formatters] | ||
| keys=simpleFormatter | ||
|
|
||
| [logger_root] | ||
| level=DEBUG | ||
| handlers=consoleHandler,fileHandler | ||
|
|
||
| [handler_consoleHandler] | ||
| class=StreamHandler | ||
| level=DEBUG | ||
| formatter=simpleFormatter | ||
| args=(sys.stdout,) | ||
|
|
||
| [handler_fileHandler] | ||
| class=FileHandler | ||
| level=DEBUG | ||
| formatter=simpleFormatter | ||
| args=('<%= ENV["APP_ROOT"] %>/.nginx-nr-agent/logs/nginx-nr-agent.log','a',) | ||
|
|
||
| [formatter_simpleFormatter] | ||
| format=%(asctime)s %(name)s [%(levelname)s]: %(message)s | ||
| datefmt= | ||
|
|
||
| # data sources settings | ||
|
|
||
| [source1] | ||
| <% if ENV["NEW_RELIC_APP_NAME"] %> | ||
| name=<%= ENV["NEW_RELIC_APP_NAME"] %> | ||
| <% else %> | ||
| name=<%= ENV["vcap_application_name"] %> | ||
| <% end %> | ||
| url=http://localhost:<%= ENV["PORT"] %>/nginx_status | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,7 @@ error_log <%= ENV["APP_ROOT"] %>/openresty/nginx/logs/error.log; | |
| events { worker_connections 1024; } | ||
|
|
||
| http { | ||
| log_format cloudfoundry '$http_x_forwarded_for - $http_referer - [$time_local] "$request" $status $body_bytes_sent'; | ||
| log_format cloudfoundry 'Instance-<%= ENV["CF_INSTANCE_INDEX"] %>|$time_local|$http_x_forwarded_for|$upstream_addr|$upstream_response_time|$request|$http_user_agent|$request_time'; | ||
| access_log <%= ENV["APP_ROOT"] %>/openresty/nginx/logs/access.log cloudfoundry; | ||
| default_type application/octet-stream; | ||
| include mime.types; | ||
|
|
@@ -28,6 +28,15 @@ http { | |
| listen <%= ENV["PORT"] %>; | ||
| server_name localhost; | ||
|
|
||
| <% if ENV["NEW_RELIC_LICENSE_KEY"] %> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this line will have to be added to any application using this buildpack wanting to be monitored by newrelic |
||
| location /nginx_status { | ||
| stub_status on; | ||
| access_log off; | ||
| allow 127.0.0.1; | ||
| deny all; | ||
| } | ||
| <% end %> | ||
|
|
||
| location / { | ||
| root <%= ENV["APP_ROOT"] %>/public; | ||
| index index.html index.htm Default.htm; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
starting the python daemon that will monitor the nginx process