Skip to content

Instantly share code, notes, and snippets.

@cluther
Created April 28, 2017 14:46
Show Gist options
  • Save cluther/96f28b4312ddaf5d863b7bae28402ac5 to your computer and use it in GitHub Desktop.
Save cluther/96f28b4312ddaf5d863b7bae28402ac5 to your computer and use it in GitHub Desktop.
Layer2 ZenPack Troubleshooting (>=1.3.4)
# Layer2 suppression troubleshootin in zendmd. (Layer2 >= 1.3.4)
import logging ; setLogLevel(logging.INFO)
from ZenPacks.zenoss.Layer2 import suppression
suppressor = suppression.get_suppressor(dmd)
device, settings = suppressor.get_device_and_settings("SERVER-DEVICE-ID")
# Can we get the device's immediate neighbors?
neighbors = suppressor.get_neighbors(device.getPrimaryId())
pprint(list(neighbors)) # list of neighbors
# Are the gateways correct?
gateways = suppressor.get_gateways(device, settings)
pprint(gateways) # list of gateway devices
# Raw shortest paths from device to its gateways.
for gateway in gateways:
shortest_paths = suppressor.get_shortest_paths(device, gateway)
pprint([gateway, shortest_paths]) # list of shortest paths
# Higher-level that only uses shortest-path. No shortcuts or tricks.
l2_root_causes = suppressor.l2_root_causes(device, gateways)
pprint(l2_root_causes) # set of root cause devices
# Highest level approximation of what suppression plugin will check.
root_causes = suppressor.root_causes(device, settings)
pprint(root_causes) # set of root cause devices
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment