2 #Copyright (C) 2009 Gabes Jean, naparuba@gmail.com
4 #This file is part of Shinken.
6 #Shinken is free software: you can redistribute it and/or modify
7 #it under the terms of the GNU Affero General Public License as published by
8 #the Free Software Foundation, either version 3 of the License, or
9 #(at your option) any later version.
11 #Shinken is distributed in the hope that it will be useful,
12 #but WITHOUT ANY WARRANTY; without even the implied warranty of
13 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 #GNU Affero General Public License for more details.
16 #You should have received a copy of the GNU Affero General Public License
17 #along with Shinken. If not, see <http://www.gnu.org/licenses/>.
20 #This Class is an example of an Arbiter module
21 #Here for the configuration phase AND running one
24 #This text is print at the import
25 print "Detected module : Dummy module for Arbiter"
29 from shinken
.external_command
import ExternalCommand
34 'type' : 'dummy_arbiter',
36 'phases' : ['configuration', 'running'],
40 #called by the plugin manager to get a broker
41 def get_instance(plugin
):
42 print "Get a Dummy arbiter module for plugin %s" % plugin
.get_name()
43 instance
= Dummy_arbiter(plugin
.get_name())
48 #Just print some stuff
50 def __init__(self
, name
):
53 #Called by Arbiter to say 'let's prepare yourself guy'
55 print "Initilisation of the dummy arbiter module"
56 self
.return_queue
= self
.properties
['from_queue']
63 #Ok, main function that is called in the CONFIGURATION phase
64 def get_objects(self
):
65 print "[Dummy] ask me for objects to return"
67 h
= {'name' : 'dummy host from dummy arbiter module',
72 print "[Dummy] Returning to Arbiter the hosts:", r
76 #When you are in "external" mode, that is the main loop of your process
79 print "Raise a external command as example"
80 e
= ExternalCommand('Viva la revolution')
81 self
.return_queue
.put(e
)