Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
MCollective as
an integration layer
Jon Topper
The Scale Factory
MCollective
a framework to build
server orchestration
or parallel job
execution systems.
“
”
MCollective
not simply a fancy
SSH “for loop”“
”
MCollective
Servers
MiddlewareClient
MCollective
Servers
MiddlewareClient
Finding Servers
Check Service Status
Check Package Versions
Still looks a bit like a
fancy SSH “for loop”
a framework to build
server orchestration
or parallel job
execution systems.
“
”
Zabbix
• Distributed monitoring system
• Fetches time series data - can alert on anomaly
• Uses MySQL
• Multiple data sour...
Zabbix
Zabbix
ZCollective
zcollective —zabbix-api-url !
http://localhost/api_jsonrpc.php
ZCollective
include MCollective::RPC!
!
mc = rpcclient("rpcutil", :debug => true)!
!
mc.discover.sort.each do |host|!
!
in...
ZCollective
def do_some_zabbix_magic(inventory)!
!
# If the host isn’t added to Zabbix!
# Add the host using the API!
# Fo...
ZCollective
ZCollective
ZCollective
https://github.com/scalefactory/zcollective
Traditional Deployment
sf-deploy
Latest:
Deployed:
aaa1
aaa1
sf-deploy
Latest:
Deployed:
aaa1
aaa1
sf-deploy
Latest:
Deployed: aaa1
aaa2
sf-deploy
Latest:
Deployed:
aaa2
aaa2
Code
class MCollective::Application::Sfdeploy < MCollective::Application!
!
def main!
!
action = configuration[:action]!
!...
Code
module MCollective!
module Agent!
class Sfdeploy < RPC::Agent!
!
all_actions.each do |act|!
action act do!
!
sf_deplo...
ZCollective
https://github.com/scalefactory/sf-deploy
Resources
http://docs.puppetlabs.com/mcollective/
http://www.scalefactory.com/
jon@scalefactory.com
@jtopper
scalefactory
Puppet Camp London 2014: MCollective as an Integration Layer
Upcoming SlideShare
Loading in …5
×

Puppet Camp London 2014: MCollective as an Integration Layer

1,326 views

Published on

MCollective as an Integration Layer by Jon Topper

Published in: Technology
  • Be the first to comment

Puppet Camp London 2014: MCollective as an Integration Layer

  1. 1. MCollective as an integration layer Jon Topper The Scale Factory
  2. 2. MCollective a framework to build server orchestration or parallel job execution systems. “ ”
  3. 3. MCollective not simply a fancy SSH “for loop”“ ”
  4. 4. MCollective Servers MiddlewareClient
  5. 5. MCollective Servers MiddlewareClient
  6. 6. Finding Servers
  7. 7. Check Service Status
  8. 8. Check Package Versions
  9. 9. Still looks a bit like a fancy SSH “for loop”
  10. 10. a framework to build server orchestration or parallel job execution systems. “ ”
  11. 11. Zabbix • Distributed monitoring system • Fetches time series data - can alert on anomaly • Uses MySQL • Multiple data sources: • Zabbix agent / sender • SNMP poll / traps • JMX
  12. 12. Zabbix
  13. 13. Zabbix
  14. 14. ZCollective zcollective —zabbix-api-url ! http://localhost/api_jsonrpc.php
  15. 15. ZCollective include MCollective::RPC! ! mc = rpcclient("rpcutil", :debug => true)! ! mc.discover.sort.each do |host|! ! inventory = mc.custom_request( ! "inventory", {}, host,! { "identity" => host }! ).first! ! do_some_zabbix_magic(inventory)! ! end
  16. 16. ZCollective def do_some_zabbix_magic(inventory)! ! # If the host isn’t added to Zabbix! # Add the host using the API! # For each Puppet class on this host! # If there’s a Zabbix template by this name! # Assign that template to the host.! # end! # end! # end! ! # If the host is already in Zabbix! # Make sure all templates correctly assigned! # end ! ! end
  17. 17. ZCollective
  18. 18. ZCollective
  19. 19. ZCollective https://github.com/scalefactory/zcollective
  20. 20. Traditional Deployment
  21. 21. sf-deploy Latest: Deployed: aaa1 aaa1
  22. 22. sf-deploy Latest: Deployed: aaa1 aaa1
  23. 23. sf-deploy Latest: Deployed: aaa1 aaa2
  24. 24. sf-deploy Latest: Deployed: aaa2 aaa2
  25. 25. Code class MCollective::Application::Sfdeploy < MCollective::Application! ! def main! ! action = configuration[:action]! ! mc = rpcclient("sfdeploy")! ! printrpc mc.send(! action,! :application => configuration[:application],! :branch => configuration[:branch],! :tag => configuration[:tag],! :groups => configuration[:groups],! :options => options! )! ! printrpcstats! end
  26. 26. Code module MCollective! module Agent! class Sfdeploy < RPC::Agent! ! all_actions.each do |act|! action act do! ! sf_deploy = config.pluginconf["sfdeploy.binary"] || "sf-deploy"! deploy_user = config.pluginconf["sfdeploy.user"]|| nil! ! command = "#{sf_deploy} -a #{request[:application]} -v "! command << "-b #{request[:branch]} " if request[:branch]! command << "-t #{request[:tag]} " if request[:tag]! command << "-g #{request[:groups]} " if request[:groups]! command << act! ! if deploy_user! to_run = "su #{deploy_user} -c "#{command}""! else! to_run = command! end
  27. 27. ZCollective https://github.com/scalefactory/sf-deploy
  28. 28. Resources http://docs.puppetlabs.com/mcollective/
  29. 29. http://www.scalefactory.com/ jon@scalefactory.com @jtopper scalefactory

×