Transforms Tip: Dependencies

From Zenoss Wiki
This is the approved revision of this page, as well as being the most recent.
Jump to: navigation, search

While Zenoss Core doesn't have the dependency support of the Enterprise Impact product, it is possible to implement dependencies via. transforms. Using zep, you can see if there are any active events on another host or hosts and send the current event off to history (or drop it). If you can build a zep filter for your the event that matches the event(s) that should trigger the suppression, you can use a transform to suppress the events.

Here is an example of suppressing ganglia checks if the ganglia server itself is down:

# Check for ganglia server issues if we get a ganglia event
# Suppress the event if any exist
gangliaServer = 'ganglia.example.com'
if '/Status/Ganglia' in getattr(evt, 'eventClass', '/Unknown') and \
        device and device.id != gangliaServer:
    # Find out if Ganglia is down
    zep = getFacade('zep')
    filter_zep = zep.createEventFilter(status=[0,1],event_class='/Status/Ganglia',element_identifier=gangliaServer)
    if zep.getEventSummaries(0,filter=filter_zep)['total'] > 0:
       evt._action = 'history'
''(Replace 'ganglia.example.com' with the name of your server)''

Similarly, you can create a transform that will create a dependency on a host being available:

# Check to make sure the ganglia server is up, otherwise suppress these events
 gangliaServer = 'ganglia.example.com'
 if '/Status/Ganglia' in getattr(evt, 'eventClass', '/Unknown') and \
         device and device.id != gangliaServer:
     # Find out if Ganglia is down
     server = dmd.Devices.findDeviceByIdExact(gangliaServer)
     if server and server.getPingStatus() > 0
       evt._action = 'history'

In either case, these transforms need to be applied against the appropriate event class. In the case of the above I would add them to the /Status/Ganglia class.

One caveat, you will see events in your event console that will match the transform until the trigger event has been detected. Unless there is a way to force a service check from a transform, there isn't a way around this. However, ones the trigger event has been detected, the system will acknowledge those events when the services are checked a second time.