Lijsten de metrische naamruimten voor de resource.
GET https://management.azure.com/{resourceUri}/providers/microsoft.insights/metricNamespaces?api-version=2017-12-01-preview
Met optionele parameters:
GET https://management.azure.com/{resourceUri}/providers/microsoft.insights/metricNamespaces?api-version=2017-12-01-preview&startTime={startTime}
URI-parameters
Name |
In |
Vereist |
Type |
Description |
resourceUri
|
path |
True
|
string
|
De id van de resource.
|
api-version
|
query |
True
|
string
minLength: 1
|
De API-versie die voor deze bewerking moet worden gebruikt.
|
startTime
|
query |
|
string
|
De ISO 8601 voldoet aan de begintijd van de datum vanaf waaruit metrische naamruimten moeten worden opgevraagd.
|
Antwoorden
Name |
Type |
Description |
200 OK
|
MetricNamespaceCollection
|
Geslaagde aanvraag om de lijst met metrische naamruimten op te halen
|
Other Status Codes
|
ErrorResponse
|
Foutreactie waarin wordt beschreven waarom de bewerking is mislukt.
|
Beveiliging
azure_auth
Azure Active Directory OAuth2-stroom
Type:
oauth2
Stroom:
implicit
Autorisatie-URL:
https://login.microsoftonline.com/common/oauth2/authorize
Bereiken
Name |
Description |
user_impersonation
|
Uw gebruikersaccount imiteren
|
Voorbeelden
Get Metric Namespaces without filter
Voorbeeldaanvraag
GET https://management.azure.com/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricNamespaces?api-version=2017-12-01-preview&startTime=2020-08-31T15:53:00Z
/**
* Samples for MetricNamespaces List.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/monitor/resource-manager/Microsoft.Insights/preview/2017-12-01-preview/examples/GetMetricNamespaces
* .json
*/
/**
* Sample code: Get Metric Namespaces without filter.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void getMetricNamespacesWithoutFilter(com.azure.resourcemanager.AzureResourceManager azure) {
azure.diagnosticSettings().manager().serviceClient().getMetricNamespaces().list(
"subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill",
"2020-08-31T15:53:00Z", 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.monitor import MonitorManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-monitor
# USAGE
python get_metric_namespaces.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 = MonitorManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.metric_namespaces.list(
resource_uri="subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill",
)
for item in response:
print(item)
# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2017-12-01-preview/examples/GetMetricNamespaces.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 armmonitor_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2017-12-01-preview/examples/GetMetricNamespaces.json
func ExampleMetricNamespacesClient_NewListPager() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmonitor.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewMetricNamespacesClient().NewListPager("subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill", &armmonitor.MetricNamespacesClientListOptions{StartTime: to.Ptr("2020-08-31T15:53:00Z")})
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.MetricNamespaceCollection = armmonitor.MetricNamespaceCollection{
// Value: []*armmonitor.MetricNamespace{
// {
// Name: to.Ptr("Azure.ApplicationInsights"),
// Type: to.Ptr("Microsoft.Insights/metricNamespaces"),
// Classification: to.Ptr(armmonitor.NamespaceClassificationCustom),
// ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricNamespaces/Azure.ApplicationInsights"),
// Properties: &armmonitor.MetricNamespaceName{
// MetricNamespaceName: to.Ptr("Azure.ApplicationInsights"),
// },
// },
// {
// Name: to.Ptr("microsoft.insights-components"),
// Type: to.Ptr("Microsoft.Insights/metricNamespaces"),
// Classification: to.Ptr(armmonitor.NamespaceClassificationPlatform),
// ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricNamespaces/microsoft.insights-components"),
// Properties: &armmonitor.MetricNamespaceName{
// MetricNamespaceName: to.Ptr("microsoft.insights/components"),
// },
// }},
// }
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { MonitorClient } = require("@azure/arm-monitor");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Lists the metric namespaces for the resource.
*
* @summary Lists the metric namespaces for the resource.
* x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2017-12-01-preview/examples/GetMetricNamespaces.json
*/
async function getMetricNamespacesWithoutFilter() {
const subscriptionId =
process.env["MONITOR_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceUri =
"subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill";
const startTime = "2020-08-31T15:53:00Z";
const options = { startTime };
const credential = new DefaultAzureCredential();
const client = new MonitorClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.metricNamespaces.list(resourceUri, options)) {
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
Voorbeeldrespons
{
"value": [
{
"id": "/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricNamespaces/Azure.ApplicationInsights",
"name": "Azure.ApplicationInsights",
"type": "Microsoft.Insights/metricNamespaces",
"classification": "Custom",
"properties": {
"metricNamespaceName": "Azure.ApplicationInsights"
}
},
{
"id": "/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricNamespaces/microsoft.insights-components",
"name": "microsoft.insights-components",
"type": "Microsoft.Insights/metricNamespaces",
"classification": "Platform",
"properties": {
"metricNamespaceName": "microsoft.insights/components"
}
}
]
}
Definities
ErrorResponse
Object
Beschrijft de indeling van foutreactie.
Name |
Type |
Description |
code
|
string
|
Foutcode
|
message
|
string
|
Foutbericht dat aangeeft waarom de bewerking is mislukt.
|
MetricNamespace
Object
Metrische naamruimteklasse geeft de metagegevens voor een metrische naamruimte op.
Name |
Type |
Description |
classification
|
NamespaceClassification
|
Soort naamruimte
|
id
|
string
|
De id van de metrische naamruimte.
|
name
|
string
|
De naam met escape van de naamruimte.
|
properties
|
MetricNamespaceName
|
Eigenschappen die de volledig gekwalificeerde naamruimtenaam bevatten.
|
type
|
string
|
Het type van de naamruimte.
|
MetricNamespaceCollection
Object
Vertegenwoordigt een verzameling metrische naamruimten.
Name |
Type |
Description |
value
|
MetricNamespace[]
|
De waarden voor de metrische naamruimten.
|
MetricNamespaceName
Object
De volledig gekwalificeerde naam van de metrische naamruimte.
Name |
Type |
Description |
metricNamespaceName
|
string
|
De naam van de metrische naamruimte.
|
NamespaceClassification
Inventarisatie
Soort naamruimte
Waarde |
Description |
Custom
|
|
Platform
|
|
Qos
|
|