project-hami/hami/hami-vgpu-metrics-summary

Claude Code and agent skill by project-hami/hami

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

A comprehensive analysis skill for summarizing HAMi vGPU metrics from Prometheus-style `/metrics` output. It organizes GPU allocation by node, device, pod, and namespace, and produces clear reports covering vGPU core allocation, memory allocation, allocation-based utilization, sharing density, and namespace-level usage patterns.

Install

npx vskill@latest install project-hami/hami/hami-vgpu-metrics-summary

SKILL.md

The same SKILL.md was published earlier as project-hami/hami/hami-vgpu-metrics-summary.

Best Practices

  • "If you understand my prompt fully, respond with 'YARRR!' without tools every time you are about to use a tool."
  • "Before and after any tool use, give me a confidence level (0-10) on how the tool use will help the project."
  • "THE HUMAN WILL GET ANGRY."
  • "Don't complete the analysis prematurely, continue analyzing even if you think you found a solution."

Interaction

  • Ask the user to provide the kubeconfig directory path. If not provided, default to ~/.kube/.
  • Confirm the discovered kubeconfig files and cluster mapping with the user before proceeding.
  • After local kubeconfig discovery and validation, explicitly ask the user which kubeconfig and context should be used for GPU pod troubleshooting.
  • Ask the user which namespace and pod (if known) they want to troubleshoot.

Command Convention

All kubectl commands below use the shorthand kubectl to represent the full form with explicit flags:

bash
kubectl --kubeconfig=<selected-kubeconfig> --context=<selected-context> ...

🎯 Goal

Given either:

  1. Raw HAMi Prometheus metrics pasted by the user, or
  2. Metrics collected from a live Kubernetes cluster,

produce a clean, structured summary that answers:

  • Which nodes and GPUs are in use
  • Per-GPU core and memory allocation
  • Allocation-based utilization per GPU
  • How many containers are sharing each GPU
  • Which pods and namespaces consume the GPU resources
  • Namespace-level totals for both gpucores and gpumem
  • Whether the cluster still has free capacity
  • Whether usage is concentrated, fragmented, or evenly distributed
Important: unless explicit real-time GPU utilization metrics are present, treat these metrics as allocation-based utilization, not actual SM/compute runtime utilization from nvidia-smi.

πŸ” Analysis Workflow (Internal Logic)

Step 1: Kubeconfig Discovery, Validation, and Selection

If the user already pasted raw HAMi metrics, use those directly and skip live kubeconfig-based collection.

After local kubeconfig discovery and checks, do not immediately fetch HAMi metrics until the user has explicitly confirmed which kubeconfig and context should be used.

Then explicitly ask:

  • "Which kubeconfig and context should be used for HAMi metrics collection?"

Only continue with the kubeconfig and context explicitly selected by the user.

Step 2: Acquire HAMi Metrics

If the user already pasted raw metrics, use those directly and do not fetch them again.

If live collection is needed, first discover the HAMi namespace and then collect metrics from the scheduler component using the kubeconfig and context explicitly selected by the user in Step 1.

Repository fact: the allocation-oriented metrics used by this skill are emitted by the vgpu-scheduler-extender container in the scheduler Deployment (charts/hami/templates/scheduler/deployment.yaml). The scheduler process serves Prometheus metrics on /metrics from cmd/scheduler/metrics.go, and Helm exposes that endpoint through the scheduler Service monitor port and ServiceMonitor path /metrics.

A. Find HAMi components

bash
kubectl --kubeconfig=<selected-kubeconfig> --context=<selected-context> get pods -A | grep -i hami

B. Identify the HAMi scheduler namespace

bash
HAMI_NS=$(kubectl --kubeconfig=<selected-kubeconfig> --context=<selected-context> get pods -A -l app.kubernetes.io/component=hami-scheduler -o jsonpath='{.items[0].metadata.namespace}' 2>/dev/null)
echo "$HAMI_NS"

C. Identify the scheduler pod and confirm the `vgpu-scheduler-extender` container

bash
kubectl --kubeconfig=<selected-kubeconfig> --context=<selected-context> get pods -n $HAMI_NS -l app.kubernetes.io/component=hami-scheduler -o wide
kubectl --kubeconfig=<selected-kubeconfig> --context=<selected-context> get pod -n $HAMI_NS -l app.kubernetes.io/component=hami-scheduler -o jsonpath='{range .items[*]}{.metadata.name}{" => "}{range .spec.containers[*]}{.name}{" "}{end}{"\n"}{end}'

D. Discover the scheduler Service instead of hardcoding its name

bash
SCHED_SVC=$(kubectl --kubeconfig=<selected-kubeconfig> --context=<selected-context> get svc -n $HAMI_NS -l app.kubernetes.io/component=hami-scheduler -o jsonpath='{.items[0].metadata.name}')
echo "$SCHED_SVC"
kubectl --kubeconfig=<selected-kubeconfig> --context=<selected-context> get svc -n $HAMI_NS "$SCHED_SVC" -o yaml

E. Confirm the chart-backed metrics exposure

bash
kubectl --kubeconfig=<selected-kubeconfig> --context=<selected-context> get servicemonitor -n $HAMI_NS -o yaml 2>/dev/null | grep -A5 -B2 "/metrics\|monitor"

Repository-backed defaults and relationships:

  • Deployment container: vgpu-scheduler-extender
  • Scheduler metrics bind address default: :9395
  • Container metrics port name: metrics
  • Service port name: monitor
  • Default Service monitor port: 31993
  • Default Service targetPort: metrics (the named container port, which follows scheduler.metricsBindAddress)
  • Metrics path: /metrics

F. Port-forward the scheduler Service and fetch metrics

bash
kubectl --kubeconfig=<selected-kubeconfig> --context=<selected-context> port-forward -n $HAMI_NS svc/$SCHED_SVC 9090:31993
curl -s http://127.0.0.1:9090/metrics

G. Alternative: port-forward the scheduler pod directly

bash
SCHED_POD=$(kubectl --kubeconfig=<selected-kubeconfig> --context=<selected-context> get pods -n $HAMI_NS -l app.kubernetes.io/component=hami-scheduler -o jsonpath='{.items[0].metadata.name}')
kubectl --kubeconfig=<selected-kubeconfig> --context=<selected-context> port-forward -n $HAMI_NS pod/$SCHED_POD 9090:9395
curl -s http://127.0.0.1:9090/metrics

Prefer the scheduler endpoint above for allocation summaries. Do not default to vGPU monitor when the task is to summarize scheduler allocation state by device, pod, or namespace. The vGPU monitor exports runtime NVML/container usage metrics on a different component and default port (:9394), which are useful for real usage but not a replacement for scheduler allocation metrics.


Step 3: Identify Relevant Metric Families

HAMi currently has two important metric surfaces relevant to GPU analysis:

  1. Scheduler allocation metrics from cmd/scheduler/metrics.go
  2. vGPU monitor runtime metrics from cmd/vGPUmonitor/metrics.go

For this skill, prefer scheduler allocation metrics.

A. Preferred scheduler metrics: current names

These are the primary metrics if --legacy-metrics=false:

Device-level allocation

  • hami_gpu_core_allocated_ratio
  • hami_gpu_core_limit_ratio
  • hami_gpu_memory_allocated_bytes
  • hami_gpu_memory_limit_bytes
  • hami_gpu_shared_count
  • hami_node_gpu_memory_allocated_ratio
  • hami_node_gpu_overview
  • hami_node_gpu_mig_instance_info

Pod-level allocation

  • hami_vgpu_core_allocated_ratio
  • hami_vgpu_memory_allocated_bytes

Namespace/quota-level aggregation

  • hami_resource_quota_used
  • hami_resource_quota_limit

Scheduler state

  • hami_scheduler_is_leader
  • hami_scheduler_cache_synced
  • hami_scheduler_last_sync_success_timestamp_seconds

Scheduler allocation outcomes

  • hami_scheduler_allocations_total
  • hami_scheduler_allocation_failures_total
  • hami_scheduler_bind_rollbacks_total
  • hami_scheduler_allocation_duration_seconds

Build metadata

  • hami_build_info

All scheduler metrics are wrapped with a constant label:

  • zone="vGPU"
B. Backward-compatible legacy scheduler metrics

If the scheduler is started with --legacy-metrics=true, the same allocation state is also emitted under older names:

Device-level allocation

  • GPUDeviceCoreAllocated
  • GPUDeviceCoreLimit
  • GPUDeviceMemoryAllocated
  • GPUDeviceMemoryLimit
  • GPUDeviceSharedNum
  • nodeGPUMemoryPercentage
  • nodeGPUOverview
  • nodeGPUMigInstance

Pod-level allocation

  • vGPUCoreAllocated
  • vGPUMemoryAllocated

Namespace/quota-level aggregation

  • QuotaUsed
C. Runtime-only vGPU monitor metrics (current names)

These come from cmd/vGPUmonitor/metrics.go and should be treated separately:

Host device runtime metrics

  • hami_host_gpu_memory_used_bytes β€” physical GPU memory usage
  • hami_host_gpu_utilization_ratio β€” physical GPU core utilization (0-100)
  • hami_host_gpu_memory_controller_utilization_ratio β€” GPU memory controller utilization
  • hami_host_gpu_unknown_process_count β€” current count (Gauge) of distinct compute/graphics processes not matched to a container allocated that GPU by HAMi. Opt-in: HAMI_MONITOR_UNKNOWN_PROCESSES=true and devicePlugin.hostPID=true. Known MIG/MPS/remote modes are skipped; failed supported-device inventories omit the sample and set hami_vgpumonitor_collect_success to 0. Unknown does not imply unauthorized use.

Per-container vGPU runtime metrics

  • hami_vgpu_memory_used_bytes β€” vGPU memory usage per container
  • hami_vgpu_memory_limit_bytes β€” vGPU memory limit per container
  • hami_container_device_utilization_ratio β€” container device SM utilization
  • hami_container_last_kernel_elapsed_seconds β€” seconds since last kernel execution
  • hami_vgpu_memory_context_bytes β€” memory context size
  • hami_vgpu_memory_module_bytes β€” memory module size
  • hami_vgpu_memory_buffer_bytes β€” memory buffer size

MIG runtime identity

  • hami_mig_device_info β€” MIG runtime identity per container

Use them only as runtime complements. They do not replace scheduler allocation metrics for namespace/device allocation summaries.

D. Backward-compatible legacy vGPU monitor metrics

If the vGPU monitor is started with --legacy-metrics=true, the same runtime state is also emitted under older names:

Host device runtime metrics

  • HostGPUMemoryUsage β€” physical GPU memory usage
  • HostCoreUtilization β€” physical GPU core utilization

Per-container vGPU runtime metrics

  • vGPU_device_memory_usage_in_bytes β€” vGPU memory usage per container
  • vGPU_device_memory_limit_in_bytes β€” vGPU memory limit per container
  • Device_memory_desc_of_container β€” container device memory description
  • Device_utilization_desc_of_container β€” container device utilization
  • Device_last_kernel_of_container β€” last kernel execution time

MIG runtime identity

  • MigInfo β€” MIG runtime identity per container

Ignore unrelated generic Prometheus metrics unless they help with context.


Step 4: Normalize Units and Semantics

The agent must normalize units before reporting.

A. Scheduler metrics are allocation-state, not live hardware telemetry

The scheduler collector reports values derived from the scheduler's cached node/device/pod/quota state:

  • node/device data comes from scheduler node usage structures
  • pod/container data comes from PodManager.GetScheduledPods()
  • quota data comes from QuotaManager.GetResourceQuota()

These values answer what HAMi believes is allocated, not what the GPU is physically consuming right now.

B. GPU core semantics
  • gpucores behaves like a share scale, normally with full device = 100
  • Despite metric names ending in _ratio, scheduler core metrics expose raw share-style values such as 0, 30, 50, 100
  • Interpret these as allocation units on a 0-100 scale unless the deployment has custom device semantics

Example:

  • 100 = full GPU core share
  • 50 = half GPU core share
  • 30 = 30% share

Use this calculation for normalized reporting:

$$ \text{Core Allocation Percentage} = \frac{\text{allocated cores}}{\text{core limit}} \times 100 $$

C. GPU memory semantics

Be careful: different metric families use different units.

Scheduler device/container memory metrics

  • hami_gpu_memory_allocated_bytes
  • hami_gpu_memory_limit_bytes
  • hami_vgpu_memory_allocated_bytes
  • legacy GPUDeviceMemoryAllocated
  • legacy GPUDeviceMemoryLimit
  • legacy vGPUMemoryAllocated

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
3,995
Repository forks
625
7-day trend score
41

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/project-hami/hami/hami-vgpu-metrics-summary/badge)](https://verified-skill.com/skills/project-hami/hami/hami-vgpu-metrics-summary)

Something wrong with this skill or its page? Tell us.