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/>.
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.
29 #Just to list the properties we will send as pickle
30 #so to others daemons, so all but NOT REF
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
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
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
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
):
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
)
78 #Inversed funtion of getstate
79 def __setstate__(self
, state
):
82 for prop
in cls
.properties
:
84 setattr(self
, prop
, state
[prop
])