SuperAPI AI 工具集

azure-observability

部署与运维

查看项目

更新于 10-15 08:33

技能介绍

用途

Azure Observability 是微软 Azure Skills 中专注于可观测性的一组技能,用于在 Azure 平台上进行监控、日志查询、应用性能追踪与告警管理等操作。它把 Azure Monitor、Application Insights、Log Analytics、Alerts、Workbooks 等服务的常见操作集中在一处,方便通过 MCP 工具或 Azure CLI 调用。

覆盖的服务

资料中列出的服务及其适用场景如下:

  • Azure Monitor:用于指标、告警和仪表板,对应 MCP 工具 azure__monitor,CLI 为 az monitor。
  • Application Insights:用于 APM 与分布式追踪,对应 MCP 工具 azure__applicationinsights,CLI 为 az monitor app-insights。
  • Log Analytics:用于日志查询与 KQL,对应 MCP 工具 azure__kusto,CLI 为 az monitor log-analytics。
  • Alerts:用于通知与操作,无对应 MCP 工具,CLI 为 az monitor alert。
  • Workbooks:用于交互式报表,对应 MCP 工具 azure__workbooks,CLI 未提供。

使用方式

MCP 服务(首选)

当 Azure MCP 启用时,可使用以下工具与命令:

  • Monitor:azure__monitor 的 monitor_metrics_query 命令用于查询指标;monitor_logs_query 命令用于以 KQL 查询日志。
  • Application Insights:azure__applicationinsights 的 applicationinsights_component_list 命令用于列出 App Insights 资源。
  • Log Analytics:azure__kusto 的 kusto_cluster_list 命令用于列出集群;kusto_query 命令用于执行 KQL 查询。

若 Azure MCP 未启用,可运行 /azure:setup 或通过 /mcp 启用。

CLI 参考

资料给出的 CLI 命令包括:

列出 Log Analytics 工作区:

az monitor log-analytics workspace list --output table

使用 KQL 查询日志:

az monitor log-analytics query \
  --workspace WORKSPACE_ID \
  --analytics-query "AzureActivity | take 10"

列出 Application Insights:

az monitor app-insights component list --output table

列出告警:

az monitor alert list --output table

查询指标:

az monitor metrics list \
  --resource RESOURCE_ID \
  --metric "Percentage CPU"

常用 KQL 查询

资料提供了三个 KQL 示例。

最近错误:

AppExceptions
| where TimeGenerated > ago(1h)
| project TimeGenerated, Message, StackTrace
| order by TimeGenerated desc

请求性能:

AppRequests
| where TimeGenerated > ago(1h)
| summarize avg(DurationMs), count() by Name
| order by avg_DurationMs desc

资源使用:

AzureMetrics
| where TimeGenerated > ago(1h)
| where MetricName == "Percentage CPU"
| summarize avg(Average) by Resource

监控策略

资料给出的监控建议为:应用错误使用 App Insights 的 Exceptions、failed requests;性能使用 App Insights 的 Response time、dependencies;基础设施使用 Azure Monitor 的 CPU、memory、disk;安全使用 Log Analytics 的 Sign-ins、audit logs;成本使用 Cost Management 的 Budget alerts。

SDK 快速参考

资料提到以编程方式访问监控服务时可参考浓缩版 SDK 指南:OpenTelemetry(Python | TypeScript | Python Exporter)、Monitor Query(Python | Java)、Log Ingestion(Python | Java)、App Insights Mgmt(.NET)。

服务详情与延伸

资料列出深入文档方向:Application Insights 设置指向 appinsights-instrumentation 技能;KQL 查询模式指向 Log Analytics KQL 文档;告警配置指向 Azure Monitor alerts 文档。

限制

关于该技能的收费、价格、具体平台支持范围以及未在资料中明确的使用前提,资料暂未提供。