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

This product reached the end of support date on March 31, 2021.

Generic execution plugin-how to capture the output

sponnada2
Organizer

I have installed the GEP and while running that plugin as task, i can see that task is completed successfully but not able to see the results.Could anyone suggest how to see the output on monitor.DO i need to set up anyhting inorder to capture these results

11 REPLIES 11

gabriel_casella
Dynatrace Pro
Dynatrace Pro

Hi Shyamala,

The main point is to make the script output the results to the console in the same order as the variable names you defined on "Returned Measures", preceded by the string "***ReturnedMeasures:".

Below I share with you a simple example that I have, where I grab some info from the "sensors" command on linux.
It basically capture the return of sensors, parse it and print the parsed data in the same order as I defined in the Returned Measures screen on Dynatrace:

#!/bin/sh
sensors_voltages_fan=$(sensors | awk 'NR>=3 && NR<=11 {print $2}' | sed 's/+//' | tr '\n' ';')
sensors_cooler=$(sensors | awk 'NR==13 {print $2}' | sed 's/+//' | tr '\n' ';')
sensors_temps=$(sensors | awk 'NR>=15 && NR<=17 {print $2}' | sed 's/+//' | tr '\n' ';')
sensors_temps_core=$(sensors | awk 'NR==22 {print $2}' | sed 's/+//' | tr '\n' ';')


# in0;in1;in2;3.3V;in4;in5;in6;3VSB;Vbat;fan1;temp1;temp2;temp3;Core0;
generic_plugin_measures="***ReturnedMeasures:"


echo $generic_plugin_measures$sensors_voltages_fan$sensors_cooler$sensors_temps$ensors_temps_core

Let me know if that helps,

PS.: I'm attaching the script (collector-generic-sensors) as '.txt', but it should have the '.sh' extension.

sponnada2
Organizer

Thanks Gabriel for response.

I am trying the execute the .exe file in GEP. Could you please help me in how to pass parameters for that file.I have gone through some posts in Forum and i have passed the returned mesaures. Please suggest if i am wrong

namespace TestApp1
{
class Program
{
static void Main(string[] args)
{
TestClass obj1 = new TestClass();
obj1.FirstName = "Shyamala";
obj1.LastName = "Ponnada";
string json = JsonConvert.SerializeObject(obj1);
var person = JsonConvert.DeserializeObject<TestClass>(json.ToString());
Console.WriteLine(person.FirstName);
Console.WriteLine(person.LastName);
Console.ReadKey();
}
}

public class TestClass
{
public string LastName { get; set; }
public string FirstName { get; set; }capture.png
}
}

Hi Shyamala, I did not understand what exactly are you trying to do.

Are you trying to pass some parameters from GEP to your exe java code?

Or, are you trying to read the output from your exe (the 'console.WriteLine' code) to GEP, to be able to import inside AppMon?

sponnada2
Organizer

I am trying to get the output from .exe file to GEP

sponnada2
Organizer

Gabriela,

the sample one,you have explained is it for pass some parameters from GEP or reading the output from .sh code to GEP?which one you have suggested earlier

Hy Shyamala,

The example that I gave is to read the output from '.sh' to GEP, as I though from your question that this was your issue. Was that your case?

sponnada2
Organizer

HI Gabriel,

I am also trying to read the output from .exe to GEP. But not able to see any output while executing the GEP. Could you please suggest what modifications does that .exe file need.

Hi Shyamala,

you probably need to add a line similar to this:

Console.WriteLine("***ReturnedMeasures:");

Before the line:

Console.WriteLine(person.FirstName);

so the plugin can know where to start looking for the output.

Later, at the GEP configuration on AppMon client, you will need to check the "Capture Output", and edit the "Returned Measures" to have the same number and order of vars as every new line of your output. If you have problems post your GEP configuration screenshot here.

sponnada2
Organizer

HI Gabriel,

I have added returned measures in .exe code and passed the returned measures in GEP configuration while at the time of execution, i don't see any returned parameters being captured.I have attached all screenshots.please check

Hi,

  1. You probably will not be able to import string metrics into AppMon; You should edit your code and print a number there to make sure it is working.
  2. Your configuration looks fine. I would remove the fields at RC Measure.

Tell me what happens

sponnada2
Organizer

HI Gabriel,

I have modified the code to print the numbers instead of string.But still not able to see any output.