Bryan McLellan's presentation on using Nagios with chef.
The presentation was given during the Nagios World Conference North America held Sept 25-28th, 2012 in Saint Paul, MN. For more information on the conference (including photos and videos), visit: http://go.nagios.com/nwcna
Nagios Conference 2012 - Bryan McLellan - Using Nagios With Chef
1. Configuring Nagios with Chef
Bryan McLellan
Technical Program Manager, Open Source
btm@opscode.com / @btmspox
Tuesday, September 25, 12
2. Overview
• Who am I?
• Why automation
• Introduction to Chef
• Nagios Demo
• Questions
Tuesday, September 25, 12
3. Who am I?
• Chef
Early developer, user, pundit
• 10+ years in Systems Administration
Computer repair, ISPs, Corporate IT,
Web operations
• Event Logistics Volunteer
Traffic Control, Parking,
Communications, Networking,
Emergency Management
• Hacker-Operator
Trucks, Bikes, Radios, Tractors
Tuesday, September 25, 12
4. How did we get here?
Bare Metal Deployment
Tuesday, September 25, 12
5. How did we get here?
Bare Metal Deployment
• Purchasing
Tuesday, September 25, 12
6. How did we get here?
Bare Metal Deployment
• Purchasing
• Vendor build
Tuesday, September 25, 12
7. How did we get here?
Bare Metal Deployment
• Purchasing
• Vendor build
• Delivery
Tuesday, September 25, 12
8. How did we get here?
Bare Metal Deployment
• Purchasing
• Vendor build
• Delivery
• Installation
Tuesday, September 25, 12
9. How did we get here?
Bare Metal Deployment
• Purchasing
• Vendor build
• Delivery
• Installation
• OS deployment
Tuesday, September 25, 12
10. How did we get here?
Bare Metal Deployment
• Purchasing
• Vendor build
• Delivery
• Installation
• OS deployment
• Application deployment
Tuesday, September 25, 12
11. How did we get here?
Bare Metal Deployment
• Purchasing
• Vendor build
• Delivery Weeks?
• Installation
• OS deployment
• Application deployment
Tuesday, September 25, 12
12. How did we get here?
Cloud Deployment
• Purchasing
• Vendor build
• Delivery Nearly immediate
• Installation
• OS deployment
• Application deployment
Tuesday, September 25, 12
13. How did we get here?
Cloud Deployment
• Purchasing
• Vendor build
• Delivery Nearly immediate
• Installation
• OS deployment
• Application deployment
Must be fast
Tuesday, September 25, 12
14. Why automate?
Good Reasons:
• More agility and faster scalability
• Improved infrastructure documentation
• Better disaster recovery
Tuesday, September 25, 12
15. Why automate?
Good Reasons:
• More agility and faster scalability
• Improved infrastructure documentation
• Better disaster recovery
Really Good Reasons:
• Spend less time on monotonous tasks
• Spend more time solving interesting problems
Tuesday, September 25, 12
18. Chef Principles
• Idempotent
• Reasonable
Tuesday, September 25, 12
19. Chef Principles
• Idempotent
• Reasonable
• Primitives
Tuesday, September 25, 12
20. Chef Principles
• Idempotent
• Reasonable
• Primitives
• Scalable
Tuesday, September 25, 12
21. Chef Principles
• Idempotent
• Reasonable
• Primitives
• Scalable
• Hackable
Tuesday, September 25, 12
22. Chef Principles
• Idempotent
• Reasonable
• Primitives
• Scalable
• Hackable
• Shareable
Tuesday, September 25, 12
23. What is Chef?
• Configuration management language
• Systems integration framework
• API for your infrastructure
http://www.flickr.com/photos/morville/3220961040/
Tuesday, September 25, 12
24. Application Programming Interface
The Meatcloud Manifesto
Give me an API or give me death.
-- Andrew Clay Shafer (@littleidea)
Tuesday, September 25, 12
25. Chef Basics
Chef manages Nodes
Tuesday, September 25, 12
26. Chef Basics
Chef manages Nodes
Nodes have Attributes
Tuesday, September 25, 12
27. Chef Basics
Chef manages Nodes
Nodes have Attributes
Users and Nodes authenticate as Clients
Tuesday, September 25, 12
28. Chef Basics
Chef manages Nodes
Nodes have Attributes
Users and Nodes authenticate as Clients
Cookbooks contain Recipes
Tuesday, September 25, 12
29. Chef Basics
Chef manages Nodes
Nodes have Attributes
Users and Nodes authenticate as Clients
Cookbooks contain Recipes
Each node has a Run List
Tuesday, September 25, 12
30. Chef Basics
Chef manages Nodes
Nodes have Attributes
Users and Nodes authenticate as Clients
Cookbooks contain Recipes
Each node has a Run List
A Run List is a list of Recipes to run
Tuesday, September 25, 12
31. Chef Basics
Chef manages Nodes
Nodes have Attributes
Users and Nodes authenticate as Clients
Cookbooks contain Recipes
Each node has a Run List
A Run List is a list of Recipes to run
Recipes can be grouped in a Role
Tuesday, September 25, 12
32. Chef Basics
Chef manages Nodes
Nodes have Attributes
Users and Nodes authenticate as Clients
Cookbooks contain Recipes
Each node has a Run List
A Run List is a list of Recipes to run
Recipes can be grouped in a Role
Roles can also be added to a Run List
Tuesday, September 25, 12
33. Chef Basics
Chef manages Nodes
Nodes have Attributes
Users and Nodes authenticate as Clients
Cookbooks contain Recipes
Each node has a Run List
A Run List is a list of Recipes to run
Recipes can be grouped in a Role
Roles can also be added to a Run List
Nodes can be in Environments
Tuesday, September 25, 12
34. Chef Basics
Chef manages Nodes
Nodes have Attributes
Users and Nodes authenticate as Clients
Cookbooks contain Recipes
Each node has a Run List
A Run List is a list of Recipes to run
Recipes can be grouped in a Role
Roles can also be added to a Run List
Nodes can be in Environments
Data bags are... bags of data.
Tuesday, September 25, 12
36. Chef Stacks
chef-client knife chef-shell chef-solo
API
Open Source Hosted Chef Private Chef
Tuesday, September 25, 12
37. Chef 10 Open Source Architecture
Chef Expander
Tuesday, September 25, 12
38. Resources
• A Resource is something you manage
service, package, file, user, execute, git
Tuesday, September 25, 12
39. Resources
• A Resource is something you manage
service, package, file, user, execute, git
• Resources have actions
start, install, create, deploy
• Resources can notify of other resources
Tuesday, September 25, 12
40. Resources
• A Resource is something you manage
service, package, file, user, execute, git
• Resources have actions
start, install, create, deploy
• Resources can notify of other resources
cookbook_file “/etc/apache2/apache2.conf” do
source “apache2.conf”
owner “root”
group “root”
mode 0644
notifies :restart, “service[apache2]”
end
Tuesday, September 25, 12
41. Providers
• A Provider performs the actions specified by the resource
Tuesday, September 25, 12
42. Providers
• A Provider performs the actions specified by the resource
• Each Resource can have multiple providers
package: apt, yum, macports...
service: upstart, windows, systemd...
Tuesday, September 25, 12
43. Providers
• A Provider performs the actions specified by the resource
• Each Resource can have multiple providers
package: apt, yum, macports...
service: upstart, windows, systemd...
• Each platform (OS) has default Providers that can be overridden
package “sudo” do
provider Chef::Provider::Package::Yum
action :install
end
Tuesday, September 25, 12
44. A basic recipe
package “apache2” do
action :install
end
Tuesday, September 25, 12
45. A basic recipe
package “apache2” do
action :install
end
service “apache2” do
action :enable
end
Tuesday, September 25, 12
46. A basic recipe
package “apache2” do
action :install
end
service “apache2” do
action :enable
end
cookbook_file “/etc/apache2/apache2.conf” do
source “apache2.conf”
owner “root”
group “root”
mode 0644
end
Tuesday, September 25, 12
47. A basic recipe
package “apache2” do
action :install
end
service “apache2” do
action :enable
end
cookbook_file “/etc/apache2/apache2.conf” do
source “apache2.conf”
owner “root”
group “root”
mode 0644
end
service “apache2” do
action :start
end
Tuesday, September 25, 12
48. A basic recipe
package “apache2” do
action :install
end
service “apache2” do
action :enable
supports [ :restart, :reload, :status ]
end
cookbook_file “/etc/apache2/apache2.conf” do
source “apache2.conf”
owner “root”
group “root”
mode 0644
notifies :restart, “service[apache2]”
end
service “apache2” do
action :start
end
Tuesday, September 25, 12
49. Nagios Demo
• Download server cookbooks
• Install server
• Create fake nodes
• Update server
Tuesday, September 25, 12
50. Questions?
There is lots more to
learn about Chef at
http://wiki.opscode.com
Tuesday, September 25, 12