This shows how to create a metrics file for the textfile collector at the end of a chef-client run, and collect some metrics. The approach is to register a report handler with Chef, which gets executed after everything else.
Consider this a rough sketch – details of how Node Exporter is installed are elided, and we cannot provide any support for this. May it guide you on your way.
This uses the chef_handler
cookbook. It is tested with version 1.1.7 of this cookbook. The handler goes into files/default/
, the recipe into recipes/
. Adapt the recipe to how and where you install Node Exporter.