Coder Social home page Coder Social logo

mcollective-service-agent's Introduction

Service Agent

The service agent that lets you stop, start, restart and query the statuses of services on your operating system.

The service agent does not do any management of services itself. Instead it uses the functionality defined in MCollective::Util::Service classes to perform the actions. By default the Service agent ships with a PuppetService util class, but creating your own is as simple as adding a new class to util/service/ and implementing the start, stop, status and restart methods.

Installation

Follow the basic plugin install guide.

Configuration

There is one plugin configuration setting for the service agent.

  • provider - The Util class that implements the start, stop, restart and status behavior. Defaults to 'puppet'

General provider configuration options can then also be set in the config file.

plugin.service.provider = puppet

# Puppet provider specific options
plugin.service.puppet.hasstatus = true
plugin.service.puppet.hasrestart = true

Usage

% mco rpc service status service=httpd -W /dev_server/
Determining the amount of hosts matching filter for 2 seconds .... 4

 * [ ============================================================> ] 4 / 4

Summary of Service Status:

   running = 3
   stopped = 1


Finished processing 4 / 4 hosts in 241.49 ms
% mco service puppet stop
Do you really want to operate on services unfiltered? (y/n): y

 * [ ============================================================> ] 4 / 4


Summary of Service Status:

   stopped = 4


Finished processing 4 / 4 hosts in 909.01 ms

Data Plugin

The Service agent also supplies a data plugin which uses the Service agent to check the current status of a service. The data plugin will return 'running' or 'stopped' and can be used during discovery or any other place where the MCollective discovery language is used.

mco rpc rpcutil ping -S "service('myservice').status=running"

Validator

The Service agent also supplies a validator plugin that will validate if a given string is a valid service name.

validate :service, :service_name

Extending

The default service agent achieves platform portability by using the Puppet provider system to support service managers on all platforms that Puppet supports.

If however you are not a Puppet user or simply want to implement some new method of service management you can do so by providing your own backend provider for this agent.

The logic for the Puppet version of this agent is implemented in Util::Service::PuppetService, you can create a custom service implementation that overrides #start, #stop, #restart, and #status.

To provide compatibility with the service data plugin #status should return 'stopped' if the service is stopped, and 'running' if the service is running.

This agent defaults to Util::Service::PuppetService but if you have your own you can configure it in the config file using:

plugin.service.provider = puppet

mcollective-service-agent's People

Contributors

ploubser avatar ripienaar avatar

Watchers

 avatar James Cloos avatar

Forkers

asherbond

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.