<?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 Updating a dashboard template in json format with PowerShell? in Splunk AppDynamics</title>
    <link>https://community.splunk.com/t5/Splunk-AppDynamics/Updating-a-dashboard-template-in-json-format-with-PowerShell/m-p/724664#M4324</link>
    <description>&lt;P&gt;Question about working with Json data.&lt;/P&gt;

&lt;P&gt;So I have a template file that is in json format that I need to work with.&lt;/P&gt;
&lt;P&gt;Within that Json file there are a bunch of different "widgets". Within each widget, there is a listing of "entity" names, one per server (but invalid servers that need removed and replaced with this script).&lt;/P&gt;

&lt;DIV class="text_exposed_show"&gt;
&lt;P&gt;I need to import this json file. Go into each widget. Look at the formatting of the existing entities, save that. Remove all the existing entities. Then add an entity for each server in my serverlist using the formatting template I saved.&lt;/P&gt;

&lt;P&gt;The entities I need to remove are deep into the file, so that may throw a cog into this.&lt;/P&gt;
&lt;P&gt;I have attached a screenshot of the entities that need to come out, you can see they are under .entityNames within each widget.&lt;/P&gt;

&lt;P&gt;Any tips or suggestions would be helpful. I've been researching myself online.&lt;/P&gt;
&lt;P&gt;The following text can be copied and pasted into your code editor:&lt;/P&gt;

&lt;P&gt;# So far I'm able to successfully import my json data using this code&lt;BR /&gt;$jsoninput = Get-Content -Path "$thisfolder\APPD-DASHBOARD-GENERATOR.input.json" | ConvertFrom-Json&lt;BR /&gt;# I then run a foreach against each widget found within the json.&lt;BR /&gt;foreach ($widget in $jsoninput.widgetTemplates)&lt;BR /&gt;{&lt;BR /&gt;# I then look up the first entity in the widget, I'm going to use this as a template later.&lt;BR /&gt;$first1 = $widget.dataSeriesTemplates.metricMatchCriteriaTemplate.entityMatchCriteria.entityNames| Select-Object -First 1&lt;BR /&gt;# I then need a method for removing each of the existing entities found...&lt;BR /&gt;foreach ($entity in $widget.dataSeriesTemplates.metricMatchCriteriaTemplate.entityMatchCriteria.entityNames)&lt;BR /&gt;{&lt;BR /&gt;!!! Not sure what to do here !!!&lt;BR /&gt;}&lt;BR /&gt;# I then need a method for adding an entry for each server found in the server list.&lt;BR /&gt;foreach ($server in $servers)&lt;BR /&gt;{&lt;BR /&gt;# I have this template from earlier&lt;BR /&gt;$first1&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;}&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;}&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2019-03-06 13_09_00-mRemoteNG - mRemoteNG Data File 2019-02-06.xml - vm-as-tsc.png" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image.png"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/35038i90A45854F2AAF1A5/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;/DIV&gt;</description>
    <pubDate>Wed, 06 Mar 2019 19:14:33 GMT</pubDate>
    <dc:creator>Jonathan_Barrow</dc:creator>
    <dc:date>2019-03-06T19:14:33Z</dc:date>
    <item>
      <title>Updating a dashboard template in json format with PowerShell?</title>
      <link>https://community.splunk.com/t5/Splunk-AppDynamics/Updating-a-dashboard-template-in-json-format-with-PowerShell/m-p/724664#M4324</link>
      <description>&lt;P&gt;Question about working with Json data.&lt;/P&gt;

&lt;P&gt;So I have a template file that is in json format that I need to work with.&lt;/P&gt;
&lt;P&gt;Within that Json file there are a bunch of different "widgets". Within each widget, there is a listing of "entity" names, one per server (but invalid servers that need removed and replaced with this script).&lt;/P&gt;

&lt;DIV class="text_exposed_show"&gt;
&lt;P&gt;I need to import this json file. Go into each widget. Look at the formatting of the existing entities, save that. Remove all the existing entities. Then add an entity for each server in my serverlist using the formatting template I saved.&lt;/P&gt;

&lt;P&gt;The entities I need to remove are deep into the file, so that may throw a cog into this.&lt;/P&gt;
&lt;P&gt;I have attached a screenshot of the entities that need to come out, you can see they are under .entityNames within each widget.&lt;/P&gt;

&lt;P&gt;Any tips or suggestions would be helpful. I've been researching myself online.&lt;/P&gt;
&lt;P&gt;The following text can be copied and pasted into your code editor:&lt;/P&gt;

&lt;P&gt;# So far I'm able to successfully import my json data using this code&lt;BR /&gt;$jsoninput = Get-Content -Path "$thisfolder\APPD-DASHBOARD-GENERATOR.input.json" | ConvertFrom-Json&lt;BR /&gt;# I then run a foreach against each widget found within the json.&lt;BR /&gt;foreach ($widget in $jsoninput.widgetTemplates)&lt;BR /&gt;{&lt;BR /&gt;# I then look up the first entity in the widget, I'm going to use this as a template later.&lt;BR /&gt;$first1 = $widget.dataSeriesTemplates.metricMatchCriteriaTemplate.entityMatchCriteria.entityNames| Select-Object -First 1&lt;BR /&gt;# I then need a method for removing each of the existing entities found...&lt;BR /&gt;foreach ($entity in $widget.dataSeriesTemplates.metricMatchCriteriaTemplate.entityMatchCriteria.entityNames)&lt;BR /&gt;{&lt;BR /&gt;!!! Not sure what to do here !!!&lt;BR /&gt;}&lt;BR /&gt;# I then need a method for adding an entry for each server found in the server list.&lt;BR /&gt;foreach ($server in $servers)&lt;BR /&gt;{&lt;BR /&gt;# I have this template from earlier&lt;BR /&gt;$first1&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;}&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;}&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2019-03-06 13_09_00-mRemoteNG - mRemoteNG Data File 2019-02-06.xml - vm-as-tsc.png" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image.png"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/35038i90A45854F2AAF1A5/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Wed, 06 Mar 2019 19:14:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-AppDynamics/Updating-a-dashboard-template-in-json-format-with-PowerShell/m-p/724664#M4324</guid>
      <dc:creator>Jonathan_Barrow</dc:creator>
      <dc:date>2019-03-06T19:14:33Z</dc:date>
    </item>
    <item>
      <title>Re: Updating a dashboard template in json format with PowerShell?</title>
      <link>https://community.splunk.com/t5/Splunk-AppDynamics/Updating-a-dashboard-template-in-json-format-with-PowerShell/m-p/724665#M4325</link>
      <description>&lt;P&gt;It's possible to do this, but I don't know powershell &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; . I do this with a shell script, using sed to replace the entity names.&amp;nbsp; If you have the option of running this on a UNIX host I can send you an example of a script.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Mar 2019 15:47:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-AppDynamics/Updating-a-dashboard-template-in-json-format-with-PowerShell/m-p/724665#M4325</guid>
      <dc:creator>Carl_Brahms</dc:creator>
      <dc:date>2019-03-28T15:47:06Z</dc:date>
    </item>
  </channel>
</rss>

