<?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 How to integrate a javascript with DT Synthetic monitor as a post HTTP Monitor in Synthetic Monitoring</title>
    <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/How-to-integrate-a-javascript-with-DT-Synthetic-monitor-as-a/m-p/115749#M251</link>
    <description>&lt;P&gt;We have requirement where we need to run some sample shell scripts using Dynatrace synthetic http monitor and if there is a failure, augment it using the Ansible Integration provided in DT&lt;/P&gt;&lt;P&gt;I understand, we cannot trigger any shell scripts using DT with a Synthetic Monitor and requires some sort of JavaScript&lt;/P&gt;&lt;P&gt;Is my understanding correct??????&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;If yes, I have converted the shell script to a js script and attached it to the ticket for your review. I have personally run them on the machine and it works as expected. We have nodejs application which a can run the script and throw out the error&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;JavaScript&lt;/STRONG&gt;&lt;BR /&gt;******************************&lt;BR /&gt;const { exec } = require('child_process');&lt;BR /&gt;exec('ls | grep js', (err, stdout, stderr) =&amp;gt; {&lt;!-- --&gt;&lt;BR /&gt;if (err)&lt;/P&gt;&lt;P&gt;{ //some err occurred console.error(err) }&lt;/P&gt;&lt;P&gt;else {&lt;!-- --&gt;&lt;BR /&gt;// the &lt;STRONG&gt;entire&lt;/STRONG&gt; stdout and stderr (buffered)&lt;BR /&gt;console.log(`stdout: ${stdout}`);&lt;BR /&gt;console.log(`stderr: ${stderr}`);&lt;BR /&gt;}&lt;BR /&gt;});&lt;BR /&gt;*********************************&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;node ls.js&lt;/P&gt;&lt;P&gt;stdout: git.js&lt;BR /&gt;ls.js&lt;/P&gt;&lt;P&gt;stderr:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Questions:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;1&amp;gt; How do i execute this as a post script using a Synthetic monitor??&lt;/P&gt;&lt;P&gt;2&amp;gt; Are there any pre-requisites for these to be run on the OneAgent or Cluster Agent Machine&lt;/P&gt;&lt;P&gt;3&amp;gt; If these are really not supported.....What is the DT recommended way to run JS Scripts in post processing??&lt;/P&gt;</description>
    <pubDate>Wed, 12 Aug 2020 17:17:30 GMT</pubDate>
    <dc:creator>anish_anil</dc:creator>
    <dc:date>2020-08-12T17:17:30Z</dc:date>
    <item>
      <title>How to integrate a javascript with DT Synthetic monitor as a post HTTP Monitor</title>
      <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/How-to-integrate-a-javascript-with-DT-Synthetic-monitor-as-a/m-p/115749#M251</link>
      <description>&lt;P&gt;We have requirement where we need to run some sample shell scripts using Dynatrace synthetic http monitor and if there is a failure, augment it using the Ansible Integration provided in DT&lt;/P&gt;&lt;P&gt;I understand, we cannot trigger any shell scripts using DT with a Synthetic Monitor and requires some sort of JavaScript&lt;/P&gt;&lt;P&gt;Is my understanding correct??????&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;If yes, I have converted the shell script to a js script and attached it to the ticket for your review. I have personally run them on the machine and it works as expected. We have nodejs application which a can run the script and throw out the error&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;JavaScript&lt;/STRONG&gt;&lt;BR /&gt;******************************&lt;BR /&gt;const { exec } = require('child_process');&lt;BR /&gt;exec('ls | grep js', (err, stdout, stderr) =&amp;gt; {&lt;!-- --&gt;&lt;BR /&gt;if (err)&lt;/P&gt;&lt;P&gt;{ //some err occurred console.error(err) }&lt;/P&gt;&lt;P&gt;else {&lt;!-- --&gt;&lt;BR /&gt;// the &lt;STRONG&gt;entire&lt;/STRONG&gt; stdout and stderr (buffered)&lt;BR /&gt;console.log(`stdout: ${stdout}`);&lt;BR /&gt;console.log(`stderr: ${stderr}`);&lt;BR /&gt;}&lt;BR /&gt;});&lt;BR /&gt;*********************************&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;node ls.js&lt;/P&gt;&lt;P&gt;stdout: git.js&lt;BR /&gt;ls.js&lt;/P&gt;&lt;P&gt;stderr:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Questions:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;1&amp;gt; How do i execute this as a post script using a Synthetic monitor??&lt;/P&gt;&lt;P&gt;2&amp;gt; Are there any pre-requisites for these to be run on the OneAgent or Cluster Agent Machine&lt;/P&gt;&lt;P&gt;3&amp;gt; If these are really not supported.....What is the DT recommended way to run JS Scripts in post processing??&lt;/P&gt;</description>
      <pubDate>Wed, 12 Aug 2020 17:17:30 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Synthetic-Monitoring/How-to-integrate-a-javascript-with-DT-Synthetic-monitor-as-a/m-p/115749#M251</guid>
      <dc:creator>anish_anil</dc:creator>
      <dc:date>2020-08-12T17:17:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to integrate a javascript with DT Synthetic monitor as a post HTTP Monitor</title>
      <link>https://community.dynatrace.com/t5/Synthetic-Monitoring/How-to-integrate-a-javascript-with-DT-Synthetic-monitor-as-a/m-p/115750#M252</link>
      <description>&lt;P&gt;There was a previous post that goes over a lot of this. I recommend taking a look at it: &lt;A href="https://community.dynatrace.com/questions/242658/view.html" rel="noopener noreferrer" target="_blank"&gt;https://community.dynatrace.com/questions/242658/view.html&lt;/A&gt;  &lt;/P&gt;</description>
      <pubDate>Mon, 16 Oct 2023 14:22:02 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Synthetic-Monitoring/How-to-integrate-a-javascript-with-DT-Synthetic-monitor-as-a/m-p/115750#M252</guid>
      <dc:creator>ChadTurner</dc:creator>
      <dc:date>2023-10-16T14:22:02Z</dc:date>
    </item>
  </channel>
</rss>

