Using Chef to Add New Relic Server Monitoring

So easy, even a bizdev guy can do it!

You’ll often hear Chef users rave about the consistency Chef brings to the configuration of their systems, or how it increases the speed and quality of deployments. That’s all fine and dandy, but as the alliances guy at Opscode, I sing my Chef praises to a slightly different tune: adoption. An organization that is using Chef can implement new services and technologies with ease.  When every system in your environment is defined by dynamic and re-usable cookbooks, adding something like server monitoring is as easy as dropping “recipe[newrelic]” to the end of your base runlist (more on this in a bit).

Here’s how it works for a lowly Chef beginner (me) in practice…

The starting point: My standard demo is to build and scale a multi-tier java web application running on EC2. It is eerily similar to what’s described in our Java Web Stack tutorial: set up your workstation, link it to your hosted chef and ec2 accounts, download a cookbook repo, run some knife commands…stare at your console…keep staring at your console…done. While I felt immense pride upon accomplishing this task for the first time, it didn’t even merit a hug from Adam Jacob.

Introducing change: Let’s say I’m starting to take this java web app pretty seriously and need to keep better tabs on the performance of the underlying infrastructure. Here are the three steps involved in adding a rock solid server monitoring service to my running demo:

1) Preview and download a New Relic cookbook and drop it into the chef repo. This well-maintained cookbook is from Escape Studios.

2) Add New Relic account info to the attributes file of the cookbook and upload it  to the hosted chef account…

3) Drop the newrelic recipe at the end of the base role’s run list and update roles (alternatively, this could be done in the webUI)

The next time the chef clients converge, they automagically install the correct New Relic server monitoring agent (in this case, for Ubuntu 10.04) and start sending data back to the new relic account.

It’s really that easy.

So…

  • If you’re a Chef user, take advantage of our community and partner cookbooks to further improve your operations!
  • If you are an ISV, consultant, or service provider, build and publish a cookbook so your technology and expertise can be made imminently available to the broader Chef community.
Bryan Hale

Former Chef Employee