Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

Your Answer

 
discard

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.