Add : the full demoCA certification autority so people can sign their own keys.
[shinken.git] / shinken / acknowledge.py
blob18ff05f21faac009d2d4d24183f782b2456fdbbd
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 it
9 # under the terms of the GNU Affero General Public License as
10 # published by the Free Software Foundation, either version 3 of the
11 # License, or (at your option) any later version.
13 # Shinken is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # Affero General Public License for more details.
18 # You should have received a copy of the GNU Affero General Public
19 # License along with Shinken. If not, see <http://www.gnu.org/licenses/>.
21 """
22 Allows you to acknowledge the current problem for the specified service.
23 By acknowledging the current problem, future notifications (for the same
24 servicestate) are disabled.
25 """
26 class Acknowledge:
27 id = 0
29 #Just to list the properties we will send as pickle
30 #so to others daemons, so all but NOT REF
31 properties = {
32 'id' : None,
33 'sticky' : None,
34 'notify' : None,
35 'author' : None,
36 'comment' : None,
40 # If the "sticky" option is set to one (1), the acknowledgement
41 # will remain until the service returns to an OK state. Otherwise
42 # the acknowledgement will automatically be removed when the
43 # service changes state. In this case Web interfaces set a value
44 # of (2).
46 # If the "notify" option is set to one (1), a notification will be
47 # sent out to contacts indicating that the current service problem
48 # has been acknowledged.
50 # If the "persistent" option is set to one (1), the comment
51 # associated with the acknowledgement will survive across restarts
52 # of the Shinken process. If not, the comment will be deleted the
53 # next time Nagios restarts. "persistent" not only means "survive
54 # restarts", but also
56 def __init__(self, ref, sticky, notify, persistent, author, comment):
57 self.id = self.__class__.id
58 self.__class__.id += 1
59 self.ref = ref # pointer to srv or host we are apply
60 self.sticky = sticky
61 self.notify = notify
62 self.author = author
63 self.comment = comment
66 #Call by picle for dataify the ackn
67 #because we DO NOT WANT REF in this pickleisation!
68 def __getstate__(self):
69 cls = self.__class__
70 # id is not in *_properties
71 res = {'id' : self.id}
72 for prop in cls.properties:
73 if hasattr(self, prop):
74 res[prop] = getattr(self, prop)
75 return res
78 #Inversed funtion of getstate
79 def __setstate__(self, state):
80 cls = self.__class__
81 self.id = state['id']
82 for prop in cls.properties:
83 if prop in state:
84 setattr(self, prop, state[prop])