Skip to content
Fetching latest commit…
Cannot retrieve the latest commit at this time.
..
Failed to load latest commit information.
README.markdown
mcollective_action.php

README.markdown

A simple helper to assist with writing MCollective actions in PHP.

Given an action as below:

action "echo" do
   validate :message, String

   implemented_by "/tmp/echo.php"
end

The following PHP script will implement the echo action externally replying with message and timestamp

<?php
    require("mcollective_action.php");

    $mc = new MCollectiveAction();
    $mc->message = $mc->data["message"];
    $mc->timestamp = strftime("%c");
    $mc->info("some text to info log on the server");
?>

Calling it with mco rpc results in:

$ mco rpc test echo message="hello world"
Determining the amount of hosts matching filter for 2 seconds .... 1

 * [ ============================================================> ] 1 / 1


nephilim.ml.org                         : OK
    {:message=>"hello world", :time=>"Tue Mar 15 19:20:53 +0000 2011"}
Something went wrong with that request. Please try again.