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

How to get all devices of an ip-network?

$
0
0

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:

 

    defgetSubDevices(self,filter=None):

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

482          returnDeviceOrganizer.getSubDevices(self,filter,"ipaddresses")

 

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

 

    defgetSubDevices(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


Viewing all articles
Browse latest Browse all 1118

Trending Articles