Archived community.zenoss.org | full text search
Skip navigation
Currently Being Moderated

ZenDMD Find Device with MAC Address

VERSION 1 
Created on: Sep 14, 2009 11:21 AM by Noel Brockett - Last Modified:  Sep 14, 2009 11:21 AM by Noel Brockett
#####Comments==start#####
If you need to find which device (must be known to zenoss) has a specific address.
First, get all devices from the root leve, Devices.
Next, loop through all interfaces each device has and check for your specific MAC address
This is a quick and dirty script and obviously
could be optimized with some breaks thrown. 
Optimization has been left for other programmers to develop.
This tip was developed by Michael C. Hoffman zenoss handle crashdummyMCH
#####Comments==end#####
zenoss$zendmd
>>> for d in dmd.Devices.getSubDevices():
...     for i in d.os.interfaces():
...             if i.macaddress == '00:50:56:AA:7C:8D':
...                     print d.id
...
[printed device name]



------------------------------------------------------------


Can this be done in ZMI? --jrogers1126, Tue, 01 Sep 2009 22:58:55 -0500

I'm wondering, if I can do something like this in ZMI, and use a URL to search for a Mac.

ie, http://localhost:8080/zport/dmd/Devices/Server/Linux/findMac?MAC=00:00:00:00:00:00

Might you be able to provide a modified example of this script that gets the MAC from a GET variable?
Comments (0)