Trees | Indices | Help |
|
---|
|
1 ########################################################################### 2 # 3 # This program is part of Zenoss Core, an open source monitoring platform. 4 # Copyright (C) 2007, Zenoss Inc. 5 # 6 # This program is free software; you can redistribute it and/or modify it 7 # under the terms of the GNU General Public License version 2 as published by 8 # the Free Software Foundation. 9 # 10 # For complete information please visit: http://www.zenoss.com/oss/ 11 # 12 ########################################################################### 13 14 import Globals 15 16 from twisted.internet import reactor 17 from twisted.cred import credentials 18 from twisted.spread import pb 19 20 from Products.ZenEvents.Event import Event 21 22 evt = Event() 23 evt.device = 'zenoss03' 24 evt.summary = 'sdfs pb event class' 25 evt.severity = 5 26 evt.eventClass = '/' 27 283053 56 60 61 if __name__ == '__main__': 62 ec = EventClient() 63 ec.run() 64 65 #event = { 66 # 'device': 'zenoss02', 67 # 'summary': 'test pb event', 68 # 'severity': 5, 69 # 'eventClass': '/' 70 #} 71 # 72 #factory = pb.PBClientFactory() 73 #reactor.connectTCP("localhost", 8789, factory) 74 #d = factory.getRootObject() 75 #d.addCallback(lambda object: object.callRemote("sendEvent", event)) 76 #d.addCallback(lambda object: object.callRemote("sendEvent", pbevt)) 77 #def bad(reason): print 'error: '+str(reason.value) 78 #d.addErrback(bad) 79 #d.addCallback(lambda _: reactor.stop()) 80 #reactor.run() 8132 factory = pb.PBClientFactory() 33 reactor.connectTCP("localhost", 8789, factory) 34 d = factory.login(credentials.UsernamePassword("test", "test"),client=self) 35 d.addCallback(self.connected) 36 d.addErrback(self.bad) 37 reactor.run()3840 print "got perspective ref:", perspective 41 d = perspective.getService("EventService", self) 42 d.addCallback(self.sendEvent) 43 d.addErrback(self.bad)44 49 50 52 print 'error: '+str(reason.value)
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0beta1 on Thu Oct 25 16:28:35 2007 | http://epydoc.sourceforge.net |