List the resources currently being monitored by the Datadog monitor resource.
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/listMonitoredResources?api-version=2023-01-01
URI Parameters
Name |
In |
Required |
Type |
Description |
monitorName
|
path |
True
|
string
|
Monitor resource name
|
resourceGroupName
|
path |
True
|
string
|
The name of the resource group. The name is case insensitive.
|
subscriptionId
|
path |
True
|
string
|
The ID of the target subscription.
|
api-version
|
query |
True
|
string
|
The API version to use for this operation.
|
Responses
Examples
Monitors_ListMonitoredResources
Sample request
POST https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Datadog/monitors/myMonitor/listMonitoredResources?api-version=2023-01-01
/** Samples for Monitors ListMonitoredResources. */
public final class Main {
/*
* x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MonitoredResources_List.json
*/
/**
* Sample code: Monitors_ListMonitoredResources.
*
* @param manager Entry point to MicrosoftDatadogManager.
*/
public static void monitorsListMonitoredResources(
com.azure.resourcemanager.datadog.MicrosoftDatadogManager manager) {
manager.monitors().listMonitoredResources("myResourceGroup", "myMonitor", com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.datadog import MicrosoftDatadogClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-datadog
# USAGE
python monitored_resources_list.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = MicrosoftDatadogClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.monitors.list_monitored_resources(
resource_group_name="myResourceGroup",
monitor_name="myMonitor",
)
for item in response:
print(item)
# x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MonitoredResources_List.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armdatadog_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/datadog/armdatadog"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c280892951a9e45c059132c05aace25a9c752d48/specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MonitoredResources_List.json
func ExampleMonitorsClient_NewListMonitoredResourcesPager() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armdatadog.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewMonitorsClient().NewListMonitoredResourcesPager("myResourceGroup", "myMonitor", nil)
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page.MonitoredResourceListResponse = armdatadog.MonitoredResourceListResponse{
// Value: []*armdatadog.MonitoredResource{
// {
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVault"),
// ReasonForLogsStatus: to.Ptr("CapturedByRules"),
// ReasonForMetricsStatus: to.Ptr("CapturedByRules"),
// SendingLogs: to.Ptr(true),
// SendingMetrics: to.Ptr(true),
// }},
// }
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { MicrosoftDatadogClient } = require("@azure/arm-datadog");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to List the resources currently being monitored by the Datadog monitor resource.
*
* @summary List the resources currently being monitored by the Datadog monitor resource.
* x-ms-original-file: specification/datadog/resource-manager/Microsoft.Datadog/stable/2023-01-01/examples/MonitoredResources_List.json
*/
async function monitorsListMonitoredResources() {
const subscriptionId =
process.env["DATADOG_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["DATADOG_RESOURCE_GROUP"] || "myResourceGroup";
const monitorName = "myMonitor";
const credential = new DefaultAzureCredential();
const client = new MicrosoftDatadogClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.monitors.listMonitoredResources(resourceGroupName, monitorName)) {
resArray.push(item);
}
console.log(resArray);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"value": [
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVault",
"sendingMetrics": true,
"reasonForMetricsStatus": "CapturedByRules",
"sendingLogs": true,
"reasonForLogsStatus": "CapturedByRules"
}
]
}
Definitions
ErrorAdditionalInfo
The resource management error additional info.
Name |
Type |
Description |
info
|
object
|
The additional info.
|
type
|
string
|
The additional info type.
|
ErrorDetail
The error detail.
Name |
Type |
Description |
additionalInfo
|
ErrorAdditionalInfo[]
|
The error additional info.
|
code
|
string
|
The error code.
|
details
|
ErrorDetail[]
|
The error details.
|
message
|
string
|
The error message.
|
target
|
string
|
The error target.
|
ErrorResponse
Error response
Name |
Type |
Description |
error
|
ErrorDetail
|
The error object.
|
MonitoredResource
The properties of a resource currently being monitored by the Datadog monitor resource.
Name |
Type |
Description |
id
|
string
|
The ARM id of the resource.
|
reasonForLogsStatus
|
string
|
Reason for why the resource is sending logs (or why it is not sending).
|
reasonForMetricsStatus
|
string
|
Reason for why the resource is sending metrics (or why it is not sending).
|
sendingLogs
|
boolean
|
Flag indicating if resource is sending logs to Datadog.
|
sendingMetrics
|
boolean
|
Flag indicating if resource is sending metrics to Datadog.
|
MonitoredResourceListResponse
Response of a list operation.
Name |
Type |
Description |
nextLink
|
string
|
Link to the next set of results, if any.
|
value
|
MonitoredResource[]
|
Results of a list operation.
|