0

Is there a way to create a problem metric in Dynatrace using a shell script that can be executed from the Linux server?

Here, Problem metric means,

Let's assume that we are using a shell script to check the status of deployed services on the Linux Server.

Then,

  1. That Shell Script should be able to be called by Dynatrace
  2. And, based on Shell Script's response, should be able to create Problem.

2 Answers 2

1

What do you mean by 'problem metric'?

You can create metrics via the Metric API and Problems via the Events API

You can call either endpoint from a shell script on linux. If there is a OneAgent on the system you could also use an extension.

3
  • Hi Pabi, Thanks. I have updated the question. Could you please check that again?
    – Milinda
    Commented Sep 1, 2022 at 10:07
  • 1
    The easiest way would be with a oneagent extension, that is also the only way you can get dynatrace to actively call the shell script. You could also implement the shell script logic in the extension then though. Or you can just schedule the shell script another way, e.g. via cron, an create the problems via the Events API I mentioned, directly from the script.
    – Pabi
    Commented Sep 1, 2022 at 11:59
  • Yes Pabi, I thought the same way will try
    – Milinda
    Commented Sep 2, 2022 at 4:37
-1

Refer to this official documentation

if from_date == "-1d":
    timestamp = datetime.utcnow().strftime('%m/%d/%Y %H:%M UTC')
else:
    days_ago = int(from_date[1:-1])  # Extract the number of days from "-Xd"
    timestamp = (datetime.utcnow() - timedelta(days=days_ago)).strftime('%m/%d/%Y %H:%M UTC')
0

Not the answer you're looking for? Browse other questions tagged or ask your own question.