{"id":1269,"date":"2010-02-03T21:44:44","date_gmt":"2010-02-03T20:44:44","guid":{"rendered":"http:\/\/www.devco.net\/?p=1269"},"modified":"2010-08-17T12:16:13","modified_gmt":"2010-08-17T11:16:13","slug":"mcollective_agent_introspection","status":"publish","type":"post","link":"https:\/\/www.devco.net\/archives\/2010\/02\/03\/mcollective_agent_introspection.php","title":{"rendered":"MCollective Agent Introspection"},"content":{"rendered":"

With the new SimpleRPC system in MCollective<\/a> we have a simple interface to creating agents. The way to call an agent would be:<\/p>\n

<\/p>\n

\r\n$ mc-rpc service status service=httpd\r\n<\/pre>\n

<\/code><\/p>\n

This is all fine and well and easy enough, however it requires you to know a lot. You need to know there’s a status<\/em> action and you need to know it expects a service<\/em> argument, not great.<\/p>\n

I’m busy adding the ability for an agent to register its metadata and interface so that 3rd party tools can dynamically generate useful interfaces.<\/p>\n

A sample registration for service agent is:<\/p>\n

<\/p>\n

\r\nregister_meta(:name        => \"SimpleRPC Service Agent\",\r\n              :description => \"Agent to manage services using the Puppet service provider\",\r\n              :author      => \"R.I.Pienaar\",\r\n              :license     => \"GPLv2\",\r\n              :version     => 1.1,\r\n              :url         => \"http:\/\/mcollective-plugins.googlecode.com\/\",\r\n              :timeout     => 60)\r\n\r\n[\"start\", \"stop\", \"restart\", \"status\"].each do |action|\r\n    register_input(:action      => action,\r\n                   :name        => \"service\",\r\n                   :prompt      => \"Service Name\",\r\n                   :description => \"The service to #{action}\",\r\n                   :type        => :string,\r\n                   :validation  => '^[a-zA-Z\\-_\\d]+$',\r\n                   :maxlength   => 30):\r\n<\/pre>\n

<\/code><\/p>\n

This includes all the meta data, versions, timeouts, validation of inputs, prompts and help text for every input argument.<\/p>\n

Using this we can now generate dynamic UI’s, and do something like JavaDoc generated documentation. I’ve recorded a little video demonstrating a proof of concept Text UI<\/a> that uses this data to generate a UI dynamically. This is ripe for integration into tools like Foreman<\/a> and Puppet Dashboard<\/a>.<\/p>\n

Please watch the video here, best viewed full screen<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"

With the new SimpleRPC system in MCollective we have a simple interface to creating agents. The way to call an agent would be: $ mc-rpc service status service=httpd This is all fine and well and easy enough, however it requires you to know a lot. You need to know there’s a status action and you […]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","footnotes":""},"categories":[1],"tags":[121,78,13],"_links":{"self":[{"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/posts\/1269"}],"collection":[{"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/comments?post=1269"}],"version-history":[{"count":5,"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/posts\/1269\/revisions"}],"predecessor-version":[{"id":1706,"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/posts\/1269\/revisions\/1706"}],"wp:attachment":[{"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/media?parent=1269"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/categories?post=1269"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devco.net\/wp-json\/wp\/v2\/tags?post=1269"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}