1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 from twisted.spread import pb
17 from twisted.internet import reactor
18 from twisted.cred import credentials
19 from socket import getfqdn
20
21 import Globals
22 from Products.ZenUtils.Driver import drive
23 from Products.ZenEvents.Event import Event
24
25 from zenhub import PB_PORT
26
28 def go(driver):
29 factory = pb.PBClientFactory()
30 reactor.connectTCP("localhost", PB_PORT, factory)
31
32 yield factory.login(credentials.UsernamePassword("zenoss", "zenoss"))
33 perspective = driver.next()
34
35 yield perspective.callRemote('getService', 'EventService', 'client1')
36 service = driver.next()
37
38 service.sendEvent(Event(device=getfqdn(),
39 summary="This is a test",
40 severity=5))
41
42 drive(go).addBoth(lambda x: reactor.stop())
43 reactor.run()
44
45 if __name__ == '__main__':
46 main()
47