Quantcast
Channel: Zenoss Community: Message List
Viewing all articles
Browse latest Browse all 1118

Re: How to get all devices of an ip-network?

$
0
0

Hi,

 

could figure it out by myself:

 

this doesn't work because getSubDevices in class ipnetworks doesn't work:

 

    net=context.getSubNetworks():

    for dev in net.getSubDevices():

         loc=dev. getLocationName()

 

The primary root cause is: there are no objects of type "device" linked from an ipnetwork but objects of type ipaddress - and ipaddresses are linked to interfaces - and interfaces are linked to devices. So I have to trace this chain to get a location for an ipnetwork:

 

ipnetwork -> ipadress -> interface -> device -> location

 

 

def findLocation(net):

    location="unknown"

    for ipaddress in net.ipaddresses.objectValuesGen():

        dev=ipaddress.device()

        if dev:

            location=dev.getLocationName()

    return location

 

regards,

Christian


Viewing all articles
Browse latest Browse all 1118

Trending Articles