Using Nagios with Chef

5,090
-1

Published on

Nagios World Conference 2012 presentation introduces Chef and demo'd the Nagios cookbook.

Published in: Technology, Self Improvement
1 Comment
8 Likes
Statistics
Notes
No Downloads
Views
Total Views
5,090
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
95
Comments
1
Likes
8
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • Systems\n
  • 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
  • \n
  • \n
  • Hackable\nshef -> chef-shell\n
  • Service Oriented Architecture\n
  • Primitives\n
  • Primitives\n
  • Idempotent\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Using Nagios with Chef

    1. 1. Configuring Nagios with ChefBryan McLellanTechnical Program Manager, Open Sourcebtm@opscode.com / @btmspox
    2. 2. Overview• Who am I?• Why automation• Introduction to Chef• Nagios Demo• Questions
    3. 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
    4. 4. How did we get here?Bare Metal Deployment
    5. 5. How did we get here?Bare Metal Deployment • Purchasing
    6. 6. How did we get here?Bare Metal Deployment • Purchasing • Vendor build
    7. 7. How did we get here?Bare Metal Deployment • Purchasing • Vendor build • Delivery
    8. 8. How did we get here?Bare Metal Deployment • Purchasing • Vendor build • Delivery • Installation
    9. 9. How did we get here?Bare Metal Deployment • Purchasing • Vendor build • Delivery • Installation • OS deployment
    10. 10. How did we get here?Bare Metal Deployment • Purchasing • Vendor build • Delivery • Installation • OS deployment • Application deployment
    11. 11. How did we get here?Bare Metal Deployment • Purchasing • Vendor build • Delivery Weeks? • Installation • OS deployment • Application deployment
    12. 12. How did we get here?Cloud or Virtual Deployment • Purchasing • Vendor build • Delivery Nearly immediate • Installation • OS deployment • Application deployment
    13. 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. 14. Why automate? Good Reasons:• More agility and faster scalability• Improved infrastructure documentation• Better disaster recovery
    15. 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
    16. 16. Why automate?Operations is responsible for two things:
    17. 17. Why automate?Operations is responsible for two things:1. Availability
    18. 18. Why automate?Operations is responsible for two things:1. Availability2. Efficiency
    19. 19. What is Chef?• Configuration management language• Systems integration framework• API for your infrastructure http://www.flickr.com/photos/morville/3220961040/
    20. 20. Chef Principles
    21. 21. Chef Principles• Idempotent
    22. 22. Chef Principles• Idempotent• Reasonable
    23. 23. Chef Principles• Idempotent• Reasonable• Primitives
    24. 24. Chef Principles• Idempotent• Reasonable• Primitives• Scalable
    25. 25. Chef Principles• Idempotent• Reasonable• Primitives• Scalable• Hackable
    26. 26. Chef Principles• Idempotent• Reasonable• Primitives• Scalable• Hackable• Shareable
    27. 27. Chef BasicsChef manages Nodes
    28. 28. Chef BasicsChef manages NodesNodes have Attributes
    29. 29. Chef BasicsChef manages NodesNodes have AttributesUsers and Nodes authenticate as Clients
    30. 30. Chef BasicsChef manages NodesNodes have AttributesUsers and Nodes authenticate as ClientsCookbooks contain Recipes
    31. 31. Chef BasicsChef manages NodesNodes have AttributesUsers and Nodes authenticate as ClientsCookbooks contain RecipesEach node has a Run List
    32. 32. Chef BasicsChef manages NodesNodes have AttributesUsers and Nodes authenticate as ClientsCookbooks contain RecipesEach node has a Run ListA Run List is a list of Recipes to run
    33. 33. Chef BasicsChef manages NodesNodes have AttributesUsers and Nodes authenticate as ClientsCookbooks contain RecipesEach node has a Run ListA Run List is a list of Recipes to runA Role also has a Run List
    34. 34. Chef BasicsChef manages NodesNodes have AttributesUsers and Nodes authenticate as ClientsCookbooks contain RecipesEach node has a Run ListA Run List is a list of Recipes to runA Role also has a Run ListRoles can also be added to a Node’s Run List
    35. 35. Chef BasicsChef manages NodesNodes have AttributesUsers and Nodes authenticate as ClientsCookbooks contain RecipesEach node has a Run ListA Run List is a list of Recipes to runA Role also has a Run ListRoles can also be added to a Node’s Run ListNodes can be in Environments
    36. 36. Chef BasicsChef manages NodesNodes have AttributesUsers and Nodes authenticate as ClientsCookbooks contain RecipesEach node has a Run ListA Run List is a list of Recipes to runA Role also has a Run ListRoles can also be added to a Node’s Run ListNodes can be in EnvironmentsData bags are... bags of data.
    37. 37. Chef Basics Visualized client: srv01 client: srv02 client: srv03 node: srv01 node: srv02 node: srv03 run_list: “role[web_server]” run_list: “role[web_server]” run_list: “role[db_server]” role: web_server role: db_serverrun_list: [“recipe[apache2]”, “recipe[php]” ] run_list: [ “recipe[mysql]”, “recipe[nfs]” ]
    38. 38. Application Programming Interface The Meatcloud ManifestoGive me an API or give me death. -- Andrew Clay Shafer (@littleidea)
    39. 39. Chef Stackschef-client knife chef-shell chef-solo API Open Source Hosted Chef Private Chef
    40. 40. Chef 10 Open Source Architecture Chef Expander
    41. 41. Resources• A Resource is something you manage service, package, file, user, execute, git
    42. 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. 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. 44. Providers• A Provider performs the actions specified by the resource
    45. 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. 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
    47. 47. A basic recipepackage “apache2” do action :installend
    48. 48. A basic recipepackage “apache2” do action :installendservice “apache2” do action :enableend
    49. 49. A basic recipepackage “apache2” do action :installendservice “apache2” do action :enableendcookbook_file “/etc/apache2/apache2.conf” do source “apache2.conf” owner “root” group “root” mode 0644end
    50. 50. A basic recipepackage “apache2” do action :installendservice “apache2” do action :enableendcookbook_file “/etc/apache2/apache2.conf” do source “apache2.conf” owner “root” group “root” mode 0644endservice “apache2” do action :startend
    51. 51. A basic recipepackage “apache2” do action :installendservice “apache2” do action :enable supports [ :restart, :reload, :status ]endcookbook_file “/etc/apache2/apache2.conf” do source “apache2.conf” owner “root” group “root” mode 0644 notifies :restart, “service[apache2]”endservice “apache2” do action :startend
    52. 52. SearchSearch 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 environmentsearch (:node, “role:mail_server AND chef_environment:corp”)Search and Ruby are powerful allies# Find all my nodes that run on HP hardwarenodes = search(:node, “dmi_systems_manufacturer:HP”)# Dynamically create a config in a template<% nodes.each do |node| -%>server <%= node[‘hostname’] %><% end -%>
    53. 53. Nagios Demo•Download nagios server cookbooks•Install nagios server•Create fake nodes
    54. 54. knife cookbook site install nagiosknife cookbook upload -acd chef-repoknife role from file monitoring.jsonknife data bag create usersknife data bag from file users btm.jsonknife node run list add chef-demo-server role[monitoring]sudo chef-clienthttp://chef-demo-server/nagios3/for n in {1..5} ; do knife node from file fake${n}.json ; donesudo chef-clientknife data bag create nagios_hostgroupsknife data bag from file nagios_hostgroups hp_systems.jsonsudo chef-client
    55. 55. Questions?There is lots more to learn about Chef at http://
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×