forked from jerrod/ey-cloud-recipes
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Newrelic Server Monitoring Cookbook. Works only with non-eycloud …
…Newrelic accounts for the moment, will change soon. Signed-off-by: Scott M. Likens <slikens@engineyard.com>
- Loading branch information
Scott M. Likens
committed
Nov 11, 2011
1 parent
7d09b93
commit 89a241a
Showing
6 changed files
with
225 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
Newrelic Server Monitoring | ||
========= | ||
|
||
[Newrelic Server Monitoring][1] is a new addition to the Newrelic offering. | ||
|
||
* Monitor CPU usage, physical memory, network activity, load averages, and more as part of your APM tool | ||
* View all apps running on a server, and assess the impact of server utilization on web app performance | ||
* See which servers have capacity issues so you can take corrective action | ||
* See processes prioritized by memory or CPU consumption | ||
* Track server health availability in clouds, physical, or hybrid environments | ||
|
||
|
||
Special Note | ||
-------- | ||
|
||
Currently does *NOT* work with the EYCloud Newrelic offering; you will need Newrelic account purchased outside of the EYCloud Dashboard at this time. This limitation will change in the future. | ||
|
||
Overview | ||
-------- | ||
|
||
This cookbook should install and configure Newrelic Server Monitoring. This should compliment the Newrelic Application monitoring very well. | ||
|
||
|
||
Dependencies | ||
-------- | ||
|
||
This cookbook depends on the emerge cookbook, if you do not have it you can add it like as a submodule as the example below shows, | ||
|
||
``git submodule update --init`` | ||
``git submodule add git://github.com/damm/ey-dnapi.git cookbooks/dnapi`` | ||
``git submodule add git://github.com/damm/ey-emerge.git cookbooks/emerge`` | ||
|
||
Installation | ||
-------- | ||
|
||
# Ensure you have the emerge cookbook dependency installed in your local cookbook repository | ||
# Add the following to main/recipes/default.rb | ||
|
||
``require_recipe "newrelic_server_monitoring"`` | ||
|
||
# Configure the [Newrelic License Key][2] in attributes/newrelic.rb | ||
# Upload your recipes and apply. | ||
|
||
|
||
How to get Support | ||
-------- | ||
|
||
* irc://irc.freenode.net/#newrelic | ||
* This Github repository. | ||
* This Cookbook provides a technology that is not listed in the Engine Yard [Technology Stack][3] and is not supported by Engine Yard at this time. | ||
|
||
[1]: http://blog.newrelic.com/2011/11/08/server-monitoring-is-here/ | ||
[2]: https://github.com/engineyard/ey-cloud-recipes/blob/master/cookbooks/newrelic_server_monitoring/attributes/newrelic.rb#L1 | ||
[3]: http://www.engineyard.com/products/technology/stack |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
newrelic :license_key => "not-set" |
7 changes: 7 additions & 0 deletions
7
cookbooks/newrelic_server_monitoring/files/default/nrsysmond.monitrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
check process nrsysmond | ||
with pidfile /var/run/nrsysmond.pid | ||
start program = "/bin/bash -c '/usr/sbin/nrsysmond -p /var/run/nrsysmond.pid -c /etc/newrelic/nrsysmond.cfg'" | ||
stop program = "/bin/bash -c '/bin/kill `cat /run/run/nrsysmond.pid`'" | ||
if mem > 255.0 MB for 2 cycles then restart | ||
if cpu > 100% for 2 cycles then restart | ||
group newrelic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
enable_package "app-admin/newrelic-sysmond" do | ||
version "1.1.0.111" | ||
end | ||
|
||
package "app-admin/newrelic-sysmond" do | ||
action :install | ||
version "1.1.0.111" | ||
end | ||
|
||
template "/etc/newrelic/nrsysmond.cfg" do | ||
source "nrsysmond.cfg.erb" | ||
owner 'root' | ||
group 'root' | ||
mode 0644 | ||
backup 0 | ||
variables( | ||
:key => node[:newrelic][:license_key]) | ||
end | ||
|
||
remote_file "/etc/monit.d/nrsysmond.monitrc" do | ||
owner "root" | ||
group "root" | ||
mode 0644 | ||
backup 0 | ||
source "nrsysmond.monitrc" | ||
end | ||
|
||
directory "/var/log/newrelic" do | ||
action :create | ||
recursive true | ||
owner 'root' | ||
group 'root' | ||
end | ||
|
||
execute "monit reload" do | ||
action :run | ||
end |
123 changes: 123 additions & 0 deletions
123
cookbooks/newrelic_server_monitoring/templates/default/nrsysmond.cfg.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
# | ||
# New Relic Server Monitor configuration file. | ||
# | ||
# Lines that begin with a # are comment lines and are ignored by the server | ||
# monitor. For those options that have command line equivalents, if the | ||
# option is specified on the command line it will over-ride any value set | ||
# in this file. | ||
# | ||
|
||
# | ||
# Option : license_key | ||
# Value : 40-character hexadecimal string provided by New Relic. This is | ||
# required in order for the server monitor to start. | ||
# Default: none | ||
# | ||
license_key=<%= @key %> | ||
|
||
# | ||
# Option : loglevel | ||
# Value : Level of detail you want in the log file (as defined by the logfile | ||
# setting below. Valid values are (in increasing levels of verbosity): | ||
# error - show errors only | ||
# warning - show errors and warnings | ||
# info - show minimal additional information messages | ||
# verbose - show more detailed information messages | ||
# debug - show debug messages | ||
# verbosedebug - show very detailed debug messages | ||
# Default: error | ||
# Note : Can also be set with the -d command line option. | ||
# | ||
loglevel=info | ||
|
||
# | ||
# Option : logfile | ||
# Value : Name of the file where the server monitor will store it's log | ||
# messages. The amount of detail stored in this file is controlled | ||
# by the loglevel option (above). | ||
# Default: none. However it is highly recommended you set a value for this. | ||
# Note : Can also be set with the -l command line option. | ||
# | ||
logfile=/var/log/newrelic/nrsysmond.log | ||
|
||
# | ||
# Option : proxy | ||
# Value : The name and optional login credentials of the proxy server to use | ||
# for all communication with the New Relic collector. In its simplest | ||
# form this setting is just a hostname[:port] setting. The default | ||
# port if none is specified is 1080. If your proxy requires a user | ||
# name, use the syntax user@host[:port]. If it also requires a | ||
# password use the format user:password@host[:port]. For example: | ||
# fred:secret@proxy.mydomain.com:8181 | ||
# Default: none (use a direct connection) | ||
# | ||
#proxy= | ||
|
||
# | ||
# Option : ssl | ||
# Value : Whether or not to use the Secure Sockets Layer (SSL) for all | ||
# communication with the New Relic collector. Possible values are | ||
# true/on or false/off. In certain rare cases you may need to modify | ||
# the SSL certificates settings below. | ||
# Default: false | ||
# | ||
#ssl=false | ||
|
||
# | ||
# Option : ssl_ca_bundle | ||
# Value : The name of a PEM-encoded Certificate Authority (CA) bundle to use | ||
# for SSL connections. This very rarely needs to be set. The monitor | ||
# will attempt to find the bundle in the most common locations. If | ||
# you need to use SSL and the monitor is unable to locate a CA bundle | ||
# then either set this value or the ssl_ca_path option below. | ||
# Default: /etc/ssl/certs/ca-certificates.crt or | ||
# /etc/pki/tls/certs/ca-bundle.crt | ||
# Note : Can also be set with the -b command line option. | ||
# | ||
#ssl_ca_bundle=/path/to/your/bundle.crt | ||
|
||
# | ||
# Option : ssl_ca_path | ||
# Value : If your SSL installation does not use CA bundles, but rather has a | ||
# directory with PEM-encoded Certificate Authority files, set this | ||
# option to the name of the directory that contains all the CA files. | ||
# Default: /etc/ssl/certs | ||
# Note : Can also be set with the -S command line option. | ||
# | ||
#ssl_ca_path=/etc/ssl/certs | ||
|
||
# | ||
# Option : pidfile | ||
# Value : Name of a file where the server monitoring daemon will store it's | ||
# process ID (PID). This is used by the startup and shutdown script | ||
# to determine if the monitor is already running, and to start it up | ||
# or shut it down. | ||
# Default: /tmp/nrsysmond.pid | ||
# Note : Can also be set with the -p command line option. | ||
# | ||
#pidfile=/var/run/newrelic/nrsysmond.pid | ||
|
||
# | ||
# Option : collector_host | ||
# Value : The name of the New Relic collector to connect to. This should only | ||
# ever be changed on advise from a New Relic support staff member. | ||
# The format is host[:port]. Using a port number of 0 means the default | ||
# port, which is 80 (if not using the ssl option - see below) or 443 | ||
# if SSL is enabled. If the port is omitted the default value is used. | ||
# Default: collector.newrelic.com | ||
# | ||
#collector_host=collector.newrelic.com | ||
|
||
# | ||
# Option : timeout | ||
# Value : How long the monitor should wait to contact the collector host. If | ||
# the connection cannot be established in this period of time, the | ||
# monitor will progressively back off in 15-second increments, up to | ||
# a maximum of 300 seconds. Once the initial connection has been | ||
# established, this value is reset back to the value specified here | ||
# (or the default). This then sets the maximum time to wait for | ||
# a connection to the collector to report data. There is no back-off | ||
# once the original connection has been made. The value is in seconds. | ||
# Default: 30 | ||
# | ||
#timeout=30 |