<?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 Python EF2 topology setting in Extensions</title>
    <link>https://community.dynatrace.com/t5/Extensions/Python-EF2-topology-setting/m-p/251786#M4890</link>
    <description>&lt;P&gt;Hi guys,&lt;/P&gt;
&lt;P&gt;We&amp;nbsp; have start to convert python EF1 to EF2, we managed to convert already few of them but and now we are a bit confused on how to create the topology within&amp;nbsp;&lt;SPAN&gt;extension.yaml and how to set the values from __main__.py&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;We did not found any documentation or example for this kind of change or settings.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Wonder if we missed it or its really not there&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":thinking_face:"&gt;🤔&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Anyhow, can someone please help and show us the equivalence of the follows EF1 code:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;        for i in range (0,int(data['metaData']['totalHits'])):
            g1 = self.topology_builder.create_group("AlteonCloud", "AlteonCloud")
            e1 = g1.create_element("Alteon Cloud - " + self.group, "Alteon Cloud - " + self.group)
            ip = self.Alteon_url.replace("https://","")
            e1.add_endpoint(ip)

        for i in range (0,10):
            try:
                ip = self.Alteon_ips.split(",")[i]
                e1.add_endpoint(ip)
            except:
                break     

        for i in range (0,int(data['metaData']['totalHits'])):
            e1.absolute(key="blockedHttpTransactions",value=data["data"][i]["row"]['blockedHttpTransactions'])
            e1.absolute(key="passiveHttpTransactions",value=data["data"][i]["row"]['passiveHttpTransactions'])
            e1.absolute(key="cleanHttpTransactions"  ,value=data["data"][i]["row"]['cleanHttpTransactions'])&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In EF2&amp;nbsp;extension.yaml and __main__.py&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thanks in advance&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Yos&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 29 Jul 2024 07:54:17 GMT</pubDate>
    <dc:creator>Yosi_Neuman</dc:creator>
    <dc:date>2024-07-29T07:54:17Z</dc:date>
    <item>
      <title>Python EF2 topology setting</title>
      <link>https://community.dynatrace.com/t5/Extensions/Python-EF2-topology-setting/m-p/251786#M4890</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;
&lt;P&gt;We&amp;nbsp; have start to convert python EF1 to EF2, we managed to convert already few of them but and now we are a bit confused on how to create the topology within&amp;nbsp;&lt;SPAN&gt;extension.yaml and how to set the values from __main__.py&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;We did not found any documentation or example for this kind of change or settings.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Wonder if we missed it or its really not there&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":thinking_face:"&gt;🤔&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Anyhow, can someone please help and show us the equivalence of the follows EF1 code:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;        for i in range (0,int(data['metaData']['totalHits'])):
            g1 = self.topology_builder.create_group("AlteonCloud", "AlteonCloud")
            e1 = g1.create_element("Alteon Cloud - " + self.group, "Alteon Cloud - " + self.group)
            ip = self.Alteon_url.replace("https://","")
            e1.add_endpoint(ip)

        for i in range (0,10):
            try:
                ip = self.Alteon_ips.split(",")[i]
                e1.add_endpoint(ip)
            except:
                break     

        for i in range (0,int(data['metaData']['totalHits'])):
            e1.absolute(key="blockedHttpTransactions",value=data["data"][i]["row"]['blockedHttpTransactions'])
            e1.absolute(key="passiveHttpTransactions",value=data["data"][i]["row"]['passiveHttpTransactions'])
            e1.absolute(key="cleanHttpTransactions"  ,value=data["data"][i]["row"]['cleanHttpTransactions'])&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In EF2&amp;nbsp;extension.yaml and __main__.py&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thanks in advance&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Yos&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2024 07:54:17 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Extensions/Python-EF2-topology-setting/m-p/251786#M4890</guid>
      <dc:creator>Yosi_Neuman</dc:creator>
      <dc:date>2024-07-29T07:54:17Z</dc:date>
    </item>
    <item>
      <title>Re: Python EF2 topology setting</title>
      <link>https://community.dynatrace.com/t5/Extensions/Python-EF2-topology-setting/m-p/251791#M4892</link>
      <description>&lt;P&gt;Topology is handled differently. You cannot create topology directly from code, you need to send logs/metrics/traces/events and create generic topology types and relations which you can package into extension 2.0. Topology in EF2 has a significant drawback compared to EF+ - you need to send data at least every 5 minutes to keep entities alive. This can result in increased costs depending on your case.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;This means you won't have any continuity in terms of topology and after rewriting your extension to EF2 your devices from EF1 will no longer exist and generic topology from EF2 will create new devices.&amp;nbsp;&lt;BR /&gt;Also the custom topology won't have any automatically created relations unless you specify it in the custom topology relations. In EF1 you could create custom devices with specific IP addresses and smartscape automatically created relations. For example, if you monitored an appliance and there are outgoing requests from OneAgent monitored services to that appliance a link was established and you could see a service on top of a custom device. This is no longer possible.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2024 07:26:27 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Extensions/Python-EF2-topology-setting/m-p/251791#M4892</guid>
      <dc:creator>Julius_Loman</dc:creator>
      <dc:date>2024-07-29T07:26:27Z</dc:date>
    </item>
    <item>
      <title>Re: Python EF2 topology setting</title>
      <link>https://community.dynatrace.com/t5/Extensions/Python-EF2-topology-setting/m-p/251797#M4895</link>
      <description>&lt;P&gt;As &lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/3364"&gt;@Julius_Loman&lt;/a&gt; mentions below, you can no longer create custom devices directly from code. Instead you have to first declare them in your &lt;EM&gt;extension.yaml&lt;/EM&gt; file and then ingest metrics/logs in accordance to the sources you specify.&lt;/P&gt;&lt;PRE&gt;extension.yaml

topology:
  types:
    - name: alteon-cloud
      displayName: Alteon Cloud
      enabled: true
      rules:
        - idPattern: alteon_cloud_{ip}
          instanceNamePattern: "Alteon Cloud {ip}"
          sources:
            - sourceType: Metrics
              condition: $prefix(alteonCloud.)
          role: default&lt;/PRE&gt;&lt;P&gt;(the settings here correspond mostly to what you see in the UI under generic topology)&lt;/P&gt;&lt;P&gt;With the snippet above your &lt;EM&gt;extension.yaml&lt;/EM&gt; file you will be creating a generic topology rule in Dynatrace which will attempt to create Altean Cloud entities from any metric with prefix&lt;EM&gt; alteonCloud. &lt;/EM&gt;. These metrics should have an &lt;EM&gt;ip&lt;/EM&gt; dimension which will uniquely identify the entity, as indicated by the entity&lt;EM&gt; idPattern&lt;/EM&gt; (meaning you will have a different entity per &lt;EM&gt;ip&lt;/EM&gt; in your metric dimensions).&lt;/P&gt;&lt;P&gt;You would then ingest these metrics in your python code. For example:&lt;/P&gt;&lt;PRE&gt;__main__.py&lt;BR /&gt;&lt;BR /&gt;class ExtensionImpl(Extension):
...
def query(self):&lt;BR /&gt;    ...
    self.report_metric(key=alteonCloud.blockedHttpTransactions, value=data[stuff], dimensions={"ip": "your_ip", **other_dimensions})&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;...&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2024 06:54:07 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Extensions/Python-EF2-topology-setting/m-p/251797#M4895</guid>
      <dc:creator>TomásSeroteRoos</dc:creator>
      <dc:date>2024-07-29T06:54:07Z</dc:date>
    </item>
    <item>
      <title>Re: Python EF2 topology setting</title>
      <link>https://community.dynatrace.com/t5/Extensions/Python-EF2-topology-setting/m-p/251864#M4899</link>
      <description>&lt;P&gt;Thank you both&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/3364"&gt;@Julius_Loman&lt;/a&gt;&amp;nbsp;&amp;amp;&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/55565"&gt;@TomásSeroteRoos&lt;/a&gt;&amp;nbsp; for the detailed explanation and code sample&amp;nbsp;&lt;/P&gt;&lt;P&gt;Apricate it a lot&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yos&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2024 15:45:11 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Extensions/Python-EF2-topology-setting/m-p/251864#M4899</guid>
      <dc:creator>Yosi_Neuman</dc:creator>
      <dc:date>2024-07-29T15:45:11Z</dc:date>
    </item>
  </channel>
</rss>

