How to get server name in runbook triggered by alert?

Jonathan Posey 0 Reputation points
2024-07-15T21:32:55.55+00:00

I used this link learn how to trigger a runbook with an alert for a certain metric threshold on an ARC server.

https://learn.microsoft.com/en-us/azure/automation/automation-create-alert-triggered-runbook

It works, but I can't seem to find which value in the payload can identify the machine. On that same alert, I have an email alert, and in that it tells me the machine. But where in the payload would that info be here in the runbook?

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
3,462 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Stanislav Zhelyazkov 26,096 Reputation points MVP
    2024-07-16T05:49:55.4033333+00:00

    Hi,

    This depends on the alert type. Also if it is Log alert depends on how it is configured. You can find more information on common alert schema. If it is a metric alert property alertTargetIDs contains the resource ID of the resource. If it is Log Alert v2 the alert needs to be configured with dimension _ResourceId and the dimension and its value will appear in alertContext.condition.allOf[0].dimensions[x].value where x is the number of the dimension for _ResourceId. You could configure another column for dimension if you want but in Azure it is best to work with Resource IDs as those are unique even if you have for some reason two servers with the same name.

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.