-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsuppress.py
30 lines (21 loc) · 984 Bytes
/
suppress.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from zenoss.protocols.jsonformat import to_dict, from_dict
from zenoss.protocols.protobufs.zep_pb2 import EventSummary, EventNote, EventSummaryUpdate, EventFilter
from zenoss.protocols.protobufs.zep_pb2 import STATUS_NEW, STATUS_SUPPRESSED
zep = getFacade('zep')
user_name = 'admin'
user_uuid = zep._getUserUuid(user_name)
filter_dict = {'event_summary': ['hola']}
filter_protobuf = from_dict(EventFilter, filter_dict)
suppress_update = from_dict(EventSummaryUpdate, dict(
status = STATUS_SUPPRESSED,
current_user_uuid = user_uuid,
current_user_name = user_name,
))
new_update = from_dict(EventSummaryUpdate, dict(
status = STATUS_NEW,
current_user_uuid = user_uuid,
current_user_name = user_name,
))
print 'Suppressing events that contain the word "hola" in the summary'
#zep.client.updateEventSummaries(suppress_update, event_filter=filter_protobuf)
#zep.client.updateEventSummaries(new_update, event_filter=filter_protobuf)