Merge branch 'master' of ssh://lausser,shinken@shinken.git.sourceforge.net/gitroot...
[shinken.git] / shinken / receiverlink.py
blobb2400c4660916fd4f63b0ba3bf5341df6f22eb0b
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
27 class ReceiverLink(SatelliteLink):
28 id = 0
29 my_type = 'receiver'
30 properties = {
31 'receiver_name': StringProp (fill_brok=['full_status'], to_send=True),
32 'address': StringProp (fill_brok=['full_status']),
33 'port': IntegerProp(default='7772', fill_brok=['full_status']),
34 'spare': BoolProp (default='0', fill_brok=['full_status']),
35 'manage_sub_realms': BoolProp (default='1', fill_brok=['full_status']),
36 'manage_arbiters': BoolProp (default='0', fill_brok=['full_status'], to_send=True),
37 'modules': ListProp (default='', to_send=True),
38 'polling_interval': IntegerProp(default='1', fill_brok=['full_status'], to_send=True),
39 'use_timezone': StringProp (default='NOTSET', to_send=True),
40 'timeout': IntegerProp(default='3', fill_brok=['full_status']),
41 'data_timeout': IntegerProp(default='120', fill_brok=['full_status']),
42 'max_check_attempts': IntegerProp(default='3', fill_brok=['full_status']),
43 'realm' : StringProp (default=''),
46 running_properties = {
47 'con': StringProp(default=None),
48 'alive': StringProp(default=True, fill_brok=['full_status']),
49 'broks': StringProp(default=[]),
50 'attempt': StringProp(default=0, fill_brok=['full_status']), # the number of failed attempt
51 'reachable': StringProp(default=False, fill_brok=['full_status']), # can be network ask or not (dead or check in timeout or error)
52 'configuration_errors': StringProp(default=[]),
55 macros = {}
57 def get_name(self):
58 return self.receiver_name
61 def register_to_my_realm(self):
62 self.realm.receivers.append(self)
67 class ReceiverLinks(SatelliteLinks):
68 name_property = "receiver_name"
69 inner_class = ReceiverLink