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 #This class is the link between Arbiter and Poller. With It, arbiter
23 #can see if a poller is alive, and can send it new configuration
25 from shinken
.satellitelink
import SatelliteLink
, SatelliteLinks
26 from shinken
.util
import to_int
, to_bool
, to_split
27 from shinken
.property import UnusedProp
, BoolProp
, IntegerProp
, FloatProp
, CharProp
, StringProp
, ListProp
29 class PollerLink(SatelliteLink
):
32 #To_send : send or not to satellite conf
33 properties
={'poller_name': StringProp(
34 fill_brok
=['full_status'],
36 'address': StringProp(
37 fill_brok
=['full_status']),
40 fill_brok
=['full_status']),
43 fill_brok
=['full_status']),
44 'manage_sub_realms': BoolProp(
46 fill_brok
=['full_status']),
50 'min_workers': IntegerProp(
52 fill_brok
=['full_status'],
54 'max_workers': IntegerProp(
56 fill_brok
=['full_status'],
58 'processes_by_worker': IntegerProp(
60 fill_brok
=['full_status'],
62 'polling_interval': IntegerProp(
64 fill_brok
=['full_status'],
66 'manage_arbiters': IntegerProp(
68 'poller_tags': ListProp(
71 'use_timezone': StringProp(
74 'timeout': IntegerProp(
76 fill_brok
=['full_status']),
77 'data_timeout': IntegerProp(
79 fill_brok
=['full_status']),
80 'max_check_attempts': IntegerProp(
82 fill_brok
=['full_status']),
83 'realm' : StringProp(default
=''),
86 running_properties
= {'con': StringProp(
90 fill_brok
=['full_status'],
94 'attempt': StringProp(
96 fill_brok
=['full_status']), # the number of failed attempt
97 'reachable': StringProp(
99 fill_brok
=['full_status']), # can be network ask or not (dead or check in timeout or error)
100 'configuration_errors' : StringProp(default
=[]),
105 return self
.poller_name
108 def register_to_my_realm(self
):
109 self
.realm
.pollers
.append(self
)
110 if self
.poller_tags
!= []:
111 print "I %s manage tags : %s " % (self
.get_name(), self
.poller_tags
)
113 class PollerLinks(SatelliteLinks
):
114 name_property
= "name"
115 inner_class
= PollerLink