bryan mclellan technical program manager, open … · configuring nagios with chef bryan mclellan...

50
Configuring Nagios with Chef Bryan McLellan Technical Program Manager, Open Source [email protected] / @btmspox Tuesday, September 25, 12

Upload: vuliem

Post on 28-Jul-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

Configuring Nagios with ChefBryan McLellanTechnical Program Manager, Open [email protected] / @btmspox

Tuesday, September 25, 12

Overview

• Who am I?

• Why automation

• Introduction to Chef

• Nagios Demo

• Questions

Tuesday, September 25, 12

Who am I?

• ChefEarly developer, user, pundit

• 10+ years in Systems AdministrationComputer repair, ISPs, Corporate IT,Web operations

• Event Logistics VolunteerTraffic Control, Parking, Communications, Networking, Emergency Management

• Hacker-OperatorTrucks, Bikes, Radios, Tractors

Tuesday, September 25, 12

How did we get here?

Bare Metal Deployment

Tuesday, September 25, 12

How did we get here?

Bare Metal Deployment

• Purchasing

Tuesday, September 25, 12

How did we get here?

Bare Metal Deployment

• Purchasing

• Vendor build

Tuesday, September 25, 12

How did we get here?

Bare Metal Deployment

• Purchasing

• Vendor build

• Delivery

Tuesday, September 25, 12

How did we get here?

Bare Metal Deployment

• Purchasing

• Vendor build

• Delivery

• Installation

Tuesday, September 25, 12

How did we get here?

Bare Metal Deployment

• Purchasing

• Vendor build

• Delivery

• Installation

• OS deployment

Tuesday, September 25, 12

How did we get here?

Bare Metal Deployment

• Purchasing

• Vendor build

• Delivery

• Installation

• OS deployment

• Application deployment

Tuesday, September 25, 12

How did we get here?

Bare Metal Deployment

• Purchasing

• Vendor build

• Delivery

• Installation

• OS deployment

• Application deployment

Weeks?

Tuesday, September 25, 12

How did we get here?

Cloud Deployment

• Purchasing

• Vendor build

• Delivery

• Installation

• OS deployment

• Application deployment

Nearly immediate

Tuesday, September 25, 12

How did we get here?

Cloud Deployment

• Purchasing

• Vendor build

• Delivery

• Installation

• OS deployment

• Application deployment

Nearly immediate

Must be fast

Tuesday, September 25, 12

Why automate?

Good Reasons:

• More agility and faster scalability

• Improved infrastructure documentation

• Better disaster recovery

Tuesday, September 25, 12

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

Chef Principles

Tuesday, September 25, 12

Chef Principles

• Idempotent

Tuesday, September 25, 12

Chef Principles

• Idempotent

• Reasonable

Tuesday, September 25, 12

Chef Principles

• Idempotent

• Reasonable

• Primitives

Tuesday, September 25, 12

Chef Principles

• Idempotent

• Reasonable

• Primitives

• Scalable

Tuesday, September 25, 12

Chef Principles

• Idempotent

• Reasonable

• Primitives

• Scalable

• Hackable

Tuesday, September 25, 12

Chef Principles

• Idempotent

• Reasonable

• Primitives

• Scalable

• Hackable

• Shareable

Tuesday, September 25, 12

What is Chef?

• Configuration management language

• Systems integration framework

• API for your infrastructure

http://www.flickr.com/photos/morville/3220961040/

Tuesday, September 25, 12

Application Programming Interface

Give me an API or give me death.

-- Andrew Clay Shafer (@littleidea)

The Meatcloud Manifesto

Tuesday, September 25, 12

Chef Basics

Chef manages Nodes

Tuesday, September 25, 12

Chef Basics

Chef manages Nodes

Nodes have Attributes

Tuesday, September 25, 12

Chef Basics

Chef manages Nodes

Nodes have Attributes

Users and Nodes authenticate as Clients

Tuesday, September 25, 12

Chef Basics

Chef manages Nodes

Nodes have Attributes

Users and Nodes authenticate as Clients

Cookbooks contain Recipes

Tuesday, September 25, 12

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

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

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

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

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

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

Chef Basics Visualized

node: srv03run_list: “role[db_server]”

role: web_serverrun_list: [“recipe[apache2]”, “recipe[php]” ]

role: db_serverrun_list: [ “recipe[mysql]”, “recipe[nfs]” ]

node: srv01run_list: “role[web_server]”

node: srv02run_list: “role[web_server]”

client: srv03client: srv01 client: srv02

Tuesday, September 25, 12

chef-shellknife

Chef Stacks

chef-client

Open Source Hosted Chef Private Chef

API

chef-solo

Tuesday, September 25, 12

Chef 10 Open Source Architecture

Chef Expander

Tuesday, September 25, 12

Resources

• A Resource is something you manageservice, package, file, user, execute, git

Tuesday, September 25, 12

Resources

• A Resource is something you manageservice, package, file, user, execute, git

• Resources have actionsstart, install, create, deploy

• Resources can notify of other resources

Tuesday, September 25, 12

Resources

• A Resource is something you manageservice, package, file, user, execute, git

• Resources have actionsstart, 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

Providers

• A Provider performs the actions specified by the resource

Tuesday, September 25, 12

Providers

• A Provider performs the actions specified by the resource

• Each Resource can have multiple providerspackage: apt, yum, macports...service: upstart, windows, systemd...

Tuesday, September 25, 12

Providers

• A Provider performs the actions specified by the resource

• Each Resource can have multiple providerspackage: 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 :installend

Tuesday, September 25, 12

A basic recipe

package “apache2” do action :installend

Tuesday, September 25, 12

A basic recipe

package “apache2” do action :installend

service “apache2” do action :enableend

Tuesday, September 25, 12

A basic recipe

package “apache2” do action :installend

service “apache2” do action :enableend

cookbook_file “/etc/apache2/apache2.conf” do source “apache2.conf” owner “root” group “root” mode 0644end

Tuesday, September 25, 12

A basic recipe

package “apache2” do action :installend

service “apache2” do action :enableend

cookbook_file “/etc/apache2/apache2.conf” do source “apache2.conf” owner “root” group “root” mode 0644end

service “apache2” do action :startend

Tuesday, September 25, 12

A basic recipe

package “apache2” do action :installend

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 :startend

Tuesday, September 25, 12

Nagios Demo• Download server cookbooks• Install server• Create fake nodes• Update server

Tuesday, September 25, 12

Questions?

There is lots more to learn about Chef at

http://wiki.opscode.com

Tuesday, September 25, 12