Software Development Kit (SDK) and API Discussions

Getting IndexError: list index out of range using Zapi

agnesj
3,112 Views

Hi,

I have a python script that would run for hours and then I would get an Zapi Exception error when I am trying to do a server_ct_invoke_elem.  The stack trace is as follows:

Traceback (most recent call last):

  File "ontapmon.py", line 328, in aggrperf_get

    perf_out = server_ctx.invoke_elem(perf_in)

  File "/mnt/lsf/netapp-manageability-sdk-5.0//lib/python/NetApp/NaServer.py", line 490, in invoke_elem

    return self.parse_xml(xml_response)

  File "/mnt/lsf/netapp-manageability-sdk-5.0//lib/python/NetApp/NaServer.py", line 686, in parse_xml

    p.Parse(xmlresponse, 1)

  File "/mnt/lsf/netapp-manageability-sdk-5.0//lib/python/NetApp/NaServer.py", line 666, in end_element

    self.ZAPI_stack[i-1].child_add(n)

IndexError: list index out of range

Basically the script would collect counters via DFM:

# Create API request
    perf_in = NaElement("perf-get-counter-data")

    perf_in.child_add_string("number-samples", 1)

    instance_info = NaElement("instance-counter-info")
    counter_info = NaElement("counter-info")
    instance_info.child_add_string("object-name-or-id", obj_name)

    perf_obj_ctr1 = NaElement("perf-object-counter")
    perf_obj_ctr1.child_add_string("object-type", "volume")
    perf_obj_ctr1.child_add_string("counter-name", "avg_latency")

    perf_obj_ctr2 = NaElement("perf-object-counter")
    perf_obj_ctr2.child_add_string("object-type", "disk")
    perf_obj_ctr2.child_add_string("counter-name", "disk_busy")

    counter_info.child_add(perf_obj_ctr1)
    counter_info.child_add(perf_obj_ctr2)

    instance_info.child_add(counter_info)

    perf_in.child_add(instance_info)

    try:

        perf_out = server_ctx.invoke_elem(perf_in)

Has anyone gotten this error before?   If so, any insight on a solution?   I am using DFM version 5.1 and version NMSDK 5.0 .  Attached is the python script (ontapmon.py), the config file (parameter settings that defines DFM server, password, etc) to pass to the python script and example log message when I get the error.

Please advise.

Regards,

ajacob

2 REPLIES 2

sens
3,112 Views

Hi,

Your code pasted above looks fine to me.

Does it happen for a particular host (obj_name in your code)?

You can use ZEDI (available under <nmsdk root>/zedi/) for testing.

Regards,

Sen.

agnesj
3,112 Views

No, it does not happen on a particular (obj_name).  The Exception occurs on different obj_name and when retrieving other coutners like domain counters.  My scripts captures Exceptions in error log files and a grep of Exception in these files indicate what obj_name and type of counters script is retrieving when the Exception is caught.  Please also note that the "IndexError is occurring in the NMSDK in file NaServer.py

[root@ibmx3755-svl03-priv aj]# grep Exception ontapmon_error.log*

ontapmon_error.log.2012-09-18:2012-09-18 05:30:08,130 ERROR Exception getting aggregate counters for fas6070c-svl22:plm_aggr

ontapmon_error.log.2012-09-18:2012-09-18 09:05:10,950 ERROR Exception getting aggregate counters for fas6280c-svl12:aggr1

ontapmon_error.log.2012-09-18:2012-09-18 18:45:45,875 ERROR Exception getting domain counters for fas6280c-svl11

ontapmon_error.log.2012-09-18:2012-09-18 23:20:07,075 ERROR Exception getting aggregate counters for fas6070c-svl23:ptcaggr_nfs

ontapmon_error.log.2012-09-19:2012-09-19 06:22:39,179 ERROR Exception getting aggregate counters for fas6280c-svl11:aggr1

ontapmon_error.log.2012-09-19:2012-09-19 22:11:50,431 ERROR Exception getting aggregate counters for fas6280c-svl11:aggr1

ontapmon_error.log.2012-09-20:2012-09-20 06:14:53,576 ERROR Exception getting aggregate counters for fas6280c-svl11:aggr1

ontapmon_error.log.2012-09-21:2012-09-21 09:29:38,305 ERROR Exception getting domain counters for fas6280c-svl12

ontapmon_error.log.2012-09-22:2012-09-22 05:07:48,093 ERROR Exception getting domain counters for fas6280c-svl12

ontapmon_error.log.2012-09-23:2012-09-23 07:36:51,135 ERROR Exception getting aggregate counters for fas6280c-svl11:aggr1

ontapmon_error.log.2012-09-23:2012-09-23 18:50:13,429 ERROR Exception getting aggregate counters for fas6070c-svl22:aggr1

ontapmon_error.log.2012-09-24:2012-09-24 15:50:30,458 ERROR Exception getting domain counters for fas6280c-svl11

Regards,

ajacob

Public