审核Azure文件存储服务

时间:2018-08-10 09:33:14

标签: azure-storage azure-storage-files

据记录,Storage Analytics日志记录当前不适用于文件存储服务。

  

存储分析指标适用于Blob,队列,表,   和文件服务。

     

存储分析日志记录可用于Blob,队列和表   服务。

https://docs.microsoft.com/en-us/rest/api/storageservices/enabling-and-configuring-storage-analytics

知道这一点,我希望可以通过指标来确定文件服务的使用情况,但是我无法隔离我可以最终认为是文件使用情况的东西。容量似乎并没有增加,并且我无法将入口/出口隔离为仅用于文件。

如何最好地审核文件使用情况?

1 个答案:

答案 0 :(得分:1)

有一种变通办法可以获取有关存储服务(特别是Azure文件)的指标/分析。到目前为止,它还没有在存储分析中。 .net SDK中有一个选项,使您可以查看不同的指标。虽然,您必须使用资源ID,但这是通过Azure Storage Metrics完成的:

如果要列出blob,表,文件或队列的度量标准定义,则必须使用API​​为每个服务指定不同的资源ID。

代码示例:

  public static async Task ListStorageMetricDefinition()
    {
        // Resource ID for storage account
        var resourceId = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{storageAccountName}";
        var subscriptionId = "{SubscriptionID}";
        // How to identify Tenant ID, Application ID and Access Key: https://azure.microsoft.com/documentation/articles/resource-group-create-service-principal-portal/
        var tenantId = "{TenantID}";
        var applicationId = "{ApplicationID}";
        var accessKey = "{AccessKey}";

        // Using metrics in Azure Monitor is currently free. However, if you use additional solutions ingesting metrics data, you may be billed by these solutions. For example, you are billed by Azure Storage if you archive metrics data to an Azure Storage account. Or you are billed by Operation Management Suite (OMS) if you stream metrics data to OMS for advanced analysis.
        MonitorClient readOnlyClient = AuthenticateWithReadOnlyClient(tenantId, applicationId, accessKey, subscriptionId).Result;
        IEnumerable<MetricDefinition> metricDefinitions = await readOnlyClient.MetricDefinitions.ListAsync(resourceUri: resourceId, cancellationToken: new CancellationToken());

        foreach (var metricDefinition in metricDefinitions)
        {
            //Enumrate metric definition:
            //    Id
            //    ResourceId
            //    Name
            //    Unit
            //    MetricAvailabilities
            //    PrimaryAggregationType
            //    Dimensions
            //    IsDimensionRequired
        }
    }

来源: Azure Storage metrics in Azure Monitor

您还可以通过以下门户网站进行操作:

enter image description here