Add : child_dependencies/ parent_dependencies in livestatus module.
[shinken.git] / shinken / brokerlink.py
blob30477fe88ebd44be6b9039d4366b0419a95f6912
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
26 class BrokerLink(SatelliteLink):
27 id = 0
28 my_type = 'broker'
29 properties={
30 'broker_name': StringProp(
31 fill_brok=['full_status'],
32 to_send=True),
33 'address': StringProp(
34 fill_brok=['full_status']),
35 'port': IntegerProp(
36 default='7772',
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 'manage_arbiters': BoolProp(
45 default='0',
46 fill_brok=['full_status'],
47 to_send=True),
48 'modules': ListProp(
49 default='',
50 to_send=True),
51 'polling_interval': IntegerProp(
52 default='1',
53 fill_brok=['full_status'],
54 to_send=True),
55 'use_timezone': StringProp(
56 default='NOTSET',
57 to_send=True),
58 'timeout': IntegerProp(
59 default='3',
60 fill_brok=['full_status']),
61 'data_timeout': IntegerProp(
62 default='120',
63 fill_brok=['full_status']),
64 'max_check_attempts': IntegerProp(
65 default='3',
66 fill_brok=['full_status']),
67 'realm' : StringProp(default=''),
70 running_properties = {'con': StringProp(
71 default=None),
72 'alive': StringProp(
73 default=False,
74 fill_brok=['full_status']),
75 'broks': StringProp(
76 default=[]),
77 'attempt': StringProp(
78 default=0,
79 fill_brok=['full_status']), # the number of failed attempt
80 'reachable': StringProp(
81 default=False,
82 fill_brok=['full_status']), # can be network ask or not (dead or check in timeout or error)
83 'configuration_errors' : StringProp(default=[]),
85 macros = {}
87 def get_name(self):
88 return self.broker_name
91 def register_to_my_realm(self):
92 self.realm.brokers.append(self)
97 class BrokerLinks(SatelliteLinks):
98 name_property = "name"
99 inner_class = BrokerLink