Setting up SNMP for external monitoring services
Simple Network Management Protocol (SNMP) is the standard way to monitor all your network devices. You can use Chef to install the SNMP service on your node and configure it to match your needs.
Getting ready
Make sure that you have a cookbook named my_cookbook
and that the run_list
of your node includes my_cookbook
, as described in the Creating and using cookbooks, section in Chapter 1, Chef Infrastructure.
Create your Berksfile
in your Chef repository including my_cookbook
:
mma@laptop:~/chef-repo $ subl Berksfile
cookbook 'my_cookbook', path: './cookbooks/my_cookbook'
How to do it...
Let's change some attributes and install SNMP on our node:
Add the dependency on the
snmp
cookbook to your cookbook'smetadata.rb
:mma@laptop:~/chef-repo $ subl cookbooks/my_cookbook/metadata.rb
depends "snmp"
Install the dependent cookbooks:
mma@laptop:~/chef-repo $ berks install
...TRUNCATED OUTPUT... Installing snmp (3.0.1) Using my_cookbook (0.1.0) at './cookbooks...