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
32
34 reason.printTraceback()
35 reactor.stop()
36
38 def go(driver):
39 factory = pb.PBClientFactory()
40 reactor.connectTCP("localhost", PB_PORT, factory)
41
42 yield factory.login(credentials.UsernamePassword("zenoss", "zenoss"))
43 perspective = driver.next()
44
45 yield perspective.callRemote('getService', 'Beat', listener=Listener())
46 service = driver.next()
47
48 drive(go).addErrback(error)
49 reactor.run()
50
51 if __name__ == '__main__':
52 main()
53