<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: NMSDK - Pyton to retrieve some data in Software Development Kit (SDK) and API Discussions</title>
    <link>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/NMSDK-Pyton-to-retrieve-some-data/m-p/122903#M2093</link>
    <description>&lt;P&gt;I guess you use a 7M system so.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;aggregates&lt;SPAN&gt;=xo.child_get("aggregates")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;aggregatelist =&amp;nbsp;aggregates.children_get()&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;for aggregate in aggregatelist:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; aggrname = aggregate.child_get_string("name")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; print(aggrname)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;François&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 05 Sep 2016 07:57:48 GMT</pubDate>
    <dc:creator>francoisbnc</dc:creator>
    <dc:date>2016-09-05T07:57:48Z</dc:date>
    <item>
      <title>NMSDK - Pyton to retrieve some data</title>
      <link>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/NMSDK-Pyton-to-retrieve-some-data/m-p/122873#M2092</link>
      <description>&lt;P&gt;New to NDMSDK and using Zeplorer to look at the code. If am executing the code, sprintf() is displaying all the code in xml but like to have the values in dictionary/provide a specific attribute with print statement to check the value for the attribute.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this case, am trying to retrieve bais aggr name.&lt;/P&gt;&lt;P&gt;Have seen return parameters this call &amp;nbsp;is providing and how and which call to retrieve the information in a string so that can use use loop consitions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here the script:&lt;/P&gt;&lt;P&gt;import sys&lt;BR /&gt;sys.path.append("/root/nmsdk54/netapp-manageability-sdk-5.4/lib/python/NetApp")&lt;BR /&gt;from NaServer import *&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;s = NaServer("filername", 1 , 19)&lt;BR /&gt;s.set_server_type("FILER")&lt;BR /&gt;s.set_transport_type("HTTP")&lt;BR /&gt;s.set_port(80)&lt;BR /&gt;s.set_style("LOGIN")&lt;BR /&gt;s.set_admin_user("username", "password")&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;api = NaElement("aggr-list-info")&lt;BR /&gt;api.child_add_string("aggregate","aggr1_thin")&lt;/P&gt;&lt;P&gt;xi = NaElement("filter-attrs")&lt;BR /&gt;api.child_add(xi)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;xi1 = NaElement("filter-attrs-info")&lt;BR /&gt;xi.child_add(xi1)&lt;/P&gt;&lt;P&gt;xi1.child_add_string("all","&amp;lt;all&amp;gt;")&lt;BR /&gt;xi1.child_add_string("is-cfo","&amp;lt;is-cfo&amp;gt;")&lt;BR /&gt;xi1.child_add_string("is-local","&amp;lt;is-local&amp;gt;")&lt;BR /&gt;xi1.child_add_string("is-partner","&amp;lt;is-partner&amp;gt;")&lt;BR /&gt;xi1.child_add_string("is-sfo","&amp;lt;is-sfo&amp;gt;")&lt;/P&gt;&lt;P&gt;xo = s.invoke_elem(api)&lt;BR /&gt;if (xo.results_status() == "failed") :&lt;BR /&gt;print ("Error:\n")&lt;BR /&gt;print (xo.sprintf())&lt;BR /&gt;sys.exit (1)&lt;/P&gt;&lt;P&gt;print ("Received:\n")&lt;BR /&gt;#print (s.xo.sprintf())&lt;BR /&gt;out=xo.child_get("aggregates")&lt;BR /&gt;out1=xo.child_get("attributes-list")&lt;BR /&gt;print (out)&lt;BR /&gt;print (out1)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;output of the script is:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# python aggr.py&lt;BR /&gt;Received:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;lt;NaElement.NaElement instance at 0x2ae2a419fbd8&amp;gt; -&amp;gt; What does this mean and how to retieve a value?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;None&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jun 2025 19:14:12 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/NMSDK-Pyton-to-retrieve-some-data/m-p/122873#M2092</guid>
      <dc:creator>sridharchevendra</dc:creator>
      <dc:date>2025-06-04T19:14:12Z</dc:date>
    </item>
    <item>
      <title>Re: NMSDK - Pyton to retrieve some data</title>
      <link>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/NMSDK-Pyton-to-retrieve-some-data/m-p/122903#M2093</link>
      <description>&lt;P&gt;I guess you use a 7M system so.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;aggregates&lt;SPAN&gt;=xo.child_get("aggregates")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;aggregatelist =&amp;nbsp;aggregates.children_get()&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;for aggregate in aggregatelist:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; aggrname = aggregate.child_get_string("name")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; print(aggrname)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;François&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Sep 2016 07:57:48 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/NMSDK-Pyton-to-retrieve-some-data/m-p/122903#M2093</guid>
      <dc:creator>francoisbnc</dc:creator>
      <dc:date>2016-09-05T07:57:48Z</dc:date>
    </item>
    <item>
      <title>Re: NMSDK - Pyton to retrieve some data</title>
      <link>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/NMSDK-Pyton-to-retrieve-some-data/m-p/123514#M2109</link>
      <description>&lt;P&gt;Thank you Francois..didn't configure alerts and missed the update.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Sep 2016 23:02:26 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/NMSDK-Pyton-to-retrieve-some-data/m-p/123514#M2109</guid>
      <dc:creator>sridharchevendra</dc:creator>
      <dc:date>2016-09-22T23:02:26Z</dc:date>
    </item>
    <item>
      <title>Re: NMSDK - Pyton to retrieve some data</title>
      <link>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/NMSDK-Pyton-to-retrieve-some-data/m-p/125200#M2150</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You should take a look at the documentation section &lt;STRONG&gt;Input Output Management APIs for Python&lt;/STRONG&gt;. I'll give you a sample code to help you get started.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    api = NaElement('quota-report')
    xo = filer.invoke_elem(api)

    if xo.results_status() == "failed":
        print("Error:\n")
        print(xo.sprintf())
        sys.exit(1)

    for quota in xo.child_get('quotas').children_get():
        if quota.has_children():
            quotaType = quota.child_get_string('quota-type')
            quotaTarget = quota.child_get_string('quota-target')

            try:
                diskUsedKB = quota.child_get_int('disk-used')
                diskLimitKB = quota.child_get_int('disk-limit')

                if diskLimitKB &amp;gt; 0:
                    usedProp = diskUsedKB / diskLimitKB
                else:
                    usedProp = 0

            except ValueError:
                diskUsedKB = "-",
                diskLimitKB = "-"

            # No need for default quota
            if quotaTarget == "*":
                continue&lt;/PRE&gt;&lt;P&gt;The variable &lt;STRONG&gt;usedProp&lt;/STRONG&gt; is used to calculate the percentage of used space. Pay attention that both &lt;STRONG&gt;diskUsedKB&lt;/STRONG&gt; and &lt;STRONG&gt;diskLimitKB&lt;/STRONG&gt; are integers. So, if for any reason you need it as a string use str(variable).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Nov 2016 12:13:50 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/NMSDK-Pyton-to-retrieve-some-data/m-p/125200#M2150</guid>
      <dc:creator>FelipeMafra</dc:creator>
      <dc:date>2016-11-08T12:13:50Z</dc:date>
    </item>
  </channel>
</rss>

