Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Sensu Casual Talks
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
kenjiskywalker
September 17, 2014
Technology
1.4k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Sensu Casual Talks
kenjiskywalker
September 17, 2014
More Decks by kenjiskywalker
See All by kenjiskywalker
VP of Engineering Meetup by CA #3
kenjiskywalker
2
3.1k
Management 3.0 meetup 2018/0228
kenjiskywalker
0
160
EdTech Engineer Meetup
kenjiskywalker
0
8.3k
スキルシートをなぜやるか・こんごについて
kenjiskywalker
0
210
why-1on1
kenjiskywalker
1
340
yapcasia2015
kenjiskywalker
20
18k
yapcasia2014
kenjiskywalker
0
7.4k
ZABBIXの運用において、 自分で自分の労働力と時間を節約する為の工夫事例紹介 #zabbix_jp
kenjiskywalker
3
2.2k
large td-agent.conf with Chef
kenjiskywalker
2
4.4k
Other Decks in Technology
See All in Technology
人間はどの意思決定を手放せるのか
kawasima
15
7.3k
AIエージェントの一手は 誰も見ていない - Falco拡張OSS「Prempti」とeBPFで サーバーレス実行基盤を二層防御する
keitah
0
210
.NET WebAssemblyで実現するクライアントサイドAI推論:NuGetからViteまで、2つのエコシステムを繋ぐビルド戦略
yamachu
0
170
AIは推し活である。
kurazuuuuuu
1
440
2026_devsumi_ozono.pdf
o3
3
520
バイブコーディング時代のWebアプリ開発入門~Cloud Runで学ぶセキュアなビルドとデプロイ
waiwai2111
1
140
あけおめLINE 傾向とその対策
nasa9084
0
140
顧客に向き合う開発組織へ。リアーキテクチャとフィーチャーチーム化で挑む組織改革
safie
0
2.1k
Genieを崇めよ
kameitomohiro
0
160
Slack上でインフラをトラブルシュートする! Agentic Platform Engineeringの第一歩
teru0x1
5
1.8k
Claude in Chrome 入門 / Introduction to Claude in Chrome
cielo1985
0
860
なぜ「決定性」が 決定的に重要なのか? Durable Execution 基盤の数理的理解 #serverlessjp / ServerlessDays Tokyo 2026
ytaka23
3
650
Featured
See All Featured
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
420
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
600
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
420
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6.1k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
63
46k
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
The Language of Interfaces
destraynor
162
27k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Building AI with AI
inesmontani
PRO
1
1.2k
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
840
My Coaching Mixtape
mlcsv
0
320
Transcript
ߏஙͱઃఆཧ͕ࡶʹͳΓ͕ ͪͳSensuͷཧΛChefͰ! (ͳΔ͘)γϯϓϧʹߦ͏ํ๏ kenjiskywalker Sensu Casual Talks #1! 14/09/17
RabbitMQRedisͱ͔! ৭ʑΠϯετʔϧ͠ͳ͍ͱ͍͚ͳ͍...! ! configϑΝΠϧͱ͔ͨ͘͞Μ͋ͬͯ! Ͳ͏ͬͯཧͨ͠Β͍͍ͷ͔Θ͔Βͳ͍... ՝!
Official Chef cookbookΛ͑! (؆୯ʹ)ΠϯετʔϧͰ͖Δ! ղܾ!
ݸผʹChef cookbookΛͭ͘Ε! ؆୯ʹઃఆϑΝΠϧ࣮ߦϑΝΠϧΛ! ཧ͢Δ͜ͱ͕Ͱ͖Δ! ղܾ!
! Official Chef cookbookͱ! ࣗՈcookbookΛར༻ͯ͠! Πϯετʔϧͱӡ༻Λ! ͳΔָ͘ʹ͢Δํ๏Λ͓͠·͢ ࠓճ!
Πϯετʔϧฤ
supermarket ! ͱ͍͏ΤίγεςϜ͕͋Δ!
librarian-chef ͳͲΛར༻ͨ͠ΤίγεςϜ! ґଘؔͷ͋ΔcookbookΛ! supermarket͔Βμϯϩʔυͯ͘͠ΕΔ! $ knife cookbook site vendor sensu
-o cookbooks/
ίϚϯυϥΠϯ! Ұൃୟ͚ྃͩʂ ! $ sudo chef-solo -c knife.rb -j roles/sensu_server.json
[vagrant@vagrant-centos64 chef]$! [vagrant@vagrant-centos64 chef]$ sudo chef-solo -c knife.rb -j roles/sensu_server.json!
! Starting Chef Client, version 11.16.0! [2014-09-12T05:15:44+00:00] WARN: found a directory sensu-chef in the cookbook path, but it contains no cookbook files. skipping.! Compiling Cookbooks...! ! ================================================================================! Recipe Compile Error in /home/vagrant/chef/cookbooks/sensu/recipes/default.rb! ================================================================================! ! Chef::Exceptions::InvalidDataBagPath! ------------------------------------! Data bag path '/home/vagrant/chef/data_bags' is invalid! ! Cookbook Trace:! ---------------! /home/vagrant/chef/cookbooks/sensu/libraries/sensu_helpers.rb:36:in `data_bag_item'! /home/vagrant/chef/cookbooks/sensu/recipes/default.rb:65:in `from_file'! ! Relevant File Content:! ----------------------! /home/vagrant/chef/cookbooks/sensu/libraries/sensu_helpers.rb:! ! 29: "/opt/sensu/embedded/bin/gem"! 30: else! 31: "gem"! 32: end! 33: end! 34:! 35: def data_bag_item(item, missing_ok=false)! 36>> raw_hash = Chef::DataBagItem.load("sensu", item)! 37: encrypted = raw_hash.detect do |key, value|! 38: if value.is_a?(Hash)! 39: value.has_key?("encrypted_data")! 40: end! 41: end! 42: if encrypted! 43: secret = Chef::EncryptedDataBagItem.load_secret! 44: Chef::EncryptedDataBagItem.new(raw_hash, secret)! 45: else! ! ! Running handlers:! [2014-09-12T05:15:44+00:00] ERROR: Running exception handlers! Running handlers complete! [2014-09-12T05:15:44+00:00] ERROR: Exception handlers complete! [2014-09-12T05:15:44+00:00] FATAL: Stacktrace dumped to /tmp/chef-solo/chef-stacktrace.out! Chef Client failed. 0 resources updated in 3.580390451 seconds! [2014-09-12T05:15:44+00:00] ERROR: Data bag path '/home/vagrant/chef/data_bags' is invalid! [2014-09-12T05:15:44+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)! [vagrant@vagrant-centos64 chef]$ Θ͚͕ͳ͍
sensu v0.13.0! sensu-chef v2.0.0
[vagrant@vagrant-centos64 chef]$! [vagrant@vagrant-centos64 chef]$ sudo chef-solo -c knife.rb -j roles/sensu_server.json!
! Starting Chef Client, version 11.16.0! [2014-09-12T05:15:44+00:00] WARN: found a directory sensu-chef in the cookbook path, but it contains no cookbook files. skipping.! Compiling Cookbooks...! ! ================================================================================! Recipe Compile Error in /home/vagrant/chef/cookbooks/sensu/recipes/default.rb! ================================================================================! ! Chef::Exceptions::InvalidDataBagPath! ------------------------------------! Data bag path '/home/vagrant/chef/data_bags' is invalid! ! Cookbook Trace:! ---------------! /home/vagrant/chef/cookbooks/sensu/libraries/sensu_helpers.rb:36:in `data_bag_item'! /home/vagrant/chef/cookbooks/sensu/recipes/default.rb:65:in `from_file'! ! Relevant File Content:! ----------------------! /home/vagrant/chef/cookbooks/sensu/libraries/sensu_helpers.rb:! ! 29: "/opt/sensu/embedded/bin/gem"! 30: else! 31: "gem"! 32: end! 33: end! 34:! 35: def data_bag_item(item, missing_ok=false)! 36>> raw_hash = Chef::DataBagItem.load("sensu", item)! 37: encrypted = raw_hash.detect do |key, value|! 38: if value.is_a?(Hash)! 39: value.has_key?("encrypted_data")! 40: end! 41: end! 42: if encrypted! 43: secret = Chef::EncryptedDataBagItem.load_secret! 44: Chef::EncryptedDataBagItem.new(raw_hash, secret)! 45: else! ! ! Running handlers:! [2014-09-12T05:15:44+00:00] ERROR: Running exception handlers! Running handlers complete! [2014-09-12T05:15:44+00:00] ERROR: Exception handlers complete! [2014-09-12T05:15:44+00:00] FATAL: Stacktrace dumped to /tmp/chef-solo/chef-stacktrace.out! Chef Client failed. 0 resources updated in 3.580390451 seconds! [2014-09-12T05:15:44+00:00] ERROR: Data bag path '/home/vagrant/chef/data_bags' is invalid! [2014-09-12T05:15:44+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)! [vagrant@vagrant-centos64 chef]$ Chef::DataBagItem.load("sensu", item)! ! !
[vagrant@vagrant-centos64 chef]$! [vagrant@vagrant-centos64 chef]$ sudo chef-solo -c knife.rb -j roles/sensu_server.json!
! Starting Chef Client, version 11.16.0! [2014-09-12T05:15:44+00:00] WARN: found a directory sensu-chef in the cookbook path, but it contains no cookbook files. skipping.! Compiling Cookbooks...! ! ================================================================================! Recipe Compile Error in /home/vagrant/chef/cookbooks/sensu/recipes/default.rb! ================================================================================! ! Chef::Exceptions::InvalidDataBagPath! ------------------------------------! Data bag path '/home/vagrant/chef/data_bags' is invalid! ! Cookbook Trace:! ---------------! /home/vagrant/chef/cookbooks/sensu/libraries/sensu_helpers.rb:36:in `data_bag_item'! /home/vagrant/chef/cookbooks/sensu/recipes/default.rb:65:in `from_file'! ! Relevant File Content:! ----------------------! /home/vagrant/chef/cookbooks/sensu/libraries/sensu_helpers.rb:! ! 29: "/opt/sensu/embedded/bin/gem"! 30: else! 31: "gem"! 32: end! 33: end! 34:! 35: def data_bag_item(item, missing_ok=false)! 36>> raw_hash = Chef::DataBagItem.load("sensu", item)! 37: encrypted = raw_hash.detect do |key, value|! 38: if value.is_a?(Hash)! 39: value.has_key?("encrypted_data")! 40: end! 41: end! 42: if encrypted! 43: secret = Chef::EncryptedDataBagItem.load_secret! 44: Chef::EncryptedDataBagItem.new(raw_hash, secret)! 45: else! ! ! Running handlers:! [2014-09-12T05:15:44+00:00] ERROR: Running exception handlers! Running handlers complete! [2014-09-12T05:15:44+00:00] ERROR: Exception handlers complete! [2014-09-12T05:15:44+00:00] FATAL: Stacktrace dumped to /tmp/chef-solo/chef-stacktrace.out! Chef Client failed. 0 resources updated in 3.580390451 seconds! [2014-09-12T05:15:44+00:00] ERROR: Data bag path '/home/vagrant/chef/data_bags' is invalid! [2014-09-12T05:15:44+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)! [vagrant@vagrant-centos64 chef]$ Chef::DataBagItem.load("sensu", item)! ! Data Bagsͷઃఆ͕Γͳ͍!
Officialͷcookookͷதʹ͋Δ! Data Bags༻ͷSSL࡞πʔϧΛར༻͍ͨ͠
None
ignore...
ssl.jsonੜ܅Λͬͯ͘Δ! (GitHub্ͷϑΝΠϧrm͞Ε͍ͯͳ͍) $ git clone
[email protected]
:sensu/sensu-chef.git! $ cd sensu-chef/examples/ssl/! $
./ssl_certs.sh generate! $ cd -! $ mkdir ./data_bags/sensu! $ cp sensu-chef/examples/ssl/ssl.json data_bags/sensu/!
͜ΕͰ͏ͣͩ͘͝
$ sudo chef-solo -c solo.rb -j roles/sensu_server.json! Starting Chef Client,
version 11.16.0! [2014-09-12T02:40:05+00:00] WARN: found a directory sensu-chef in the cookbook path, but it contains no cookbook files. skipping.! Compiling Cookbooks...! ! ================================================================================! Recipe Compile Error in /home/vagrant/chef/cookbooks/sensu/recipes/redis.rb! ================================================================================! ! Chef::Exceptions::ResourceNotFound! ----------------------------------! Cannot find a resource matching service[redis6379] (did you define it first?)! ! Cookbook Trace:! ---------------! /home/vagrant/chef/cookbooks/redisio/recipes/enable.rb:25:in `block in from_file'! /home/vagrant/chef/cookbooks/redisio/recipes/enable.rb:23:in `each'! /home/vagrant/chef/cookbooks/redisio/recipes/enable.rb:23:in `from_file'! /home/vagrant/chef/cookbooks/sensu/recipes/redis.rb:23:in `from_file'! ! Relevant File Content:! ----------------------! /home/vagrant/chef/cookbooks/redisio/recipes/enable.rb:! ! 18: # limitations under the License.! 19: #! 20:! 21: redis = node['redisio']! 22:! 23: redis['servers'].each do |current_server|! 24: server_name = current_server["name"] || current_server["port"]! 25>> resource = resources("service[redis#{server_name}]")! 26: resource.action Array(resource.action)! 27: resource.action << :start! 28: resource.action << :enable! 29: end! 30:! ! ! Running handlers:! [2014-09-12T02:40:05+00:00] ERROR: Running exception handlers! Running handlers complete! [2014-09-12T02:40:05+00:00] ERROR: Exception handlers complete! [2014-09-12T02:40:05+00:00] FATAL: Stacktrace dumped to /tmp/chef-solo/chef-stacktrace.out! Chef Client failed. 0 resources updated in 8.415939823 seconds! [2014-09-12T02:40:05+00:00] ERROR: Cannot find a resource matching service[redis6379] (did you define it first?)! [2014-09-12T02:40:05+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)! $
$ sudo chef-solo -c solo.rb -j roles/sensu_server.json! Starting Chef Client,
version 11.16.0! [2014-09-12T02:40:05+00:00] WARN: found a directory sensu-chef in the cookbook path, but it contains no cookbook files. skipping.! Compiling Cookbooks...! ! ================================================================================! Recipe Compile Error in /home/vagrant/chef/cookbooks/sensu/recipes/redis.rb! ================================================================================! ! Chef::Exceptions::ResourceNotFound! ----------------------------------! Cannot find a resource matching service[redis6379] (did you define it first?)! ! Cookbook Trace:! ---------------! /home/vagrant/chef/cookbooks/redisio/recipes/enable.rb:25:in `block in from_file'! /home/vagrant/chef/cookbooks/redisio/recipes/enable.rb:23:in `each'! /home/vagrant/chef/cookbooks/redisio/recipes/enable.rb:23:in `from_file'! /home/vagrant/chef/cookbooks/sensu/recipes/redis.rb:23:in `from_file'! ! Relevant File Content:! ----------------------! /home/vagrant/chef/cookbooks/redisio/recipes/enable.rb:! ! 18: # limitations under the License.! 19: #! 20:! 21: redis = node['redisio']! 22:! 23: redis['servers'].each do |current_server|! 24: server_name = current_server["name"] || current_server["port"]! 25>> resource = resources("service[redis#{server_name}]")! 26: resource.action Array(resource.action)! 27: resource.action << :start! 28: resource.action << :enable! 29: end! 30:! ! ! Running handlers:! [2014-09-12T02:40:05+00:00] ERROR: Running exception handlers! Running handlers complete! [2014-09-12T02:40:05+00:00] ERROR: Exception handlers complete! [2014-09-12T02:40:05+00:00] FATAL: Stacktrace dumped to /tmp/chef-solo/chef-stacktrace.out! Chef Client failed. 0 resources updated in 8.415939823 seconds! [2014-09-12T02:40:05+00:00] ERROR: Cannot find a resource matching service[redis6379] (did you define it first?)! [2014-09-12T02:40:05+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)! $ ͳΜ͔ΤϥʔͰͯΔͧ! ! resource = resources("service[redis#{server_name}]")
#276, #278
ࠓ·Ͱσόοά! ͜Ε͔Βຊ
Πϯετʔϧʹ͍ͭͯ
ࠓճར༻͢ΔJSONϑΝΠϧ! ! - base.json! - sensu_server.json! - sensu_client.json
൚༻తͳ! JSONϑΝΠϧ
൚༻తͳRole! (base.json) {! "name": "base",! "description": "vagrant base",! "json_class": "Chef::Role",!
"override_attributes": {! "sensu": {! "role_subscriptions": [! "all"! ],! "use_embedded_ruby": true! }! },! "default_attributes": {! },! "chef_type": "role",! "run_list": [! ]! }
൚༻తͳRole! (base.json) {! "name": "base",! "description": "vagrant base",! "json_class": "Chef::Role",!
"override_attributes": {! "sensu": {! "role_subscriptions": [! "all"! ],! "use_embedded_ruby": true! }! },! "default_attributes": {! },! "chef_type": "role",! "run_list": [! ]! } - શαʔόڞ௨! - Sensuͷࠜຊతͳઃఆ! - "all" subscriptions ͷઃఆ
൚༻తͳRole! (base.json) Sensu༻ͷRubyΛར༻͍ͨ͠! ! [:sensu][:use_embedded_ruby]! ! /opt/sensu/embedded/bin/ruby! {! "name": "base",!
"description": "vagrant base",! "json_class": "Chef::Role",! "override_attributes": {! "sensu": {! "role_subscriptions": [! "all"! ],! "use_embedded_ruby": true! }! },! "default_attributes": {! },! "chef_type": "role",! "run_list": [! ]! } - શαʔόڞ௨! - Sensuͷࠜຊతͳઃఆ! - "all" subscriptions ͷઃఆ
Sensu Server! (ࢹ͢Δଆ)! ͷΠϯετʔϧ
Sensu Server! (sensu_server.json) {! "sensu": {! "rabbitmq": {! "host": "localhost",!
"port": 5671,! "vhost": "/sensu",! "password": "sensu_rabbitmq_pass"! },! "node_subscriptions": [! "sensu_server"! ]! },! "run_list": [! "role[base]",! "recipe[sensu]",! "recipe[sensu::client_service]",! "recipe[sensu::server_service]",! "recipe[sensu::redis]",! "recipe[sensu::rabbitmq]",! "recipe[uchiwa]"! ]! }
Sensu Server! (sensu_server.json) ! - [:rabbitmq][:password]! ! มߋඞਢ! {! "sensu":
{! "rabbitmq": {! "host": "localhost",! "port": 5671,! "vhost": "/sensu",! "password": "sensu_rabbitmq_pass"! },! "node_subscriptions": [! "sensu_server"! ]! },! "run_list": [! "role[base]",! "recipe[sensu]",! "recipe[sensu::client_service]",! "recipe[sensu::server_service]",! "recipe[sensu::redis]",! "recipe[sensu::rabbitmq]",! "recipe[uchiwa]"! ]! }
Sensu Server! (sensu_server.json) ! - [:rabbitmq][:password]! ! มߋඞਢ! ! -
[:rabbitmq][:host]! ! ࣗࣗ(localhost) {! "sensu": {! "rabbitmq": {! "host": "localhost",! "port": 5671,! "vhost": "/sensu",! "password": "sensu_rabbitmq_pass"! },! "node_subscriptions": [! "sensu_server"! ]! },! "run_list": [! "role[base]",! "recipe[sensu]",! "recipe[sensu::client_service]",! "recipe[sensu::server_service]",! "recipe[sensu::redis]",! "recipe[sensu::rabbitmq]",! "recipe[uchiwa]"! ]! }
Sensu Server! (sensu_server.json) {! "sensu": {! "rabbitmq": {! "host": "localhost",!
"port": 5671,! "vhost": "/sensu",! "password": "sensu_rabbitmq_pass"! },! "node_subscriptions": [! "sensu_server"! ]! },! "run_list": [! "role[base]",! "recipe[sensu]",! "recipe[sensu::client_service]",! "recipe[sensu::server_service]",! "recipe[sensu::redis]",! "recipe[sensu::rabbitmq]",! "recipe[uchiwa]"! ]! } Sensu ServerͷΠϯετʔϧ! recipe[sensu]! recipe[sensu::client_service]! recipe[sensu::server_service]! recipe[sensu::redis]! recipe[sensu::rabbitmq]!
Sensu Client! (ࢹ͞ΕΔଆ)! ͷΠϯετʔϧ
Sensu Client! (sensu_client.json) {! "sensu": {! "rabbitmq": {! "host": "SENSU
SERVER",! "port": 5671,! "vhost": "/sensu",! "password": "sensu_rabbitmq_pass"! },! "node_subscriptions": [! "sensu_client"! ]! },! "run_list": [! "role[base]",! "recipe[sensu]",! "recipe[sensu::client_service]"! ]! }
Sensu Client! (sensu_client.json) ! - [:rabbitmq][:password]! ! Sensu Serverͷઃఆ! {!
"sensu": {! "rabbitmq": {! "host": "SENSU SERVER",! "port": 5671,! "vhost": "/sensu",! "password": "sensu_rabbitmq_pass"! },! "node_subscriptions": [! "sensu_client"! ]! },! "run_list": [! "role[base]",! "recipe[sensu]",! "recipe[sensu::client_service]"! ]! }
Sensu Client! (sensu_client.json) ! - [:rabbitmq][:password]! ! Sensu Serverͷઃఆ! !
- [:rabbitmq][:host]! ! Sensu ServerΛࢦఆ! {! "sensu": {! "rabbitmq": {! "host": "SENSU SERVER",! "port": 5671,! "vhost": "/sensu",! "password": "sensu_rabbitmq_pass"! },! "node_subscriptions": [! "sensu_client"! ]! },! "run_list": [! "role[base]",! "recipe[sensu]",! "recipe[sensu::client_service]"! ]! }
Sensu Client! (sensu_client.json) {! "sensu": {! "rabbitmq": {! "host": "SENSU
SERVER",! "port": 5671,! "vhost": "/sensu",! "password": "sensu_rabbitmq_pass"! },! "node_subscriptions": [! "sensu_client"! ]! },! "run_list": [! "role[base]",! "recipe[sensu]",! "recipe[sensu::client_service]"! ]! } Sensu ClientͷΠϯετʔϧ! recipe[sensu]! recipe[sensu::client_service]
ઃఆฤ
client.jsonͷઃఆ! (ࢹ͞ΕΔଆͷઃఆ)
Client༻ͷઃఆ! (client.json)! ! ! ! !
Client༻ͷઃఆ! (client.json)! ! ! nodeͷใ! - name(ࣗͷ໊લ)! - address(ࣗͷIPΞυϨε)! -
subscriptions(ࢹ߲)! !
ࠓճ࡞ͨ͠cookbook!
ࠓճ࡞ͨ͠cookbook! ! - sensu-client-config (client.json)! - sensu-server-plugin (plugin)! - sensu-client-plugin
(plugin)
sensu-client-config /etc/sensu/conf.d/client.json! Λ࡞͢Δcookbook
sensu-client-config
sensu-client-config - node[:sensu][:hostname]! - node[:sensu][:ipaddress]! - node[:sensu][:node_subscription]! - node[:sensu][:role_subscription]
sensu-client-config - node[:sensu][:hostname]! - node[:sensu][:ipaddress]! - node[:sensu][:node_subscription]! - node[:sensu][:role_subscription] ChefͷtemplateػೳΛར༻͠!
/etc/sensu/conf.d/client.json ʹઃఆΛॻ͖ग़͢!
sensu-client-config - node[:sensu][:node_subscription]!
sensu-client-config - node[:sensu][:node_subscription]! => db_master! => db_slave! => queue_master! =>
queue_slave
sensu-client-config - node[:sensu][:node_subscription]! => db_master! => db_slave! => queue_master! =>
queue_slave! ! - node[:sensu][:role_subscription]!
sensu-client-config - node[:sensu][:node_subscription]! => db_master! => db_slave! => queue_master! =>
queue_slave! ! - node[:sensu][:role_subscription]! => db! => queue! => all
sensu-server-plugin server༻ͷ֤छઃఆϑΝΠϧΛ! ஔ͢Δcookbook! (໋໊͕Α͘ͳ͍)
/etc/sensu/conf.d/checks/! ! ! ࢹ༻ͷઃఆϑΝΠϧΛ֨ೲ! ! - check_cpu.json! - check_cpu_iowait.json! -
check_disk.json! - check_fluentd_monitor_agent.json! remote_directory "/etc/sensu/conf.d/checks/" do! source "checks"! files_mode 0644! mode 0755! owner "root"! end sensu-server-plugin 1/6
sensu-server-plugin 2/6 remote_directory "/etc/sensu/metrics/" do! source "metrics"! files_mode 0755! mode
0755! owner "root"! end /etc/sensu/metrics/! ! ! ϝτϦΫεͷ࣮ߦϑΝΠϧΛ֨ೲ! ! - cpu-metrics.rb! - disk-usage-metrics.rb
sensu-server-plugin 3/6 remote_directory "/etc/sensu/conf.d/metrics/" do! source "metrics_config"! files_mode 0644! mode
0755! owner "root"! end /etc/sensu/conf.d/metrics/! ! ! ϝτϦΫεͷઃఆϑΝΠϧΛ֨ೲ! ! - cpu-metrics.json! - disk-usage-metrics.json
sensu-server-plugin 4/6 remote_directory "/etc/sensu/handlers/" do! source "handlers"! files_mode 0755! mode
0755! owner "root"! end /etc/sensu/handlers/! ! ! ௨पΓͷ࣮ߦϑΝΠϧΛ֨ೲ! ! - hipchat.rb! - mailer.rb
sensu-server-plugin 5/6 remote_directory "/etc/sensu/conf.d/handlers/" do! source "handlers_config"! files_mode 0644! mode
0755! owner "root"! end /etc/sensu/conf.d/handlers/! ! ! ௨पΓͷઃఆϑΝΠϧΛ֨ೲ! ! - graphite.json! - hipchat.json! - mailer.json
sensu-server-plugin 6/6 remote_directory "/etc/sensu/plugins/" do! source "plugins"! files_mode 0755! mode
0755! owner "root"! end! ! gems = ["redis"]! ! gems.each do |gem|! execute "/opt/sensu/embedded/bin/gem install #{gem}" do! command "/opt/sensu/embedded/bin/gem install #{gem}"! cwd "/tmp/"! not_if "/opt/sensu/embedded/bin/gem list | grep -w \"^#{gem}\s\""! end! end /etc/sensu/plugins/! ! ! Serverͷpluginͷ࣮ߦϑΝΠϧΛ֨ೲ! ࣮ߦʹඞཁͳϥΠϒϥϦͷΠϯετʔϧ! ! - check-fluentd-log.rb
sensu-client-plugin client༻ͷpluginͷ࣮ߦϑΝΠϧΛ! ஔ͢Δcookbook
sensu-client-plugin 1/1 remote_directory "/etc/sensu/plugins/" do! source "plugins"! files_mode 0755! mode
0755! owner "root"! end! ! gems = ["redis"]! ! gems.each do |gem|! execute "/opt/sensu/embedded/bin/gem install #{gem}" do! command "/opt/sensu/embedded/bin/gem install #{gem}"! cwd "/tmp/"! not_if "/opt/sensu/embedded/bin/gem list | grep -w \"^#{gem}\s\""! end! end /etc/sensu/plugins/! ! Clientͷpluginͷ࣮ߦϑΝΠϧΛ֨ೲ! ࣮ߦʹඞཁͳϥΠϒϥϦͷΠϯετʔϧ! ! - check_cpu.rb! - check_cpu_iowait.rb! - check_disk.rb! - check_fluentd_monitor_agent.rb!
sensu-server-plugin /etc/sensu/conf.d/checks/! ࢹ༻ͷઃఆϑΝΠϧͷ֨ೲ! /etc/sensu/metrics/! ϝτϦΫε༻ͷ࣮ߦϑΝΠϧͷ֨ೲ! /etc/sensu/conf.d/metrics/! ϝτϦΫε༻ͷઃఆϑΝΠϧͷ֨ೲ! /etc/sensu/handlers/! ௨पΓͷ࣮ߦϑΝΠϧΛ֨ೲ! /etc/sensu/conf.d/handlers/!
௨पΓͷઃఆϑΝΠϧΛ֨ೲ! /etc/sensu/plugins/! Server༻ͷpluginͷ࣮ߦϑΝΠϧͷ֨ೲ
sensu-client-plugin /etc/sensu/plugins/ Client༻ͷpluginͷ࣮ߦϑΝΠϧͷ֨ೲ
͓͞Β͍
֤छRoleͷઃఆ
൚༻తͳRole! (base.json) {! "name": "base",! "description": "vagrant base",! "json_class": "Chef::Role",!
"override_attributes": {! "sensu": {! "role_subscriptions": [! "all"! ],! "use_embedded_ruby": true! }! },! "default_attributes": {! },! "chef_type": "role",! "run_list": [! ]! }
൚༻తͳRole! (base.json) [:sensu][:use_embedded_ruby]! omnibus-rubyΛΠϯετʔϧ {! "name": "base",! "description": "vagrant base",!
"json_class": "Chef::Role",! "override_attributes": {! "sensu": {! "role_subscriptions": [! "all"! ],! "use_embedded_ruby": true! }! },! "default_attributes": {! },! "chef_type": "role",! "run_list": [! ]! }
൚༻తͳRole! (base.json) [:sensu][:use_embedded_ruby]! omnibus-rubyΛΠϯετʔϧ {! "name": "base",! "description": "vagrant base",!
"json_class": "Chef::Role",! "override_attributes": {! "sensu": {! "role_subscriptions": [! "all"! ],! "use_embedded_ruby": true! }! },! "default_attributes": {! },! "chef_type": "role",! "run_list": [! ]! } [:sensu][:role_subscriptions]! ൚༻తͳsubscriptionͷઃఆ
Sensu Server! (sensu_server.json) {! "sensu": {! "rabbitmq": {! "host": "localhost",!
"port": 5671,! "vhost": "/sensu",! "password": "sensu_rabbitmq_pass"! },! "node_subscriptions": [! "sensu_server"! ]! },! "run_list": [! "role[base]",! "recipe[sensu]",! "recipe[sensu-client-config]",! "recipe[sensu-client-plugin]",! "recipe[sensu-server-plugin]",! "recipe[sensu::client_service]",! "recipe[sensu::server_service]",! "recipe[sensu::redis]",! "recipe[sensu::rabbitmq]",! "recipe[uchiwa]"! ]! }
Sensu Server! (sensu_server.json) {! "sensu": {! "rabbitmq": {! "host": "localhost",!
"port": 5671,! "vhost": "/sensu",! "password": "sensu_rabbitmq_pass"! },! "node_subscriptions": [! "sensu_server"! ]! },! "run_list": [! "role[base]",! "recipe[sensu]",! "recipe[sensu-client-config]",! "recipe[sensu-client-plugin]",! "recipe[sensu-server-plugin]",! "recipe[sensu::client_service]",! "recipe[sensu::server_service]",! "recipe[sensu::redis]",! "recipe[sensu::rabbitmq]",! "recipe[uchiwa]"! ]! } Sensu ServerͷΠϯετʔϧ! recipe[sensu]! recipe[sensu::client_service]! recipe[sensu::server_service]! recipe[sensu::redis]! recipe[sensu::rabbitmq]!
Sensu Server! (sensu_server.json) {! "sensu": {! "rabbitmq": {! "host": "localhost",!
"port": 5671,! "vhost": "/sensu",! "password": "sensu_rabbitmq_pass"! },! "node_subscriptions": [! "sensu_server"! ]! },! "run_list": [! "role[base]",! "recipe[sensu]",! "recipe[sensu-client-config]",! "recipe[sensu-client-plugin]",! "recipe[sensu-server-plugin]",! "recipe[sensu::client_service]",! "recipe[sensu::server_service]",! "recipe[sensu::redis]",! "recipe[sensu::rabbitmq]",! "recipe[uchiwa]"! ]! } Sensu ServerͷΠϯετʔϧ! recipe[sensu]! recipe[sensu::client_service]! recipe[sensu::server_service]! recipe[sensu::redis]! recipe[sensu::rabbitmq]! pluginपΓͷઃఆͷ! recipe[sensu-client-plugin]! recipe[sensu-server-plugin]!
Sensu Server! (sensu_server.json) {! "sensu": {! "rabbitmq": {! "host": "localhost",!
"port": 5671,! "vhost": "/sensu",! "password": "sensu_rabbitmq_pass"! },! "node_subscriptions": [! "sensu_server"! ]! },! "run_list": [! "role[base]",! "recipe[sensu]",! "recipe[sensu-client-config]",! "recipe[sensu-client-plugin]",! "recipe[sensu-server-plugin]",! "recipe[sensu::client_service]",! "recipe[sensu::server_service]",! "recipe[sensu::redis]",! "recipe[sensu::rabbitmq]",! "recipe[uchiwa]"! ]! } Sensu ServerͷΠϯετʔϧ! recipe[sensu]! recipe[sensu::client_service]! recipe[sensu::server_service]! recipe[sensu::redis]! recipe[sensu::rabbitmq]! pluginपΓͷઃఆͷ! recipe[sensu-client-plugin]! recipe[sensu-server-plugin]! client.jsonͷઃఆ! recipe[sensu-client-config]!
Sensu Client! (sensu_client.json) {! "sensu": {! "rabbitmq": {! "host": "SENSU
SERVER",! "port": 5671,! "vhost": "/sensu",! "password": "sensu_rabbitmq_pass"! },! "node_subscriptions": [! "sensu_client"! ]! },! "run_list": [! "role[base]",! "recipe[sensu]",! "recipe[sensu-client-config]",! "recipe[sensu-client-plugin]",! "recipe[sensu::client_service]"! ]! }
Sensu Client! (sensu_client.json) {! "sensu": {! "rabbitmq": {! "host": "SENSU
SERVER",! "port": 5671,! "vhost": "/sensu",! "password": "sensu_rabbitmq_pass"! },! "node_subscriptions": [! "sensu_client"! ]! },! "run_list": [! "role[base]",! "recipe[sensu]",! "recipe[sensu-client-config]",! "recipe[sensu-client-plugin]",! "recipe[sensu::client_service]"! ]! } Sensu ClientͷΠϯετʔϧ! recipe[sensu]! recipe[sensu::client_service]
Sensu Client! (sensu_client.json) {! "sensu": {! "rabbitmq": {! "host": "SENSU
SERVER",! "port": 5671,! "vhost": "/sensu",! "password": "sensu_rabbitmq_pass"! },! "node_subscriptions": [! "sensu_client"! ]! },! "run_list": [! "role[base]",! "recipe[sensu]",! "recipe[sensu-client-config]",! "recipe[sensu-client-plugin]",! "recipe[sensu::client_service]"! ]! } pluginपΓͷઃఆͷ! recipe[sensu-client-plugin]! Sensu ClientͷΠϯετʔϧ! recipe[sensu]! recipe[sensu::client_service] client.jsonͷઃఆ! recipe[sensu-client-config]!
ಠࣗcookbook
- sensu-client-config(client.json)!
- sensu-client-config(client.json)! - sensu-server-plugin(plugin)
- sensu-client-config(client.json)! - sensu-server-plugin(plugin)! - sensu-client-plugin(plugin)
- Chefࣗମͷ͚ͩͲ1ճcook͕௨Δ·Ͱ͕͍! - 1ճ௨Εޙख์͠Ͱӡ༻Ͱ͖Δ! - ઃఆϑΝΠϧಠࣗcookbookͰΑ͠ͳʹͰ͖Δ ·ͱΊ
ࢀߟURL! ! sensu! - http://sensuapp.org/! ! sensu chef! - https://github.com/sensu/sensu-chef!
! supermarket! - https://supermarket.getchef.com/cookbooks/sensu! ! example cookbook! - https://github.com/kenjiskywalker/chef ͓ΘΓ