Project

sfpagent

0.0
No commit activity in last 3 years
No release in over 3 years
A Ruby implementation of SFP agent.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0

Runtime

>= 0.3.17
 Project Readme

SFP Agent for Ruby

Build Status Gem Version

A Ruby script and library of SFP agent. The agent could be accessed through HTTP RESTful API.

With this agent, you could get the state and deploy configuration of particular software components. Each configuration should be specified in SFP language. Every software component could have a set of methods which could be called through HTTP request.

Requirements

  • Ruby (>= 1.9.2)
  • Ruby Gems
    • sfp

Tested On

  • Ruby: 1.9.2, 1.9.3, 2.0.0, JRuby-19mode
  • OS: Ubuntu, Debian, MacOS X

To install

  • Ruby 1.9.x

      $ apt-get install ruby1.9.1 ruby1.9.1-dev libz-dev libaugeas-ruby1.9.1
      $ gem install sfpagent
    

As daemon

  • start the agent daemon

      $ sfpagent -s
    

    In default, the agent will listen at port 1314.

  • stop the agent daemon

      $ sfpagent -t
    

Home Directory

Home directory keeps all agent's local data such as:

  • log file
  • PID file
  • model file
  • installed modules

In default, the agent will use (and created if not exist) the following directory as home directory:

  • ~/.sfpagent, when the daemon is running with non-root user
  • /var/sfpagent, when the daemon is running with root user

HTTP RESTful API

  • GET

    • /pid : save daemon's PID to a file (only requested from localhost)
    • /state : return the current state
    • /model : return the current model
    • /sfp : return the SFP description of a module
    • /modules : return a list of available modules
    • /agents : return a list of agents database
    • /log : return last 100 lines of log file
  • POST

    • /execute : receive an action's schema and execute it
  • PUT

    • /model : receive a new model and then save it
    • /model/cache : receive a "cache" model and then save it
    • /modules : save the module if parameter "module" is provided
    • /agents : save the agents' list if parameter "agents" is provided
    • /bsig : receive BSig model and receive it in cached directory
    • /bsig/satisfier : receive goal request from other agents and then start a satisfier thread in order to achieve it
  • DELETE

    • /model : delete existing model
    • /model/cache : delete all cache models
    • /model/cache/name : delete cache model of agent "name"
    • /modules : delete all modules from module database
    • /modules/name : delete module "name" from module database
    • /agents : delete all agents from agent database
    • /agents/name : delete "name" from agent database
    • /bsig : delete existing BSig model