Skip to content
Skillpedia
Analysis & spreadsheets5.1k · #15046

hami-vgpu-metrics-summary

What it does

It reads Prometheus-style metrics for HAMi virtual GPUs and organizes them by node, device, pod, and namespace. It is for cluster operators who want an easy report on GPU use.

When to use it

  • ✓When you have HAMi GPU metrics and want a clear report on allocation.
  • ✓When you want to see how many containers share each GPU in your cluster.
  • ✓When you want to know which namespaces and pods use the most vGPU memory or cores.

Skill link

https://github.com/Project-HAMi/HAMi/blob/master/skill/hami-vgpu-metrics-summary/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/Project-HAMi/HAMi/blob/master/skill/hami-vgpu-metrics-summary/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

Example of what to ask your AI

“Here is our HAMi metrics output. Summarize GPU core and memory allocation per node and tell me which pods share each GPU.”

5 new skills a week. 1 minute to read.

How it works

The agent reads the metrics, groups GPU allocation by node, device, pod, and namespace, and writes a report of cores, memory, and sharing. It first confirms the kubeconfig and cluster details when they are needed.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

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:

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

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

B. Identify the HAMi scheduler namespace

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

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

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

kubectl --kubeconfig=<selected
FAQ

Can it read metrics directly from my cluster?

Yes, if you give it the kubeconfig path and context. It confirms the cluster to use before continuing.

What does the report cover?

vGPU core and memory allocation, utilization based on allocation, sharing density, and namespace usage.

Does it ask which pod to look at?

Yes. It asks which namespace and pod you want to troubleshoot, if you know them.

Details

Original description by the author

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.

repo: Project-HAMi/HAMi

Popularity

GitHub stars
5.1k
Ranking position
#15046
License
Apache-2.0
Updated
11/2/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills