Commit fa4de8dd authored by Felipe Salum's avatar Felipe Salum
Browse files

Merge branch '3flex-patch-1'

parents 7c5f1782 e8fe57b1
pkg/
Gemfile.lock
.vagrant
......@@ -4,6 +4,14 @@ Release notes for the fsalum-newrelic module.
------------------------------------------
#### 4.0.1 - 2014-08-13
* Added warning for deprecated classes `newrelic::server` and `newrelic::php`
* PR #16 - Added missing newrelic.capture_params to newrelic.ini.erb (@brentclark)
* PR #17 - change 'newrelic::server' to be a class (@3flex)
* PR #18 - tweak apt::source declaration (@3flex)
* PR #19 - Remove unneeded exec (@3flex)
#### 4.0.0 - 2014-06-29
* Refactored the module, test before pushing to production
......
name 'fsalum-newrelic'
version '4.0.0'
version '4.0.1'
source 'git://github.com/fsalum/puppet-newrelic.git'
author 'Felipe Salum'
license 'Apache License, Version 2.0'
......
......@@ -16,6 +16,9 @@ IMPORTANT
Module version 4.x was refactored. A lot of parameters were added, removed, renamed or changed.
Module version 4.0.1 is moving away from defined classes, deprecation warnings were added.
Using the new classes is backwards compatible.
Review all the parameters you use before deploying this module in production.
Quick Start
......@@ -24,25 +27,22 @@ Quick Start
To install the Newrelic Server Monitoring and the PHP agent packages, include the following in your manifest file:
node default {
newrelic::server {
'srvXYZ':
newrelic_license_key => 'your license key here',
class {'newrelic::server::linux':
newrelic_license_key => 'your license key here',
}
newrelic::php {
'appXYZ':
newrelic_license_key => 'your license key here',
newrelic_ini_appname => 'Your PHP Application',
class {'newrelic::agent::php':
newrelic_license_key => 'your license key here',
newrelic_ini_appname => 'Your PHP Application',
}
}
If you use Ubuntu 14.04 and php5-fpm you can pass an array of directories for PHP ini files:
newrelic::php {
'appXYZ':
newrelic_license_key => 'your license key here',
newrelic_ini_appname => 'Your PHP Application',
newrelic_php_conf_dir => ['/etc/php5/apache2/conf.d','/etc/php5/fpm/conf.d'],
class {'newrelic::agent::php':
newrelic_license_key => 'your license key here',
newrelic_ini_appname => 'Your PHP Application',
newrelic_php_conf_dir => ['/etc/php5/mods-available/conf.d','/etc/php5/fpm/conf.d'],
}
Parameters
......@@ -57,7 +57,7 @@ Mandatory parameters:
Copyright and License
---------------------
Copyright (C) 2012 Felipe Salum
Copyright (C) 2014 Felipe Salum
Felipe Salum can be contacted at: fsalum@gmail.com
......
......@@ -7,16 +7,16 @@ if ENV['VAGRANT_HOME'].nil?
end
newrelic = {
:'centos65' => { :memory => '120', :ip => '10.1.2.13', :box => 'puppetlabs/centos-6.5-64-puppet', :domain => 'newrelic.local' },
:'trusty' => { :memory => '360', :ip => '10.1.2.14', :box => 'ubuntu/trusty64', :domain => 'newrelic.local' },
:'saucy' => { :memory => '120', :ip => '10.1.2.15', :box => 'puppetlabs/ubuntu-13.10-64-puppet', :domain => 'newrelic.local' },
:'precise' => { :memory => '120', :ip => '10.1.2.16', :box => 'puppetlabs/ubuntu-12.04-64-puppet', :domain => 'newrelic.local' },
:'debian74' => { :memory => '120', :ip => '10.1.2.17', :box => 'puppetlabs/debian-7.4-64-puppet', :domain => 'newrelic.local' },
:'centos5' => { :memory => '120', :ip => '10.1.2.10', :box => 'puppetlabs/centos-5.10-64-puppet', :domain => 'newrelic.local' },
:'centos65' => { :memory => '120', :ip => '10.1.2.11', :box => 'puppetlabs/centos-6.5-64-puppet', :domain => 'newrelic.local' },
:'precise' => { :memory => '120', :ip => '10.1.2.20', :box => 'puppetlabs/ubuntu-12.04-64-puppet', :domain => 'newrelic.local' },
:'saucy' => { :memory => '120', :ip => '10.1.2.21', :box => 'puppetlabs/ubuntu-13.10-64-puppet', :domain => 'newrelic.local' },
:'trusty' => { :memory => '360', :ip => '10.1.2.22', :box => 'puppetlabs/ubuntu-14.04-64-puppet', :domain => 'newrelic.local' },
:'squeeze' => { :memory => '120', :ip => '10.1.2.30', :box => 'puppetlabs/debian-6.0.9-64-puppet', :domain => 'newrelic.local' },
:'wheezy' => { :memory => '120', :ip => '10.1.2.31', :box => 'puppetlabs/debian-7.5-64-puppet', :domain => 'newrelic.local' },
}
Vagrant::Config.run("2") do |config|
config.vbguest.auto_update = false
config.hostmanager.enabled = false
newrelic.each_pair do |name, opts|
config.vm.define name do |n|
......
# Class: newrelic::agent::php
#
# This class install the New Relic PHP Agent
#
# Parameters:
#
# [*newrelic_php_package_ensure*]
# Specific the Newrelic PHP package update state. Defaults to 'present'. Possible value is 'latest'.
#
# [*newrelic_php_service_ensure*]
# Specify the Newrelic PHP service running state. Defaults to 'running'. Possible value is 'stopped'.
#
# [*newrelic_daemon_cfgfile_ensure*]
# Specify the Newrelic daemon cfg file state. Change to absent for agent startup mode. Defaults to 'present'. Possible value is 'absent'.
#
# Actions:
#
# Requires:
#
# Sample Usage:
#
# class {'newrelic::agent::php':
# newrelic_license_key => 'your license key here',
# newrelic_php_package_ensure => 'latest',
# newrelic_php_service_ensure => 'running',
# newrelic_ini_appname => 'Your PHP Application',
# }
#
# If no parameters are set it will use the newrelic.ini defaults
#
# For detailed explanation about the parameters below see: https://docs.newrelic.com/docs/php/php-agent-phpini-settings
#
class newrelic::agent::php (
$newrelic_php_package_ensure = 'present',
$newrelic_php_service_ensure = 'running',
$newrelic_php_conf_dir = $::newrelic::params::newrelic_php_conf_dir,
$newrelic_php_package = $::newrelic::params::newrelic_php_package,
$newrelic_php_service = $::newrelic::params::newrelic_php_service,
$newrelic_license_key = undef,
$newrelic_ini_appname = undef,
$newrelic_ini_browser_monitoring_auto_instrument = undef,
$newrelic_ini_enabled = undef,
$newrelic_ini_error_collector_enabled = undef,
$newrelic_ini_error_collector_prioritize_api_errors = undef,
$newrelic_ini_error_collector_record_database_errors = undef,
$newrelic_ini_framework = undef,
$newrelic_ini_high_security = undef,
$newrelic_ini_logfile = undef,
$newrelic_ini_loglevel = undef,
$newrelic_ini_transaction_tracer_custom = undef,
$newrelic_ini_transaction_tracer_detail = undef,
$newrelic_ini_transaction_tracer_enabled = undef,
$newrelic_ini_transaction_tracer_explain_enabled = undef,
$newrelic_ini_transaction_tracer_explain_threshold = undef,
$newrelic_ini_transaction_tracer_record_sql = undef,
$newrelic_ini_transaction_tracer_slow_sql = undef,
$newrelic_ini_transaction_tracer_stack_trace_threshold = undef,
$newrelic_ini_transaction_tracer_threshold = undef,
$newrelic_ini_capture_params = undef,
$newrelic_ini_ignored_params = undef,
$newrelic_daemon_cfgfile_ensure = 'present',
$newrelic_daemon_dont_launch = undef,
$newrelic_daemon_pidfile = undef,
$newrelic_daemon_location = undef,
$newrelic_daemon_logfile = undef,
$newrelic_daemon_loglevel = undef,
$newrelic_daemon_port = undef,
$newrelic_daemon_ssl = undef,
$newrelic_daemon_ssl_ca_bundle = undef,
$newrelic_daemon_ssl_ca_path = undef,
$newrelic_daemon_proxy = undef,
$newrelic_daemon_collector_host = undef,
$newrelic_daemon_auditlog = undef,
) inherits ::newrelic {
if ! $newrelic_license_key {
fail('You must specify a valid License Key.')
}
package { $newrelic_php_package:
ensure => $newrelic_php_package_ensure,
require => Class['newrelic::params'],
}
service { $newrelic_php_service:
ensure => $newrelic_php_service_ensure,
enable => true,
hasrestart => true,
hasstatus => true,
}
::newrelic::php::newrelic_ini { $newrelic_php_conf_dir:
newrelic_license_key => $newrelic_license_key,
before => [ File['/etc/newrelic/newrelic.cfg'], Service[$newrelic_php_service] ],
require => Package[$newrelic_php_package],
notify => Service[$newrelic_php_service],
}
file { '/etc/newrelic/newrelic.cfg':
ensure => $newrelic_daemon_cfgfile_ensure,
path => '/etc/newrelic/newrelic.cfg',
content => template('newrelic/newrelic.cfg.erb'),
before => Service[$newrelic_php_service],
notify => Service[$newrelic_php_service],
}
}
......@@ -30,7 +30,6 @@ class newrelic::params {
$newrelic_service_name = 'newrelic-sysmond'
$newrelic_php_package = 'newrelic-php5'
$newrelic_php_service = 'newrelic-daemon'
$newrelic_php_conf_dir = ['/etc/php5/conf.d']
apt::source { 'newrelic':
location => 'http://apt.newrelic.com/debian/',
repos => 'non-free',
......@@ -39,6 +38,31 @@ class newrelic::params {
include_src => false,
release => 'newrelic',
}
case $::operatingsystem {
'Debian': {
case $::operatingsystemrelease {
/^6/: {
$newrelic_php_conf_dir = ['/etc/php5/conf.d']
}
default: {
$newrelic_php_conf_dir = ['/etc/php5/mods-available']
}
}
}
'Ubuntu': {
case $::operatingsystemrelease {
/^(10|12)/: {
$newrelic_php_conf_dir = ['/etc/php5/conf.d']
}
default: {
$newrelic_php_conf_dir = ['/etc/php5/mods-available']
}
}
}
default: {
$newrelic_php_conf_dir = ['/etc/php5/conf.d']
}
}
}
default: {
fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}, module ${module_name} only support osfamily RedHat and Debian")
......
......@@ -88,6 +88,8 @@ define newrelic::php (
$newrelic_php_package = $newrelic::params::newrelic_php_package
$newrelic_php_service = $newrelic::params::newrelic_php_service
warning('newrelic::php is deprecated. Please switch to the newrelic::agent::php class.')
if ! $newrelic_license_key {
fail('You must specify a valid License Key.')
}
......
......@@ -56,6 +56,8 @@ define newrelic::server (
$newrelic_package_name = $newrelic::params::newrelic_package_name
$newrelic_service_name = $newrelic::params::newrelic_service_name
warning('newrelic::server is deprecated. Please switch to the newrelic::server::linux class.')
if ! $newrelic_license_key {
fail('You must specify a valid License Key.')
}
......
# == Class: newrelic::server::linux
#
# This class installs and configures NewRelic server monitoring.
#
# === Parameters
#
# [*newrelic_service_enable*]
# Specify the service startup state. Defaults to true. Possible value is false.
#
# [*newrelic_service_ensure*]
# Specify the service running state. Defaults to 'running'. Possible value is 'stopped'.
#
# [*newrelic_package_ensure*]
# Specify the package update state. Defaults to 'present'. Possible value is 'latest'.
#
# [*newrelic_license_key*]
# Specify your Newrelic License Key.
#
# === Variables
#
# === Examples
#
# class {'newrelic::server::linux':
# newrelic_license_key => 'your license key here',
# newrelic_package_ensure => 'latest',
# newrelic_service_ensure => 'running',
# }
#
# === Authors
#
# Felipe Salum <fsalum@gmail.com>
#
# === Copyright
#
# Copyright 2012 Felipe Salum, unless otherwise noted.
#
class newrelic::server::linux (
$newrelic_package_ensure = 'present',
$newrelic_service_enable = true,
$newrelic_service_ensure = 'running',
$newrelic_license_key = undef,
$newrelic_package_name = $::newrelic::params::newrelic_package_name,
$newrelic_service_name = $::newrelic::params::newrelic_service_name,
$newrelic_nrsysmond_loglevel = undef,
$newrelic_nrsysmond_logfile = undef,
$newrelic_nrsysmond_proxy = undef,
$newrelic_nrsysmond_ssl = undef,
$newrelic_nrsysmond_ssl_ca_bundle = undef,
$newrelic_nrsysmond_ssl_ca_path = undef,
$newrelic_nrsysmond_pidfile = undef,
$newrelic_nrsysmond_collector_host = undef,
$newrelic_nrsysmond_timeout = undef,
) inherits ::newrelic {
if ! $newrelic_license_key {
fail('You must specify a valid License Key.')
}
package { $newrelic_package_name:
ensure => $newrelic_package_ensure,
notify => Service[$newrelic_service_name],
require => Class['newrelic::params'],
}
if ! $newrelic_nrsysmond_logfile {
$logdir = '/var/log/newrelic'
} else {
$logdir = dirname($newrelic_nrsysmond_logfile)
}
file { $logdir:
ensure => directory,
owner => 'newrelic',
group => 'newrelic',
require => Package[$newrelic_package_name],
before => Service[$newrelic_service_name],
}
file { '/etc/newrelic/nrsysmond.cfg':
ensure => present,
path => '/etc/newrelic/nrsysmond.cfg',
content => template('newrelic/nrsysmond.cfg.erb'),
require => Package[$newrelic_package_name],
before => Service[$newrelic_service_name],
notify => Service[$newrelic_service_name],
}
service { $newrelic_service_name:
ensure => $newrelic_service_ensure,
enable => $newrelic_service_enable,
hasrestart => true,
hasstatus => true,
require => Exec[$newrelic_license_key],
}
exec { $newrelic_license_key:
path => '/bin:/usr/bin',
command => "/usr/sbin/nrsysmond-config --set license_key=${newrelic_license_key}",
user => 'root',
group => 'root',
unless => "cat /etc/newrelic/nrsysmond.cfg | grep ${newrelic_license_key}",
require => Package[$newrelic_package_name],
notify => Service[$newrelic_service_name],
}
}
......@@ -2,11 +2,10 @@
node default {
newrelic::server {
'webXYZ-app':
newrelic_license_key => 'your license key here',
newrelic_package_ensure => 'latest',
newrelic_service_ensure => 'running',
class {'newrelic::server::linux':
newrelic_license_key => '',
newrelic_package_ensure => 'latest',
newrelic_service_ensure => 'running',
}
}
......@@ -7,16 +7,14 @@ node default {
}
class { '::apache::mod::php': }
newrelic::server {
'srvXYZ':
newrelic_license_key => '',
class {'newrelic::server::linux':
newrelic_license_key => '',
}
newrelic::php {
'appXYZ':
newrelic_license_key => '',
#newrelic_php_conf_dir => ['/etc/php5/apache2/conf.d','/etc/php5/fpm/conf.d'],
require => Class['Apache::mod::php'],
class {'newrelic::agent::php':
newrelic_license_key => '',
#newrelic_php_conf_dir => ['/etc/php5/apache2/conf.d','/etc/php5/fpm/conf.d'],
require => Class['Apache::mod::php'],
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment