Func Plugin

  • Tags: remote controller
  • Latest: 1.7
  • Last Updated: 05 November 2008
  • Grails version: *
  • Authors: null
0 vote
Dependency:
compile ":func:1.7"

 Documentation

Summary

Description

Func Plugin

This plugin provides an easy way to integrate Func in your web application. Func (Fedora Unified Network Controller) provides a two-way authenticated system to put in communication programs, systems, tools and so on. In fact you can personalize func adding functionality and module to enable a communication with all you need! For any other information about this project, just take a look to the official web site (https://fedorahosted.org/func).

Installation

To install this plugin you can proceed using the standard established by grails:

grails install-plugin func

After the installation you have a SpringBean deployed in your web application

funcService

Usage

In grails you can insert a service in all classes just simply defining a variable with service name. So, to use func in you class, just make something like this:

class MyClass {

def funcService def myMethod = { [....] def modules = funcService.listModules() [....] } }

Configuration

You can override the standard func-api configuration. By default, the instantiated service, works in synch mode (async=false), with a single thread and supposing that your ''func-transmit'' and ''func'' scripts are both in the class path. You can naturally change these settings simply overriding your spring bean definition.

In ''grails-app/conf/spring/resources'' of your grails application, you can paste (and personalize) this code:

funcService(org.func.FuncImpl) {
    func = "/yourfolderOne/func"
    funcTransmit = "/yourfolderTwo/func-transmit"
    nforks=12
    async=true
}

You can set the properties you need.

API Specification

The methods you can call using func services are:

  • listMinions()
to obtain the list of func clients (machine that you can control in your java application using this API). The return is a java.util.List whith the hostname of each machines.

funcService.listMinions()

resp. ["client1", "client2.server.lan"]

  • call (String client, String module, String method)
Caller for func-transmit with single client and no parameter. The result will be a java.util.Map with machine hostname as map key and func response as value.

[client_name1: func response for this client (could be a simple string, another map, ...),
client_name2: func response]

(!) In each method you can use "*" in client parameters to execute what you want on all client machines

funcService.call("client", "hardware", "info")

resp: ["client": [hardwareinfoMap]]

  • call (List clients, String module, String method)
same call as before one but with a list of clients to call.

funcService.call(["client1", "client2"], "hardware", "info")

resp: ["client1": [hardwareinfoMap], "client2": [hardwareInfoMap]]

  • call (String client, String module, String method, String parameter)
Calling a func method passing also a user defined parameter

funcService.call("client1", "command", "run", "ls /tmp")

resp: ["client1": ["file1", "file2", "file3"]]

  • call (List clients, String module, String method, List parameters)
Caller with list of clients and list of parameters

funcService.call(["client1", "client2"], "command", "run", ["ls /tmp"])

resp: ["client1": ["file1", "file2", "file3"], "client2": ["file2", "file4", "file7"]]

  • listModules (String client)
You can ask a client for a list of available func modules.

funcService.listModules("client")

resp: ["client": ["hardware", "command", "system"]]

  • listModuleMethods (String client, String module)
Using this method you can ask a client which are all methods callable in a specified module.

funcService.listModules("client", "hardware")

resp: ["client": ["info", "method2", "method3"]]

  • getProcessResponse(String pid)
Used to get the status and response of async processes ran. you received PID parameter during async call

funcService.getProcessResponse("127328323.123321")

resp: ["status":3, "result":[yourresults]]

List of available modules

It's better to look for these information directly on func website
  • CertMasterModule - For power users out there, allows manipulating the certmaster from Func's API.
  • CommandModule - Running Arbitrary Commands Like SSH Does
  • CopyFileModule - Copyfile File Copying and Checksumming
  • FileTrackerModule - tracks file changes, for use with FuncInventory
  • JBossModule - monitoring and control jboss instances
  • IPtablesModule - iptables management
  • HardwareModule - Hardware Profilling
  • MountModule - mount, unmount, and query mounted resources
  • NagiosCheck - be able to call Nagios plugins and get their results, without needing to install nagios. Works with any plugin
  • NetappModule - Administer Netapp filers
  • NetworkTest - Test out network stuff.
  • ProcessModule - Process Info, memory usage, and Killing
  • ServiceModule - Service Status and Control
  • SysctlModule - Configure kernel parameters at runtime
  • RebootModule - Reboot your system
  • RpmModule - for any distro that supports RPM, lists installed packages
  • SmartModule - Disk Smart (Hard Drive) Status
  • UserModule - we still need to implement this :)
  • VirtModule - works with koan, KVM, Xen, etc
  • YumModule - for any distro that is yum based, installs packages

Plugin History

  • v1.3 - 21 July 2008 - Fixed a bug that produces an error during list_minions calls
  • v1.2 - 21 July 2008 - Aligned Plugin to Func-Java API. Add async directly in method call
  • v1.1 - 15 July 2008 - Aligned Plugin to Func-Java API. Added async communication and method to get async results.
  • v1.0 - 12 July 2008 - First Plugin Releases

Authors