Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Infrastructure as Code & Monitoring
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
portertech
September 16, 2015
Programming
6
1.8k
Infrastructure as Code & Monitoring
Automacon 2015 talk: Infrastructure as Code & monitoring, sharing the same development workflow.
portertech
September 16, 2015
Tweet
Share
More Decks by portertech
See All by portertech
Monitoring Event Pipelines
portertech
0
140
Scaling Sensu Go
portertech
0
390
Understanding Habitat & Kube - A Home Lab Experiment
portertech
0
120
Today's Challenges of Big Infra Monitoring
portertech
1
66
Monitoring with Sensu Go
portertech
2
450
7 Years Of Sensu
portertech
1
110
Chef and Sensu - Delightful Monitoring
portertech
0
110
What is Sensu?
portertech
1
160
Ignite - The Art Of Monitoring
portertech
0
250
Other Decks in Programming
See All in Programming
AI時代のキャリアプラン「技術の引力」からの脱出と「問い」へのいざない / tech-gravity
minodriven
10
2.6k
SourceGeneratorのススメ
htkym
0
180
MUSUBIXとは
nahisaho
0
120
LLM Observabilityによる 対話型音声AIアプリケーションの安定運用
gekko0114
2
410
Basic Architectures
denyspoltorak
0
650
Claude Codeの「Compacting Conversation」を体感50%減! CLAUDE.md + 8 Skills で挑むコンテキスト管理術
kmurahama
1
840
Implementation Patterns
denyspoltorak
0
270
humanlayerのブログから学ぶ、良いCLAUDE.mdの書き方
tsukamoto1783
0
170
Oxlintはいいぞ
yug1224
5
1.2k
高速開発のためのコード整理術
sutetotanuki
1
370
プロダクトオーナーから見たSOC2 _SOC2ゆるミートアップ#2
kekekenta
0
170
それ、本当に安全? ファイルアップロードで見落としがちなセキュリティリスクと対策
penpeen
7
2.4k
Featured
See All Featured
Testing 201, or: Great Expectations
jmmastey
46
8k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
420
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
310
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
1
93
A better future with KSS
kneath
240
18k
The SEO identity crisis: Don't let AI make you average
varn
0
62
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.7k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
630
Everyday Curiosity
cassininazir
0
120
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
210
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
580
Transcript
Infrastructure as Code & Monitoring Sharing the same development workflow.
Sean Porter @PorterTech
FOCUS • The Sensu origin story - where it came
from • What makes Sensu different • IaC development workflows • Testing & monitoring in an IaC workflow • Chef & Sensu in practice
None
THE SENSU ORIGIN STORY • I started at Sonian ~
2010 ◦ Chef 0.7 with AWS #YOLO infrastructure ◦ Several traditional monitoring tools: Nagios, Ganglia, Collectd, & Graphite
~ 50 alerts a day Mostly noise.
THE SENSU ORIGIN STORY Triggered @lusis to write: “Why Monitoring
Sucks”
Wanted MOAR!
Build it. Automatic (de)registration Config Management friendly Secure connectivity REST
API Elastic scalability UNIX
July 11th, 2011
What makes Sensu different? What makes it better for CM
driven environments?
None
JSON CONFIGURATION { "checks": { "mysql_replication": { "command": "check-mysql-replication.rb", "subscribers":
["mysql"], "interval": 30, "playbook": "http://wiki.example.com/mysql-replication-playbook" } } }
CHECK EXECUTION METHODS • Pub/Sub (central orchestration) ◦ e.g. execute
http check on all API nodes • Standalone ◦ Define checks while provisioning node(s) ◦ Scheduled by the local Sensu client
LOCAL CLIENT SOCKET echo '{ \ "name": "mysql_backup", \ "output":
"could not connect to mysql", \ "status": 2, \ "ttl": 90000 }' | nc localhost 3030
None
Let’s talk about IaC workflows “The sequence of processes through
which a piece of work passes from initiation to completion” - Google.
BASIC IaC WORKFLOW “It’s all software.”
BASIC IaC WORKFLOW
BASIC IaC WORKFLOW “It’s all software.”
BASIC IaC WORKFLOW Use tests. Still need to review tests
& code quality.
BASIC IaC WORKFLOW TEST ≈ MONITOR
BASIC IaC WORKFLOW Shorten the feedback loop.
Writing IaC tests “A procedure intended to establish the quality,
performance, or reliability of something, especially before it is taken into widespread use” - Google.
TESTING TOOLS • Serverspec ◦ RSpec tests for your servers
◦ serverspec.org • Bats ◦ Bash Automated Testing System ◦ Bash script with special syntax for defining test cases
SERVERSPEC require 'spec_helper' describe service('httpd'), :if => os[:family] == 'redhat'
do it { should be_enabled } it { should be_running } end describe port(80) do it { should be_listening } end
BATS #!/usr/bin/env bats @test "httpd should be running" { run
service httpd status [ "$status" -eq 0 ] } @test "httpd should be listening for connections" { [ "$(netstat -plant | grep httpd)" ] }
RUNNING TESTS • Test Kitchen ◦ kitchen.ci • Vagrant plugins
◦ github.com/jvoorhis/vagrant-serverspec • Serverspec SSH • … choose your own adventure!
RUNNING TESTS AS SENSU CHECKS • Use the Sensu Serverspec
check plugin ◦ gem install sensu-plugins-serverspec check-serverspec.rb \ -d /etc/sensu/serverspec -t '*_spec.rb' • Run Bats scripts
Chef & Sensu In practice.
SENSU CHEF COOKBOOK supermarket.chef.io/cookbooks/sensu • Recipes to install & manage
services • LWRPs for configuring handlers, checks, etc. • Intended to be used by wrapper cookbook ◦ e.g. recipe['monitor::haproxy']
EXAMPLE CHEF RESOURCES sensu_handler 'default' do # recipe['monitor::_handlers'] type 'pipe'
command 'pagerduty.rb' end sensu_check 'redis_process' do # recipe['monitor::redis'] command 'check-procs.rb -p redis-server -w 2 -c 3 -C 1' standalone true interval 30 end
USING DATA BAGS # recipe['monitor::pubsub'] data_bag('sensu_checks').each do |data_bag_item| check =
data_bag_item('sensu_checks', data_bag_item) sensu_check check['id'] do check.each do |key, value| send(key.to_sym, value) if respond_to?(key.to_sym) end end end
SENSU SERVERSPEC CHECKS # recipe['monitor::serverspec'] sensu_gem 'sensu-plugins-serverspec' sensu_check 'serverspec' do
command 'check-serverspec.rb -d /etc/sensu/serverspec -t \*_spec.rb ' standalone true interval 30 end # e.g. CheckServerspec CRITICAL: 12 examples, 2 failures
BASIC IaC WORKFLOW TEST ≈ MONITOR
Questions? Sean Porter (@PorterTech) sensuapp.org