* Fix : remove hook_late_configuration from BaseModule, if a module do not have,...
[shinken.git] / shinken / reactionnerlink.py
blob1660a0a076f2b82fa52c29302164e641d125aacd
1 #!/usr/bin/env python
2 #Copyright (C) 2009-2010 :
3 # Gabes Jean, naparuba@gmail.com
4 # Gerhard Lausser, Gerhard.Lausser@consol.de
5 # Gregory Starck, g.starck@gmail.com
6 # Hartmut Goebel, h.goebel@goebel-consult.de
8 #This file is part of Shinken.
10 #Shinken is free software: you can redistribute it and/or modify
11 #it under the terms of the GNU Affero General Public License as published by
12 #the Free Software Foundation, either version 3 of the License, or
13 #(at your option) any later version.
15 #Shinken is distributed in the hope that it will be useful,
16 #but WITHOUT ANY WARRANTY; without even the implied warranty of
17 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 #GNU Affero General Public License for more details.
20 #You should have received a copy of the GNU Affero General Public License
21 #along with Shinken. If not, see <http://www.gnu.org/licenses/>.
24 from shinken.satellitelink import SatelliteLink, SatelliteLinks
25 from shinken.property import BoolProp, IntegerProp, StringProp, ListProp
28 class ReactionnerLink(SatelliteLink):
29 id = 0
30 my_type = 'reactionner'
31 properties = {
32 'reactionner_name': StringProp(fill_brok=['full_status'], to_send=True),
33 'address': StringProp(fill_brok=['full_status']),
34 'port': IntegerProp(default='7769', fill_brok=['full_status']),
35 'spare': BoolProp(default='0', fill_brok=['full_status']),
36 'passive' : BoolProp(default='0', fill_brok=['full_status'], to_send=True),
37 'manage_sub_realms': BoolProp(default='1', fill_brok=['full_status']),
38 'modules': ListProp(default='', to_send=True),
39 'min_workers': IntegerProp(default='1', fill_brok=['full_status'], to_send=True),
40 'max_workers': IntegerProp(default='30', fill_brok=['full_status'], to_send=True),
41 'processes_by_worker': IntegerProp(default='256', fill_brok=['full_status'], to_send=True),
42 'polling_interval': IntegerProp(default='1', fill_brok=['full_status'], to_send=True),
43 'manage_arbiters': IntegerProp(default='0'),
44 'reactionner_tags': ListProp(default='None', to_send=True),
45 'use_timezone': StringProp(default='NOTSET', to_send=True),
46 'timeout': IntegerProp(default='3', fill_brok=['full_status']),
47 'data_timeout': IntegerProp(default='120', fill_brok=['full_status']),
48 'max_check_attempts': IntegerProp(default='3', fill_brok=['full_status']),
49 'realm' : StringProp(default=''),
52 running_properties = {
53 'con': StringProp(default=None),
54 'alive': StringProp(default=True, fill_brok=['full_status']),
55 'broks': StringProp(default=[]),
56 'attempt': StringProp(default=0, fill_brok=['full_status']), # the number of failed attempt
57 'reachable': StringProp(default=False, fill_brok=['full_status']), # can be network ask or not (dead or check in timeout or error)
58 'configuration_errors' : StringProp(default=[]),
60 macros = {}
62 def get_name(self):
63 return self.reactionner_name
66 def register_to_my_realm(self):
67 self.realm.reactionners.append(self)
71 class ReactionnerLinks(SatelliteLinks):#(Items):
72 name_property = "reactionner_name"
73 inner_class = ReactionnerLink