Archived community.zenoss.org | full text search
Skip navigation
1358 Views 1 Reply Latest reply: Jun 5, 2013 12:45 PM by shakespear RSS
shakespear Rank: Green Belt 117 posts since
Jul 1, 2007
Currently Being Moderated

Jun 5, 2013 11:07 AM

How to get all devices of an ip-network?

Hi,

 

following piece of code:

 

    net=context.getSubNetworks():

    for dev in net.getSubDevices():

         loc=dev. getLocationName()

 

leads to following error:

 

 

Type: <type 'exceptions.TypeError'>
Value: getSubDevices() takes at most 2 arguments (3 given)

Traceback (most recent call last): File "/opt/zenoss/lib/python/ZPublisher/Publish.py",

line 126, in publish request, bind=1) File "/opt/zenoss/lib/python/ZPublisher/mapply.py",

line 77, in mapply if debug is not None: return debug(object,args,context) File "/opt/zenoss/lib/python/ZPublisher/Publish.py",

line 46, in call_object result=apply(object,args) # Type s<cr> to step into published object.

File "/opt/zenoss/lib/python/Shared/DC/Scripts/Bindings.py",

line 322, in __call__ return self._bindAndExec(args, kw, None)

File "/opt/zenoss/lib/python/Shared/DC/Scripts/Bindings.py",

line 359, in _bindAndExec return self._exec(bound_data, args, kw)

File "/opt/zenoss/lib/python/Products/PythonScripts/PythonScript.py",

line 344, in _exec result = f(*args, **kw) File "Script (Python)",

line 22, in getNetworklistWithLocations File "Script (Python)",

line 12, in findLocation File "/opt/zenoss/Products/ZenModel/IpNetwork.py",

line 482, in getSubDevices return DeviceOrganizer.getSubDevices(self, filter, "ipaddresses")

TypeError: getSubDevices() takes at most 2 arguments (3 given)

 

I assume a bug in the Method getSubDevices of the class ipnetwork. The source of this method is:

 

    def getSubDevices(self, filter=None):

#481          """get all the devices under and instance of a DeviceGroup"""

482          return DeviceOrganizer.getSubDevices(self, filter, "ipaddresses")

 

but DeviceOrganizer.getSubDevices only accepts 2 parameters - exception seems correct :

 

    def getSubDevices(self, devfilter=None):

#    96    """

      97          Get all the devices under an instance of a DeviceOrganizer

# 98 

# 99          @param devfilter: Filter function applied to returned list

#100          @type devfilter: function

#101          @return: Devices

#102          @rtype: list

 

 

How can I get a list of all device objects within an ipnetwork with zenoss 4.2.3?

 

Thank you in advance!

 

greetings,

christian

More Like This

  • Retrieving data ...

Legend

  • Correct Answers - 4 points
  • Helpful Answers - 2 points