关于 azure-observability
azure-observability 是面向 Azure 监控与故障排查的技能,适用于需要查看指标、应用性能、日志和告警的运维及开发人员。它汇总 Azure Monitor、Application Insights、Log Analytics、Alerts 和 Workbooks 的 MCP 工具与 CLI 用法,并提供常见 KQL 查询示例。
主要功能
- 01查询指标与日志
- 02查看应用性能和分布式追踪
- 03使用 KQL 查询日志
- 04管理告警与交互式报告
- 05提供常见监控策略
适用场景
- 01排查应用异常和失败请求
- 02分析响应时间与依赖
- 03检查基础设施资源指标
- 04查询安全审计日志
MCP 相关
Azure MCP 启用时,技能优先使用其工具查询 Azure Monitor 指标和日志、列出 Application Insights 资源,以及列出 Kusto 集群并执行 KQL 查询。
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ microsoft/ azure-skills --skill azure-observability安装后在 Claude Code 中输入/azure-observability确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
references/auth-best-practices.mdreferences/sdk/azure-mgmt-applicationinsights-dotnet.mdazure-monitor-ingestion-java.mdazure-monitor-ingestion-py.mdazure-monitor-opentelemetry-exporter-py.mdazure-monitor-opentelemetry-py.mdazure-monitor-opentelemetry-ts.mdazure-monitor-query-java.mdazure-monitor-query-py.md详细介绍
Azure 可观测性服务
服务
| 服务 | 适用场景 | MCP 工具 | CLI |
|---|---|---|---|
| Azure Monitor | 指标、警报、仪表板 | azure__monitor | az monitor |
| Application Insights | APM、分布式跟踪 | azure__applicationinsights | az monitor app-insights |
| Log Analytics | 日志查询、KQL | azure__kusto | az monitor log-analytics |
| Alerts | 通知、操作 | - | az monitor alert |
| Workbooks | 交互式报告 | azure__workbooks | - |
MCP 服务(首选)
启用 Azure MCP 后:
Monitor
azure__monitor,命令为monitor_metrics_query- 查询指标azure__monitor,命令为monitor_logs_query- 使用 KQL 查询日志
Application Insights
azure__applicationinsights,命令为applicationinsights_component_list- 列出 App Insights 资源
Log Analytics
azure__kusto,命令为kusto_cluster_list- 列出群集azure__kusto,命令为kusto_query- 执行 KQL 查询
如果未启用 Azure MCP: 运行 /azure:setup 或通过 /mcp 启用。
CLI 参考
# List Log Analytics workspaces
az monitor log-analytics workspace list --output table
# Query logs with KQL
az monitor log-analytics query \
--workspace WORKSPACE_ID \
--analytics-query "AzureActivity | take 10"
# List Application Insights
az monitor app-insights component list --output table
# List alerts
az monitor alert list --output table
# Query metrics
az monitor metrics list \
--resource RESOURCE_ID \
--metric "Percentage CPU"
常用 KQL 查询
// Recent errors
AppExceptions
| where TimeGenerated > ago(1h)
| project TimeGenerated, Message, StackTrace
| order by TimeGenerated desc
// Request performance
AppRequests
| where TimeGenerated > ago(1h)
| summarize avg(DurationMs), count() by Name
| order by avg_DurationMs desc
// Resource usage
AzureMetrics
| where TimeGenerated > ago(1h)
| where MetricName == "Percentage CPU"
| summarize avg(Average) by Resource
监控策略
| 监控对象 | 服务 | 指标/日志 |
|---|---|---|
| 应用程序错误 | App Insights | 异常、失败请求 |
| 性能 | App Insights | 响应时间、依赖项 |
| 基础设施 | Azure Monitor | CPU、内存、磁盘 |
| 安全性 | Log Analytics | 登录、审核日志 |
| 成本 | Cost Management | 预算警报 |
SDK 快速参考
如需以编程方式访问监控服务,请参阅精简版 SDK 指南:
- OpenTelemetry:Python | TypeScript | Python 导出器
- Monitor Query:Python | Java
- 日志引入:Python | Java
- App Insights 管理:.NET
服务详情
如需特定服务的详细文档:
- Application Insights 设置 ->
appinsights-instrumentation技能 - KQL 查询模式 -> Log Analytics KQL 文档
- 警报配置 -> Azure Monitor 警报文档
评论
支持 Markdown