[chef] notify a resource when a service is *restarted* (only) ?


Chronological Thread 
  • From: Jeff Blaine < >
  • To:
  • Subject: [chef] notify a resource when a service is *restarted* (only) ?
  • Date: Wed, 15 Jul 2015 11:48:40 -0400

What options do we have for (in real-time, not in a report handler)
generically notifying a resource when (for one example) a service was
restarted?

I'm wanting this, and certainly don't want to embed the code in
~hundreds of init scripts' "restart" code.

my_send_metric 'thing' do
  action :nothing
  metric 'thing.restarted'
  value '1'
end

service 'whatever' do
  action :nothing
  notifies_ONLY_ON_RESTART :run, 'my_send_metric[thing]', :immediately
end

cookbook_file '/etc/whatever.conf' do
  notifies :restart, 'service[whatever]', :immediately
end

Possible at all currently?


  • [chef] notify a resource when a service is *restarted* (only) ?, Jeff Blaine, 07/15/2015

Archive powered by MHonArc 2.6.16.

§