This repository was archived by the owner on Jul 19, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathevent.py
More file actions
53 lines (48 loc) · 3.52 KB
/
Copy pathevent.py
File metadata and controls
53 lines (48 loc) · 3.52 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
from core import plugin, model
from plugins.event.models import event
class _event(plugin._plugin):
version = 1.3
def install(self):
# Register models
model.registerModel("raiseEvent","_raiseEvent","_action","plugins.event.models.action")
model.registerModel("event","_event","_document","plugins.event.models.event",True)
model.registerModel("eventThreshold","_eventThreshold","_trigger","plugins.event.models.trigger")
model.registerModel("eventUpdate","_eventUpdate","_action","plugins.event.models.action")
model.registerModel("eventUpdateScore","_eventUpdateScore","_action","plugins.event.models.action")
model.registerModel("eventGetCorrelations","_eventGetCorrelations","_action","plugins.event.models.action")
model.registerModel("eventBuildCorrelations","_eventBuildCorrelations","_action","plugins.event.models.action")
model.registerModel("eventCorrelation","_eventCorrelation","_document","plugins.event.models.event",True)
model.registerModel("eventGetCorrelation","_eventGetCorrelation","_action","plugins.event.models.action")
event._event()._dbCollection.create_index([("expiryTime", -1)])
event._eventCorrelation()._dbCollection.create_index([("expiryTime", -1)])
return True
def uninstall(self):
# deregister models
model.deregisterModel("raiseEvent","_raiseEvent","_action","plugins.event.models.action")
model.deregisterModel("event","_event","_document","plugins.event.models.event")
model.deregisterModel("eventThreshold","_eventThreshold","_trigger","plugins.event.models.trigger")
model.deregisterModel("eventUpdate","_eventUpdate","_action","plugins.event.models.action")
model.deregisterModel("eventUpdateScore","_eventUpdateScore","_action","plugins.event.models.action")
model.deregisterModel("eventGetCorrelations","_eventGetCorrelations","_action","plugins.event.models.action")
model.deregisterModel("eventBuildCorrelations","_eventBuildCorrelations","_action","plugins.event.models.action")
model.deregisterModel("event","_eventCorrelation","_document","plugins.event.models.event")
model.deregisterModel("eventGetCorrelation","_eventGetCorrelation","_action","plugins.event.models.action")
return True
def upgrade(self,LatestPluginVersion):
if self.version < 0.5:
model.registerModel("eventUpdateScore","_eventUpdateScore","_action","plugins.event.models.action")
if self.version < 0.4:
model.registerModel("eventUpdate","_eventUpdate","_action","plugins.event.models.action")
if self.version < 0.2:
model.registerModel("eventThreshold","_eventThreshold","_trigger","plugins.event.models.trigger")
if self.version < 0.6:
model.registerModel("eventCorrelation","_eventCorrelation","_document","plugins.event.models.event",True)
model.registerModel("eventGetCorrelations","_eventGetCorrelations","_action","plugins.event.models.action")
model.registerModel("eventBuildCorrelations","_eventBuildCorrelations","_action","plugins.event.models.action")
if self.version < 0.7:
model.registerModel("eventGetCorrelation","_eventGetCorrelation","_action","plugins.event.models.action")
if self.version < 1.3:
print("Creating indexes...")
event._event()._dbCollection.create_index([("expiryTime", -1)])
event._eventCorrelation()._dbCollection.create_index([("expiryTime", -1)])
return True