12 Aug 2020 06:17 PM
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??
Solved! Go to Solution.
14 Aug 2020 02:33 PM - last edited on 16 Oct 2023 03:22 PM by random_user
There was a previous post that goes over a lot of this. I recommend taking a look at it: https://community.dynatrace.com/questions/242658/view.html