К основному содержанию
скилл CX Codex

infrastructure — скилл для Claude Code: что делает и как установить

Настраивает передачу метрик, логов и трейсов из Kubernetes, Linux-хостов и облаков в Grafana Cloud. Пригодится при подключении кластеров и виртуалок.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add grafana/skills --skill infrastructure -a claude-code
Открыть на GitHub

Что делает infrastructure

Скилл помогает развернуть сбор телеметрии в Grafana Cloud. Для кластеров Kubernetes используется Helm-чарт grafana/k8s-monitoring с компонентами kube-state-metrics, node-exporter и cAdvisor. На отдельных серверах Linux настраивается агент Alloy с модулем prometheus.exporter.unix.

Также скилл готовит конфигурацию датасорсов для CloudWatch, Azure Monitor и Google Cloud Monitoring. Внутри есть примеры PromQL и LogQL для проверки доставки данных в Prometheus и Loki, а также номера готовых дашбордов Grafana: 1860, 15520 и 14282.

Для старта нужен стек Grafana Cloud с эндпоинтами и API-ключом с правами metrics:write, logs:write и traces:write. Если node-exporter падает в CrashLoopBackOff, обычно мешает конфликт порта :9100 из-за hostNetwork: true.

Какие задачи решает

  • развернуть чарт k8s-monitoring в кластере через helm
  • собрать метрики и логи с Linux-сервера через Alloy
  • подключить сбор метрик из CloudWatch, Azure Monitor или Google Cloud Monitoring
  • настроить алерты на PodCrashLooping и нехватку памяти узла

Примеры запросов агенту

  • Настрой сбор метрик и логов с нашего Kubernetes-кластера в Grafana Cloud через k8s-monitoring
  • Сконфигурируй Alloy на сервере Linux для отправки метрик node-exporter в Grafana
  • Помоги подключить метрики EC2 из AWS CloudWatch в дашборды Grafana

Как установить infrastructure

1Через Skills CLI (Vercel)

npx skills add grafana/skills --skill infrastructure -a claude-code

2Вручную: положить файлы

~/.claude/skills/infrastructure/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/infrastructure/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о infrastructure

Как установить infrastructure в Claude Code?

Выполните команду npx skills add grafana/skills --skill infrastructure -a claude-code. Файлы скилла сохранятся в путь ~/.claude/skills/infrastructure/SKILL.md.

Что делает скилл infrastructure?

Он даёт агенту инструкции по отправке телеметрии в Grafana Cloud. Сюда входят параметры Helm-чарта k8s-monitoring, конфиг Alloy для Linux-хостов и настройки облачных источников данных.

Что потребуется подготовить перед настройкой?

Нужен активный стек Grafana Cloud и API-ключ с правами metrics:write, logs:write и traces:write. Для кластера понадобятся helm 3.x и настроенный контекст kubectl.

Исходный текст

SKILL.md · Apache-2.0
---
name: infrastructure
license: Apache-2.0
description: Ship Kubernetes, host, container, and cloud-provider telemetry into Grafana Cloud — `k8s-monitoring` Helm chart for K8s clusters (metrics + logs + traces + events + cost), Alloy `prometheus.exporter.unix` for Linux hosts, cAdvisor + Docker discovery for containers, and CloudWatch / Azure Monitor / Google Cloud Monitoring datasource setup. Use when onboarding a new cluster or VM fleet to Grafana Cloud, picking the right Helm values for K8s scraping, wiring kube-state-metrics + node-exporter + cAdvisor, alerting on `PodCrashLooping` / node memory / PVC capacity, or pulling AWS / Azure / GCP cloud metrics — even when the user says "monitor my cluster", "send K8s metrics to Grafana", "scrape EC2 metrics", "cluster pod logs", or "install the monitoring helm chart" without naming `k8s-monitoring` or Alloy.
---

# Grafana Cloud Infrastructure Monitoring

> **Docs**: https://grafana.com/docs/grafana-cloud/monitor-infrastructure/

K8s + host + container + cloud-provider telemetry, mostly via the `grafana/k8s-monitoring` Helm chart or Alloy.

## Prerequisites

- Grafana Cloud stack with Prometheus / Loki / Tempo endpoints + API key (`metrics:write`, `logs:write`, `traces:write`)
- For Kubernetes: a cluster + `helm` 3.x + `kubectl` context pointing at it
- For hosts / Docker: Alloy installed on the node

## Common Workflows

### 1. Onboard a Kubernetes cluster (k8s-monitoring chart)

```bash
# 1. Create the namespace + secret
kubectl create namespace monitoring
kubectl create secret generic grafana-cloud-secret \
  -n monitoring --from-literal=api-key=<your-api-key>

# 2. Install — values.yaml in references/k8s-monitoring-values.md
helm repo add grafana https://grafana.github.io/helm-charts && helm repo update
helm install k8s-monitoring grafana/k8s-monitoring \
  --version 4.1.4 -n monitoring -f values.yaml

# 3. Verify every pod is Running
kubectl get pods -n monitoring
# Expect alloy-*, kube-state-metrics-*, node-exporter-*, etc. all Ready.

# 4. Verify no error logs in the metrics/logs/traces Alloys
kubectl -n monitoring logs deploy/k8s-monitoring-alloy-metrics --tail=50 | grep -iE 'error|level=err' || echo "clean"

# 5. Verify telemetry landed in Grafana Cloud
#    PromQL on the metrics datasource (should be > 0):
#      sum(up{cluster="production-us-east"})
#    LogQL on Loki:
#      sum(count_over_time({cluster="production-us-east"}[5m]))
```

Full `values.yaml`, key PromQL, dashboard IDs (15520, 1860, 14282…), and alert rules: [`references/k8s-monitoring-values.md`](references/k8s-monitoring-values.md).

### 2. Monitor a Linux host

```alloy
# 1. /etc/alloy/config.alloy — see references/clouds-and-hosts.md for the full block
prometheus.exporter.unix "host"  { rootfs_path = "/" }
prometheus.scrape         "node" { targets = prometheus.exporter.unix.host.targets
                                   forward_to = [prometheus.remote_write.cloud.receiver] }
```

```bash
# 2. Reload Alloy and verify the unix exporter is up
systemctl reload alloy
curl -s http://localhost:12345/api/v0/web/components | jq '.[] | select(.id|contains("prometheus.exporter.unix"))'

# 3. Verify in Grafana Cloud — open the "Node Exporter Full" dashboard (ID 1860)
#    and pick your host from the `instance` dropdown.
```

### 3. Pull AWS / Azure / GCP metrics

Provision the datasource (full YAML in [`references/clouds-and-hosts.md`](references/clouds-and-hosts.md)), then:

```bash
# 1. After provisioning, restart Grafana to pick up the file
# 2. Verify the datasource — Grafana → Connections → Data sources → "Test"
#    Expect "Successfully queried the CloudWatch metrics API" (or equivalent).
# 3. Confirm a query — Explore → datasource → metric e.g.
#    CloudWatch namespace AWS/EC2 metric CPUUtilization, last 1h.
```

## Troubleshooting

- chart installed but no metrics in Cloud → check the `grafana-cloud-secret` `api-key` value; check Alloy logs for `401`
- `kube-state-metrics` pod Pending → likely RBAC; reapply the chart's CRDs/CRBs
- Node-exporter pod CrashLoopBackOff → typically `hostNetwork: true` collision with the host's :9100; change the port
- CloudWatch "Access denied" → IAM role missing `cloudwatch:GetMetricData`, `cloudwatch:ListMetrics`

## Resources

- [`grafana/k8s-monitoring` chart](https://github.com/grafana/k8s-monitoring-helm)
- [Monitor Infrastructure docs](https://grafana.com/docs/grafana-cloud/monitor-infrastructure/)
- [CloudWatch datasource](https://grafana.com/docs/grafana/latest/datasources/aws-cloudwatch/)
- [Azure Monitor datasource](https://grafana.com/docs/grafana/latest/datasources/azure-monitor/)
- [Google Cloud Monitoring datasource](https://grafana.com/docs/grafana/latest/datasources/google-cloud-monitoring/)

© grafana · Apache-2.0 · grafana/skills

Похожие скиллы

Всё по теме «DevOps и инфраструктура» →
prometheus-grafana devops-skills Скилл помогает агенту поднять сбор метрик в Prometheus, писать запросы PromQL и собирать панели Grafana. Пригодится, когда в проект нужно добавить мониторинг. CX Codex +1 449установок monitoring-observability ahmedasmar Скилл для настройки мониторинга и наблюдаемости: стратегия метрик, алерты, дашборды, SLO и разбор инцидентов. CX Codex +1 493установок grafana-dashboards Seth Hobson Скилл помогает создавать Grafana-дашборды для метрик систем и приложений. Подойдёт для мониторинга, SLO и операционных интерфейсов наблюдаемости. CX Codex 13 097установок loki-config-generator akin-ozer Генерирует рабочие конфигурации Grafana Loki и Helm values под S3, GCS, Azure или локальный диск. Помогает развернуть кластер логов без ручного подбора параметров schema и ingester. CX Codex +1 580установок slo-implementation Seth Hobson Помогает задать измеримые цели надёжности, считать запас ошибок и настраивать оповещения. Пригодится, когда нужно отслеживать доступность и задержку сервиса. CX Codex 10 400установок qdrant-monitoring qdrant Скилл подсказывает, как настроить мониторинг Qdrant и разобраться с зависшим оптимизатором, ростом памяти или медленными запросами. CX Codex +1 1 500установок

Из того же набора47

tempo Скилл для развёртывания Grafana Tempo и написания запросов TraceQL: от локального Docker Compose до Helm в Kubernetes. CX Codex +1 4 900установок pyroscope Скилл для непрерывного профилирования приложений через Grafana Pyroscope: флейм-графы CPU, памяти и аллокаций прямо в диалоге с агентом. CX Codex +1 4 700установок beyla Автоматически подключает eBPF-мониторинг HTTP, gRPC и баз данных через Grafana Beyla без изменения кода. Пригодится для сбора трейсов и RED-метрик с готовых бинарников. CX Codex +1 4 700установок app-observability Ведёт агента по настройке Grafana Cloud: RED-метрики из OTel-трейсов, карты сервисов, браузерный RUM через Faro и наблюдение за вызовами LLM. CX Codex +1 4 400установок dpm-finder Скилл помогает найти метрики Prometheus с наибольшим числом точек в минуту в Grafana Cloud и выявить причины растущих расходов на мониторинг. CX Codex +1 4 200установок oncall-irm Помогает агенту настроить маршрутизацию алертов, дежурные ротации и жизненный цикл инцидентов в Grafana IRM / OnCall. CX Codex +1 4 200установок send-data Помогает настроить отправку метрик, логов, трейсов и профилей в Grafana Cloud. Пригодится при настройке Alloy, OTLP-экспортёров, Prometheus remote write и Helm-чартов. CX Codex +1 4 200установок fleet-management Скилл для управления парком коллекторов Grafana Alloy: один раз описать пайплайн, раскатать его на нужные коллекторы по атрибутам и без перезапуска. CX Codex +1 4 200установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой