Merge branch 'master' of ssh://lausser,shinken@shinken.git.sourceforge.net/gitroot...
[shinken.git] / shinken / reactionnerlink.py
blobdf208575df5956f271d4985f15c1f0a10dd58f71
1 #!/usr/bin/env python
2 #Copyright (C) 2009-2010 :
3 # Gabes Jean, naparuba@gmail.com
4 # Gerhard Lausser, Gerhard.Lausser@consol.de
6 #This file is part of Shinken.
8 #Shinken is free software: you can redistribute it and/or modify
9 #it under the terms of the GNU Affero General Public License as published by
10 #the Free Software Foundation, either version 3 of the License, or
11 #(at your option) any later version.
13 #Shinken is distributed in the hope that it will be useful,
14 #but WITHOUT ANY WARRANTY; without even the implied warranty of
15 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 #GNU Affero General Public License for more details.
18 #You should have received a copy of the GNU Affero General Public License
19 #along with Shinken. If not, see <http://www.gnu.org/licenses/>.
22 from shinken.satellitelink import SatelliteLink, SatelliteLinks
23 from shinken.util import to_int, to_bool, to_split
24 from shinken.property import UnusedProp, BoolProp, IntegerProp, FloatProp, CharProp, StringProp, ListProp
27 class ReactionnerLink(SatelliteLink):
28 id = 0
29 my_type = 'reactionner'
30 properties={'reactionner_name': StringProp(
31 fill_brok=['full_status'],
32 to_send=True),
33 'address': StringProp(
34 fill_brok=['full_status']),
35 'port': IntegerProp(
36 default='7769',
37 fill_brok=['full_status']),
38 'spare': BoolProp(
39 default='0',
40 fill_brok=['full_status']),
41 'manage_sub_realms': BoolProp(
42 default='1',
43 fill_brok=['full_status']),
44 'modules': ListProp(
45 default='',
46 to_send=True),
47 'min_workers': IntegerProp(
48 default='1',
49 fill_brok=['full_status'],
50 to_send=True),
51 'max_workers': IntegerProp(
52 default='30',
53 fill_brok=['full_status'],
54 to_send=True),
55 'processes_by_worker': IntegerProp(
56 default='256',
57 fill_brok=['full_status'],
58 to_send=True),
59 'polling_interval': IntegerProp(
60 default='1',
61 fill_brok=['full_status'],
62 to_send=True),
63 'manage_arbiters': IntegerProp(
64 default='0'),
65 'use_timezone': StringProp(
66 default='NOTSET',
67 to_send=True),
68 'timeout': IntegerProp(
69 default='3',
70 fill_brok=['full_status']),
71 'data_timeout': IntegerProp(
72 default='120',
73 fill_brok=['full_status']),
74 'max_check_attempts': IntegerProp(
75 default='3',
76 fill_brok=['full_status']),
77 'realm' : StringProp(default=''),
79 running_properties = {'con': StringProp(
80 default=None),
81 'alive': StringProp(
82 default=False,
83 fill_brok=['full_status']),
84 'broks': StringProp(
85 default=[]),
86 'attempt': StringProp(
87 default=0,
88 fill_brok=['full_status']), # the number of failed attempt
89 'reachable': StringProp(
90 default=False,
91 fill_brok=['full_status']), # can be network ask or not (dead or check in timeout or error)
92 'configuration_errors' : StringProp(default=[]),
94 macros = {}
96 def get_name(self):
97 return self.reactionner_name
100 def register_to_my_realm(self):
101 self.realm.reactionners.append(self)
105 class ReactionnerLinks(SatelliteLinks):#(Items):
106 name_property = "name"
107 inner_class = ReactionnerLink