Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have several processes running on servers with different roles that are monitored by monit. For example, say I have an Apache server and a DB server with MySQL. I have several monitrc files that can be dropped in to monit's configuration directory to monitor these processes. What's the most elegant way in chef to make sure the appropriate files get into the monit configuration directory, based on the role?

Options I see:

  1. use a template resource in a monit cookbook that checks the node's roles to see if it should be executing
  2. use a template resource in the apache and mysql cookbooks (but check to see if monit is installed somehow)
  3. Create separate recipies in the monit cookbook for each role, and add them to the run list for the role (monit::mysql, monit::apache, etc.)

What I'd really like to do is put the code for ensuring the files are moved in the role's file, but I don't think that's possible. Ideas?

share|improve this question
up vote 1 down vote accepted

Option 2 would be correct. It could be a cookbook_file also. Every package knows best about what aspect of it should be monitored. The same applies for logrotation also.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.