cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to integrate a javascript with DT Synthetic monitor as a post HTTP Monitor

anish_anil
Newcomer

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

I understand, we cannot trigger any shell scripts using DT with a Synthetic Monitor and requires some sort of JavaScript

Is my understanding correct??????


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

JavaScript
******************************
const { exec } = require('child_process');
exec('ls | grep js', (err, stdout, stderr) => {
if (err)

{ //some err occurred console.error(err) }

else {
// the entire stdout and stderr (buffered)
console.log(`stdout: ${stdout}`);
console.log(`stderr: ${stderr}`);
}
});
*********************************


node ls.js

stdout: git.js
ls.js

stderr:

Questions:

1> How do i execute this as a post script using a Synthetic monitor??

2> Are there any pre-requisites for these to be run on the OneAgent or Cluster Agent Machine

3> If these are really not supported.....What is the DT recommended way to run JS Scripts in post processing??

1 REPLY 1

ChadTurner
Leader

There was a previous post that goes over a lot of this. I recommend taking a look at it: https://answers.dynatrace.com/questions/242658/view.html

-Chad