Posting custom events to DataDog

Hello,

I’m looking for ways to post important/interesting events to DataDog’s event timeline from a chef run. For example, if one of my chef recipes does something disruptive (restart IIS for example) I’d like to be able to see that happening in my DataDog timeline as it occurs.

The only way I would know how to do this would be via a Powershell script or DSC resource. But, is there a better, more chef-like way to do something like this?

Thanks,

Sean

Chef has two mechanisms for doing this kind of thing. One is start/report/exception handlers, which run at the very beginning and end of a chef run. It looks like there's an official data dog plugin that does this here: GitHub - DataDog/chef-handler-datadog: Get Chef stats & events directly into Datadog

Since the original handler mechanism was added to Chef, we added pretty deep instrumentation, which powers the output formatters, and Chef's proprietary reporting/analytics/Automate insights stuff. With that, you can get more detailed data and it's more real time.

AFAICT from a quick googling, there isn't anything using the second mechanism, so you would need to write the ruby code for it yourself. If you want examples, you can look at these:

Others might be able to provide other examples; We recently added a DSL around the Event Dispatch stuff to make it a little easier to get started. Also, I believe this is covered in the Customizing Chef book.

Thanks @kallistec. I’m using the Data Dog plugin you reference that reports on the results of the run. I’ll review the code you posted and see if I could make use of something like this.

Thanks,

Sean