0

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?

Aliaksandr Belik
  • 259
  • 6
  • 17
Josh Nankin
  • 722
  • 11
  • 27

1 Answers1

1

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.

Shyam Sundar C S
  • 1,063
  • 8
  • 12