Puppet Camp London 2014: MCollective as an Integration Layer
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

Puppet Camp London 2014: MCollective as an Integration Layer

  • 857 views
Uploaded on

MCollective as an Integration Layer by Jon Topper

MCollective as an Integration Layer by Jon Topper

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
857
On Slideshare
795
From Embeds
62
Number of Embeds
2

Actions

Shares
Downloads
26
Comments
0
Likes
5

Embeds 62

https://puppetlabs.com 42
http://puppetlabs.com 20

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. MCollective as an integration layer Jon Topper The Scale Factory
  • 2. MCollective a framework to build server orchestration or parallel job execution systems. “ ”
  • 3. MCollective not simply a fancy SSH “for loop”“ ”
  • 4. MCollective Servers MiddlewareClient
  • 5. MCollective Servers MiddlewareClient
  • 6. Finding Servers
  • 7. Check Service Status
  • 8. Check Package Versions
  • 9. Still looks a bit like a fancy SSH “for loop”
  • 10. a framework to build server orchestration or parallel job execution systems. “ ”
  • 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. Zabbix
  • 13. Zabbix
  • 14. ZCollective zcollective —zabbix-api-url ! http://localhost/api_jsonrpc.php
  • 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. 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. ZCollective
  • 18. ZCollective
  • 19. ZCollective https://github.com/scalefactory/zcollective
  • 20. Traditional Deployment
  • 21. sf-deploy Latest: Deployed: aaa1 aaa1
  • 22. sf-deploy Latest: Deployed: aaa1 aaa1
  • 23. sf-deploy Latest: Deployed: aaa1 aaa2
  • 24. sf-deploy Latest: Deployed: aaa2 aaa2
  • 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. 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. ZCollective https://github.com/scalefactory/sf-deploy
  • 28. Resources http://docs.puppetlabs.com/mcollective/
  • 29. http://www.scalefactory.com/ jon@scalefactory.com @jtopper scalefactory