Top 10 Most Downloaded Games on Play Store in 2024
Using Nagios with Chef
1. Configuring Nagios with Chef
Bryan McLellan
Technical Program Manager, Open Source
btm@opscode.com / @btmspox
2. Overview
• Who am I?
• Why automation
• Introduction to Chef
• Nagios Demo
• Questions
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
5. How did we get here?
Bare Metal Deployment
• Purchasing
6. How did we get here?
Bare Metal Deployment
• Purchasing
• Vendor build
7. How did we get here?
Bare Metal Deployment
• Purchasing
• Vendor build
• Delivery
8. How did we get here?
Bare Metal Deployment
• Purchasing
• Vendor build
• Delivery
• Installation
9. How did we get here?
Bare Metal Deployment
• Purchasing
• Vendor build
• Delivery
• Installation
• OS deployment
10. How did we get here?
Bare Metal Deployment
• Purchasing
• Vendor build
• Delivery
• Installation
• OS deployment
• Application deployment
11. How did we get here?
Bare Metal Deployment
• Purchasing
• Vendor build
• Delivery Weeks?
• Installation
• OS deployment
• Application deployment
12. How did we get here?
Cloud or Virtual Deployment
• Purchasing
• Vendor build
• Delivery Nearly immediate
• Installation
• OS deployment
• Application deployment
13. How did we get here?
Cloud or Virtual Deployment
• Purchasing
• Vendor build
• Delivery Nearly immediate
• Installation
• OS deployment
• Application deployment
Must be fast
14. Why automate?
Good Reasons:
• More agility and faster scalability
• Improved infrastructure documentation
• Better disaster recovery
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
19. What is Chef?
• Configuration management language
• Systems integration framework
• API for your infrastructure
http://www.flickr.com/photos/morville/3220961040/
30. Chef Basics
Chef manages Nodes
Nodes have Attributes
Users and Nodes authenticate as Clients
Cookbooks contain Recipes
31. Chef Basics
Chef manages Nodes
Nodes have Attributes
Users and Nodes authenticate as Clients
Cookbooks contain Recipes
Each node has a Run List
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
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
A Role also has a Run List
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
A Role also has a Run List
Roles can also be added to a Node’s Run List
35. 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
A Role also has a Run List
Roles can also be added to a Node’s Run List
Nodes can be in Environments
36. 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
A Role also has a Run List
Roles can also be added to a Node’s Run List
Nodes can be in Environments
Data bags are... bags of data.
41. Resources
• A Resource is something you manage
service, package, file, user, execute, git
42. 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
43. 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
44. Providers
• A Provider performs the actions specified by the resource
45. Providers
• A Provider performs the actions specified by the resource
• Each Resource can have multiple providers
package: apt, yum, macports...
service: upstart, windows, systemd...
46. 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
package “sudo” do
provider Chef::Provider::Package::Yum
action :install
end
48. A basic recipe
package “apache2” do
action :install
end
service “apache2” do
action :enable
end
49. 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
50. 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
51. 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
52. Search
Search is a first class citizen
# Find all nodes in production that are tagged ‘group_d’
search(:node, “tags:group_d AND chef_environment:prod”)
# Find the mail server in this environment
search (:node, “role:mail_server AND chef_environment:corp”)
Search and Ruby are powerful allies
# Find all my nodes that run on HP hardware
nodes = search(:node, “dmi_systems_manufacturer:HP”)
# Dynamically create a config in a template
<% nodes.each do |node| -%>
server <%= node[‘hostname’] %>
<% end -%>
54. knife cookbook site install nagios
knife cookbook upload -a
cd chef-repo
knife role from file monitoring.json
knife data bag create users
knife data bag from file users btm.json
knife node run list add chef-demo-server role[monitoring]
sudo chef-client
http://chef-demo-server/nagios3/
for n in {1..5} ; do knife node from file fake${n}.json ; done
sudo chef-client
knife data bag create nagios_hostgroups
knife data bag from file nagios_hostgroups hp_systems.json
sudo chef-client
Who considers there job to be operations or running servers?\n
1 week each?\nDifferent departments schedules\n
1 week each?\nDifferent departments schedules\n
1 week each?\nDifferent departments schedules\n
1 week each?\nDifferent departments schedules\n
1 week each?\nDifferent departments schedules\n
1 week each?\nDifferent departments schedules\n
1 week each?\nDifferent departments schedules\n
Now application deployment needs to be fast\n
Now application deployment needs to be fast\n
DR: Bare metal, application data backup, chef repository\n\n
DR: Bare metal, application data backup, chef repository\n\n
Who works in operations?\n
\n
\n
Who here uses Chef?\nIntrastructure as Code\n\n
idempotency: If it is right, do nothing. If it is wrong, fix it.\nreasonable: no surprises to the platform user\nprimitives: the unix way\nscalable: hosted chef\n
idempotency: If it is right, do nothing. If it is wrong, fix it.\nreasonable: no surprises to the platform user\nprimitives: the unix way\nscalable: hosted chef\n
idempotency: If it is right, do nothing. If it is wrong, fix it.\nreasonable: no surprises to the platform user\nprimitives: the unix way\nscalable: hosted chef\n
idempotency: If it is right, do nothing. If it is wrong, fix it.\nreasonable: no surprises to the platform user\nprimitives: the unix way\nscalable: hosted chef\n
idempotency: If it is right, do nothing. If it is wrong, fix it.\nreasonable: no surprises to the platform user\nprimitives: the unix way\nscalable: hosted chef\n
idempotency: If it is right, do nothing. If it is wrong, fix it.\nreasonable: no surprises to the platform user\nprimitives: the unix way\nscalable: hosted chef\n
idempotency: If it is right, do nothing. If it is wrong, fix it.\nreasonable: no surprises to the platform user\nprimitives: the unix way\nscalable: hosted chef\n
Nodes are data objects - servers, network switches, Google Compute Engine\n\n
Nodes are data objects - servers, network switches, Google Compute Engine\nplatform, platform_version\n
Clients are authentication objects\npublic key / private key\n
Cookbooks are something you would manage\n
Nodes are data objects\nClients are authentication objects\nCookbooks are something you would manage\n
Nodes are data objects\nClients are authentication objects\nCookbooks are something you would manage\n
Nodes are data objects\nClients are authentication objects\nCookbooks are something you would manage\n
Nodes are data objects\nClients are authentication objects\nCookbooks are something you would manage\n
Workflow: Environments control cookbook versions\n
Nodes are data objects\nClients are authentication objects\nCookbooks are something you would manage\n