Bash -> chef

I’ve been trying to wrap my head around chef and translating what
would be a trivial bash script into the chef equivalent.

The goal is to include NewRelic’s host server (not application)
monitoring on an Ubuntu box.

The bash process:

# Grab New Relic's apt sources.list fragment and tuck it away in

/etc/apt/sources.list.d
wget -O /etc/apt/sources.list.d/newrelic.list
http://download.newrelic.com/debian/newrelic.list
# Get their signing key (value previously ascertained)
apt-key adv --keyserver hkp://subkeys.pgp.net --recv-keys 548C16BF
# Run apt-get update and install package
apt-get update
apt-get install newrelic-sysmond
# Set your license key (presumably stuffed in an encrypted data bag)
nrsysmond-config --set license_key=<% key_ID %>
# Launch the daemon
/etc/init.d/newrelic-sysmond start

The easiest JGID method would be to write a ruby wrapper around the
bash. For parts of this I find chef methods.

There’s an “apt” cookbook which can do some things, including adding a
sources.list line, but apparently not downloading a sources.list.d/
fragment from a known URL. Am I missing something?

The apt cookbook provides for getting the signing key:

apt_repository "newrelic-servermon" do
    keyserver "keyserver.pgp.edu"
    key "548C16BF"
end

Running the config step looks like another shell wrapper.

The service resource should be able to start the daemon:

service "newrelic-servermon" do
    supports :status -> true, :restart => true, :reload => true
    action [:enable, :start]
end

A nice “plus” feature would be an easy way to add, say, "monit"
monitoring and possibly Nagios configuration for any given service,
rather than managing these separately in a Nagios recipe.

TIA.


Dr. Ed Morbius
Chief Scientist / Philologist / Robot Wrangler / Powerplant Operator
Krell Power Systems Unlimited

Have a look at the new relic cookbook at https://github.com/heavywater/chef-newrelic

On 10/08/2012, at 10:45 AM, Edward Morbius dredmorbius@gmail.com wrote:

I've been trying to wrap my head around chef and translating what
would be a trivial bash script into the chef equivalent.

The goal is to include NewRelic's host server (not application)
monitoring on an Ubuntu box.

The bash process:

Grab New Relic's apt sources.list fragment and tuck it away in

/etc/apt/sources.list.d
wget -O /etc/apt/sources.list.d/newrelic.list
http://download.newrelic.com/debian/newrelic.list

Get their signing key (value previously ascertained)

apt-key adv --keyserver hkp://subkeys.pgp.net --recv-keys 548C16BF

Run apt-get update and install package

apt-get update
apt-get install newrelic-sysmond

Set your license key (presumably stuffed in an encrypted data bag)

nrsysmond-config --set license_key=<% key_ID %>

Launch the daemon

/etc/init.d/newrelic-sysmond start

The easiest JGID method would be to write a ruby wrapper around the
bash. For parts of this I find chef methods.

There's an "apt" cookbook which can do some things, including adding a
sources.list line, but apparently not downloading a sources.list.d/
fragment from a known URL. Am I missing something?

The apt cookbook provides for getting the signing key:

apt_repository "newrelic-servermon" do
keyserver "keyserver.pgp.edu"
key "548C16BF"
end

Running the config step looks like another shell wrapper.

The service resource should be able to start the daemon:

service "newrelic-servermon" do
supports :status -> true, :restart => true, :reload => true
action [:enable, :start]
end

A nice "plus" feature would be an easy way to add, say, "monit"
monitoring and possibly Nagios configuration for any given service,
rather than managing these separately in a Nagios recipe.

TIA.

--
Dr. Ed Morbius
Chief Scientist / Philologist / Robot Wrangler / Powerplant Operator
Krell Power Systems Unlimited

Thanks. Giving that a shot (a few twists on the recipe shown, so I'm
not using it directly).

And it seems to answer my first question: there's no way of handling
an apt archive sourced from a URL directly.

On Thu, Aug 9, 2012 at 5:52 PM, Alan Harper alan@aussiegeek.net wrote:

Have a look at the new relic cookbook at
GitHub - heavywater/chef-newrelic: "Installs/Configures newrelic"

On 10/08/2012, at 10:45 AM, Edward Morbius dredmorbius@gmail.com wrote:

I've been trying to wrap my head around chef and translating what
would be a trivial bash script into the chef equivalent.

The goal is to include NewRelic's host server (not application)
monitoring on an Ubuntu box.

The bash process:

Grab New Relic's apt sources.list fragment and tuck it away in

/etc/apt/sources.list.d
wget -O /etc/apt/sources.list.d/newrelic.list
http://download.newrelic.com/debian/newrelic.list

Get their signing key (value previously ascertained)

apt-key adv --keyserver hkp://subkeys.pgp.net --recv-keys 548C16BF

Run apt-get update and install package

apt-get update
apt-get install newrelic-sysmond

Set your license key (presumably stuffed in an encrypted data bag)

nrsysmond-config --set license_key=<% key_ID %>

Launch the daemon

/etc/init.d/newrelic-sysmond start

The easiest JGID method would be to write a ruby wrapper around the
bash. For parts of this I find chef methods.

There's an "apt" cookbook which can do some things, including adding a
sources.list line, but apparently not downloading a sources.list.d/
fragment from a known URL. Am I missing something?

The apt cookbook provides for getting the signing key:

apt_repository "newrelic-servermon" do
keyserver "keyserver.pgp.edu"
key "548C16BF"
end

Running the config step looks like another shell wrapper.

The service resource should be able to start the daemon:

service "newrelic-servermon" do
supports :status -> true, :restart => true, :reload => true
action [:enable, :start]
end

A nice "plus" feature would be an easy way to add, say, "monit"
monitoring and possibly Nagios configuration for any given service,
rather than managing these separately in a Nagios recipe.

TIA.

--
Dr. Ed Morbius
Chief Scientist / Philologist / Robot Wrangler / Powerplant Operator
Krell Power Systems Unlimited

--
Dr. Ed Morbius
Chief Scientist / Philologist / Robot Wrangler / Powerplant Operator
Krell Power Systems Unlimited

And it seems to answer my first question: there's no way of handling
an apt archive sourced from a URL directly.
I don't think I understand this question.

If the .list file is all you want, then you may use a remote_file
resource for that.

The apt cookbook provides a LWRP that could be sued as such:

apt_repository "newrelic" do
uri "http://apt.newrelic.com/debian/"
distribution "newrelic"
components ["non-free"]
keyserver "keyserver.pgp.edu"
key "548C16BF"
end

(untested, but syntax should be close)

This should output a .list file containing the details that the one
you've linked to, as well as handle importing the gpg key.

HTH.
-M

On Thu, Aug 9, 2012 at 9:37 PM, Edward Morbius dredmorbius@gmail.com wrote:

Thanks. Giving that a shot (a few twists on the recipe shown, so I'm
not using it directly).

And it seems to answer my first question: there's no way of handling
an apt archive sourced from a URL directly.

On Thu, Aug 9, 2012 at 5:52 PM, Alan Harper alan@aussiegeek.net wrote:

Have a look at the new relic cookbook at
GitHub - heavywater/chef-newrelic: "Installs/Configures newrelic"

On 10/08/2012, at 10:45 AM, Edward Morbius dredmorbius@gmail.com wrote:

I've been trying to wrap my head around chef and translating what
would be a trivial bash script into the chef equivalent.

The goal is to include NewRelic's host server (not application)
monitoring on an Ubuntu box.

The bash process:

Grab New Relic's apt sources.list fragment and tuck it away in

/etc/apt/sources.list.d
wget -O /etc/apt/sources.list.d/newrelic.list
http://download.newrelic.com/debian/newrelic.list

Get their signing key (value previously ascertained)

apt-key adv --keyserver hkp://subkeys.pgp.net --recv-keys 548C16BF

Run apt-get update and install package

apt-get update
apt-get install newrelic-sysmond

Set your license key (presumably stuffed in an encrypted data bag)

nrsysmond-config --set license_key=<% key_ID %>

Launch the daemon

/etc/init.d/newrelic-sysmond start

The easiest JGID method would be to write a ruby wrapper around the
bash. For parts of this I find chef methods.

There's an "apt" cookbook which can do some things, including adding a
sources.list line, but apparently not downloading a sources.list.d/
fragment from a known URL. Am I missing something?

The apt cookbook provides for getting the signing key:

apt_repository "newrelic-servermon" do
keyserver "keyserver.pgp.edu"
key "548C16BF"
end

Running the config step looks like another shell wrapper.

The service resource should be able to start the daemon:

service "newrelic-servermon" do
supports :status -> true, :restart => true, :reload => true
action [:enable, :start]
end

A nice "plus" feature would be an easy way to add, say, "monit"
monitoring and possibly Nagios configuration for any given service,
rather than managing these separately in a Nagios recipe.

TIA.

--
Dr. Ed Morbius
Chief Scientist / Philologist / Robot Wrangler / Powerplant Operator
Krell Power Systems Unlimited

--
Dr. Ed Morbius
Chief Scientist / Philologist / Robot Wrangler / Powerplant Operator
Krell Power Systems Unlimited

Yeah, that's what I'm working with.

On Thu, Aug 9, 2012 at 6:46 PM, Mike miketheman@gmail.com wrote:

And it seems to answer my first question: there's no way of handling
an apt archive sourced from a URL directly.
I don't think I understand this question.

If the .list file is all you want, then you may use a remote_file
resource for that.

The apt cookbook provides a LWRP that could be sued as such:

apt_repository "newrelic" do
uri "http://apt.newrelic.com/debian/"
distribution "newrelic"
components ["non-free"]
keyserver "keyserver.pgp.edu"
key "548C16BF"
end

(untested, but syntax should be close)

This should output a .list file containing the details that the one
you've linked to, as well as handle importing the gpg key.

HTH.
-M

On Thu, Aug 9, 2012 at 9:37 PM, Edward Morbius dredmorbius@gmail.com wrote:

Thanks. Giving that a shot (a few twists on the recipe shown, so I'm
not using it directly).

And it seems to answer my first question: there's no way of handling
an apt archive sourced from a URL directly.

On Thu, Aug 9, 2012 at 5:52 PM, Alan Harper alan@aussiegeek.net wrote:

Have a look at the new relic cookbook at
GitHub - heavywater/chef-newrelic: "Installs/Configures newrelic"

On 10/08/2012, at 10:45 AM, Edward Morbius dredmorbius@gmail.com wrote:

I've been trying to wrap my head around chef and translating what
would be a trivial bash script into the chef equivalent.

The goal is to include NewRelic's host server (not application)
monitoring on an Ubuntu box.

The bash process:

Grab New Relic's apt sources.list fragment and tuck it away in

/etc/apt/sources.list.d
wget -O /etc/apt/sources.list.d/newrelic.list
http://download.newrelic.com/debian/newrelic.list

Get their signing key (value previously ascertained)

apt-key adv --keyserver hkp://subkeys.pgp.net --recv-keys 548C16BF

Run apt-get update and install package

apt-get update
apt-get install newrelic-sysmond

Set your license key (presumably stuffed in an encrypted data bag)

nrsysmond-config --set license_key=<% key_ID %>

Launch the daemon

/etc/init.d/newrelic-sysmond start

The easiest JGID method would be to write a ruby wrapper around the
bash. For parts of this I find chef methods.

There's an "apt" cookbook which can do some things, including adding a
sources.list line, but apparently not downloading a sources.list.d/
fragment from a known URL. Am I missing something?

The apt cookbook provides for getting the signing key:

apt_repository "newrelic-servermon" do
keyserver "keyserver.pgp.edu"
key "548C16BF"
end

Running the config step looks like another shell wrapper.

The service resource should be able to start the daemon:

service "newrelic-servermon" do
supports :status -> true, :restart => true, :reload => true
action [:enable, :start]
end

A nice "plus" feature would be an easy way to add, say, "monit"
monitoring and possibly Nagios configuration for any given service,
rather than managing these separately in a Nagios recipe.

TIA.

--
Dr. Ed Morbius
Chief Scientist / Philologist / Robot Wrangler / Powerplant Operator
Krell Power Systems Unlimited

--
Dr. Ed Morbius
Chief Scientist / Philologist / Robot Wrangler / Powerplant Operator
Krell Power Systems Unlimited

--
Dr. Ed Morbius
Chief Scientist / Philologist / Robot Wrangler / Powerplant Operator
Krell Power Systems Unlimited