def getEdges(self): # We are saying below that from the container's perspective, we depend # on the physical node. We are agreeing with the ImpactEdge defined in # DeviceRelationsProvider, just expressing this identical relationship # from the Container's perspective. When defining ImpactEdges, you # always want to define impact relationships from both sides like this. yield ImpactEdge( IGlobalIdentifier(self._object.device()).getGUID(), IGlobalIdentifier(self._object).getGUID(), self.relationship_provider ) # Try to find a device that exists because we are running net-snmp or have ssh monitoring # going direct to the container. If we find such a device, then this device *is* the container. # We, the container component, are dependent on this device. The device is dependent on us. # The code below yields both ImpactEdges from the container component's perspective. md = self._object.getManagedDevice() if md: e1 = IGlobalIdentifier(self._object.device()).getGUID() e2 = IGlobalIdentifier(md).getGUID() yield ImpactEdge(self.relationship_provider, e1, e2) yield ImpactEdge(self.relationship_provider, e2, e1)
def getEdges(self): # We are saying below, that from the device's perspective, each container # depends upon us. devguid = IGlobalIdentifier(self._object).getGUID() for ve in self._object.openvz_containers(): # For ImpactEdges, the second argument depends upon the first argument: yield ImpactEdge( devguid, IGlobalIdentifier(ve).getGUID(), self.relationship_provider ) comp = self._object.getOpenVZComponentOnHost() if comp: # we are a device monitored thru SNMP or ssh that is an OpenVZ container. The # call above found the host we are running on, and the component representing # us underneath it. We are now going to say that we *are* the component, from # the container device's perspective. We depend on it, and it depends on us: e1 = IGlobalIdentifier(comp).getGUID() e2 = IGlobalIdentifier(self._object.device()).getGUID() yield ImpactEdge(e1, e2, self.relationship_provider) yield ImpactEdge(e2, e1, self.relationship_provider)
def getEdges(self): cpu = self._object device = cpu.device() if isinstance(device, LinuxDevice): yield ImpactEdge( IGlobalIdentifier(device).getGUID(), IGlobalIdentifier(cpu).getGUID(), self.relationship_provider)
def getEdges(self): device = self._object for process in device.os.processes(): yield ImpactEdge( IGlobalIdentifier(device).getGUID(), IGlobalIdentifier(process).getGUID(), self.relationship_provider) for ipservice in device.os.ipservices(): yield ImpactEdge( IGlobalIdentifier(device).getGUID(), IGlobalIdentifier(ipservice).getGUID(), self.relationship_provider) for cpu in device.hw.cpus(): yield ImpactEdge( IGlobalIdentifier(device).getGUID(), IGlobalIdentifier(cpu).getGUID(), self.relationship_provider)
def getEdges(self): """Generate ImpactEdge instances for adapted object. Required by IRelationshipDataProvider. """ provider = self.relationship_provider myguid = IGlobalIdentifier(self.adapted).getGUID() if self.impacted_by: for methodname in self.impacted_by: for impactor_guid in self.get_remote_guids(methodname): yield ImpactEdge(impactor_guid, myguid, provider) if self.impacts: for methodname in self.impacts: for impactee_guid in self.get_remote_guids(methodname): yield ImpactEdge(myguid, impactee_guid, provider)
def getEdges(self): for base_edge in BaseRelationshipDataProvider.getEdges(self): yield base_edge software_component = self.adapted.openstack_softwareComponent() if software_component: # impact the corresponding software software component yield ImpactEdge( IGlobalIdentifier(self.adapted).getGUID(), IGlobalIdentifier(software_component).getGUID(), self.relationship_provider)
def edge(source, target): ''' Create an edge indicating that source impacts target. source and target are expected to be GUIDs. ''' # Lazy import without incurring import overhead. # http://wiki.python.org/moin/PythonSpeed/PerformanceTips#Import_Statement_Overhead global ImpactEdge if not ImpactEdge: from ZenPacks.zenoss.Impact.impactd.relations import ImpactEdge return ImpactEdge(source, target, ZENPACK_NAME)
def edge(source, target): return ImpactEdge(source, target, RP)
def edge(source, target): assert isinstance(source, basestring) assert isinstance(target, basestring) return ImpactEdge(source, target, RP)