Skip to Content
Learning MCollective
book

Learning MCollective

by Jo Rhett
August 2014
Intermediate to advanced
284 pages
5h 24m
English
O'Reilly Media, Inc.
Content preview from Learning MCollective

Chapter 15. Building an Agent

In this chapter, you will build a custom agent. You’ll start with a basic template useful as a starting point for agent development. Then you’ll add more functionality and test it from the mco client application.

We’ll expand the basics to provide additional features and discuss different ways to work with the MCollective plugin ecosystem.

After finishing this chapter, you’ll be able to take this agent template and replace just a few lines of Ruby to build a different custom agent.

SimpleRPC Framework

As we build MCollective clients and agents, we will be utilizing a set of libraries that comprise the SimpleRPC Framework. These libraries give us useful tools and handlers to simplify the tasks of communicating in the MCollective ecosystem. The SimpleRPC Framework provides conventions and standards that make it easy to work with plugins provided by others as well.

The framework isn’t law. You can easily peak beneath the hood using standard Ruby commands. However, it is rarely necessary, and everything we do in this book can be done by someone with little Ruby experience.

In the SimpleRPC Framework, data is passed back and forth in hashes like so:

say_goodbye( 
  :msg     => "So long...",
  :sender => "Dolphins"
)

There are a few simple rules for passing data back and forth:

  • Parameters must always be in a hash.

  • Parameter names can be anything you want (except :process_results, because this has special meaning to the agent and client).

  • Parameter values ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Russell Rules

Russell Rules

Bill Russell
What Employees Want Most in Uncertain Times

What Employees Want Most in Uncertain Times

Kristine W. Powers, Jessica B.B. Diaz
How to Become a Game-Changing Leader

How to Become a Game-Changing Leader

Douglas A. Ready, Alan Mulally
How You Play the Game

How You Play the Game

Jerry Colangelo, Len Sherman

Publisher Resources

ISBN: 9781491945681Errata