Transforms - Suppress hosts behind down router

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

This transform will suppress any status/ping errors from devices that are behind routers that you also monitor:

evt.message = "System Down"
evt.component = device.comments
network = device.os.routes.findObjectsById("0.0.0.0")
if network is not None and len(network) > 0:
    router = dmd.Devices.findDevice(network[0].getNextHopIp())
    if router is not None:
        if router.getPingStatus():
            evt.message = evt.message + " - Upstream Router is Down"
            evt.severity = 2
        else:
            evt.message = evt.message + " - Upstream Router is OK"
    else:
        evt.message = evt.message + " - Upstream router is not monitored\n"
        evt.message = evt.message + " IP of upstream router is : "
        evt.message = evt.message + network[0].getNextHopIp()