Puppet – Automate New Relic Server Monitor Agent Installation

This is an example to install the newrelic-sysmond package on the Puppet Agent.

class system::newrelic-sysmond ($licensekey) {
  package { "newrelic-sysmond": ensure => installed, }

  exec { 'Insert newrelic license key':
    command => "nrsysmond-config --set license_key=$licensekey",
    require => Package['newrelic-sysmond'],
    creates => '/etc/newrelic/key_added',
  }

  exec { 'Restart newrelic system monitor':
    command => "/etc/init.d/newrelic-sysmond start",
    require => Exec['Insert newrelic license key'],
    creates => '/etc/newrelic/key_added',
  }

  exec { 'Create the key_added file':
    command => "echo key_added > /etc/newrelic/key_added",
    require => Exec['Restart newrelic system monitor'],
    creates => '/etc/newrelic/key_added',
  }
}

 

Done =)

Advertisements

2 thoughts on “Puppet – Automate New Relic Server Monitor Agent Installation”

  1. Thanks for example really useful. Just wondering what the best way of calling this would be should I include this class in init.pp like this

    if $::newrelic_license != '' {
      class { 'newrelic-sysmond':
        $licensekey => $::newrelic_license,
      }
    }
    

    or would there be a better way?

    Thank you very much for the help. 🙂

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s