一键导入
prometheus-cli
Query Prometheus metrics using the HTTP API via curl. Use for instant queries, range queries, metadata lookups, and alert/rule inspection.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Query Prometheus metrics using the HTTP API via curl. Use for instant queries, range queries, metadata lookups, and alert/rule inspection.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use the correct AWS CLI profile when running AWS commands based on the target environment.
Analyze code changes between two local Git branches and perform a comprehensive code review. Use ONLY for local git branch comparisons. Do NOT use when a GitLab or GitHub MR/PR URL or MR ID is provided — use gitlab-cli or github-cli skill instead.
Analyze code changes to prepare conventional commit message and commit to a new branch.
Create optimized, secure, production-ready Dockerfiles based on user requirements and application context.
Create a new SKILL.md file based on a guided conversation about a task or workflow.
Create a detailed upgrade plan for a Helm release managed by Terraform, comparing the current and desired chart versions including breaking changes and required code changes.
| name | prometheus-cli |
| description | Query Prometheus metrics using the HTTP API via curl. Use for instant queries, range queries, metadata lookups, and alert/rule inspection. |
Use the instance and rules below when constructing all Prometheus API commands.
Update the table below with your Prometheus instance URLs before using this skill:
| Environment | Base URL | Token File |
|---|---|---|
| Production | https://<your-prometheus-prod-url> | ~/.prometheus/prod.token |
| Staging | https://<your-prometheus-staging-url> | ~/.prometheus/staging.token |
If the target instance is unclear, ask the user before running any command.
Obtain a Prometheus API token for each instance you intend to use and save it to the corresponding token file (see instance table above). Never print or display token values. Do not perform these steps yourself.
For each instance:
mkdir -p ~/.prometheus && echo "<your-api-token>" > <TOKEN_FILE> && chmod 600 <TOKEN_FILE>
All API calls use curl with the token read from the instance's token file (see instance table above):
curl -s -H "Authorization: Bearer $(cat <TOKEN_FILE>)" \
"<BASE_URL>/api/v1/<endpoint>" | jq .
Example (production):
curl -s -H "Authorization: Bearer $(cat ~/.prometheus/prod.token)" \
"https://<your-prometheus-prod-url>/api/v1/query?query=up" | jq .
| Endpoint | Description |
|---|---|
/api/v1/query?query=<expr> | Instant query — evaluate a PromQL expression at current time |
/api/v1/query_range?query=<expr>&start=<ts>&end=<ts>&step=<dur> | Range query — evaluate PromQL over a time range |
/api/v1/labels | List all label names |
/api/v1/label/<name>/values | List values for a specific label |
/api/v1/series?match[]=<selector> | Find time series matching a selector |
/api/v1/metadata | List metric metadata (type, help text) |
/api/v1/rules | List all recording and alerting rules |
/api/v1/alerts | List currently firing alerts |
/api/v1/targets | List scrape targets and their health |
/api/v1/targets/metadata | List metadata for scraped targets |
/api/v1/status/config | Show current Prometheus configuration |
/api/v1/status/flags | Show runtime flags |
/api/v1/status/runtimeinfo | Show runtime information |
/api/v1/status/buildinfo | Show build information |
/api/v1/status/tsdb | Show TSDB stats |
Replace <TOKEN_FILE> and <BASE_URL> with the values for your target instance (see instance table above).
# Instant query — CPU usage across all instances
curl -s -H "Authorization: Bearer $(cat <TOKEN_FILE>)" \
"<BASE_URL>/api/v1/query?query=rate(process_cpu_seconds_total[5m])" | jq .
# Range query — memory usage over the last hour (60s step)
curl -s -H "Authorization: Bearer $(cat <TOKEN_FILE>)" \
"<BASE_URL>/api/v1/query_range?query=process_resident_memory_bytes&start=$(date -u -v-1H +%s)&end=$(date -u +%s)&step=60" | jq .
# List all firing alerts
curl -s -H "Authorization: Bearer $(cat <TOKEN_FILE>)" \
"<BASE_URL>/api/v1/alerts" | jq '.data.alerts[]'
# Find series matching a selector
curl -s -H "Authorization: Bearer $(cat <TOKEN_FILE>)" \
"<BASE_URL>/api/v1/series?match[]=up{job=\"node-exporter\"}" | jq .
| Endpoint | Method | Reason |
|---|---|---|
/api/v1/admin/tsdb/delete_series | POST | Permanently deletes time series data |
/api/v1/admin/tsdb/clean_tombstones | POST | Purges deleted data from disk |
/api/v1/admin/tsdb/snapshot | POST | Triggers a snapshot (may affect disk/storage) |
$(cat <TOKEN_FILE>) — never hardcode a token value in a command.-s (silent) to curl to suppress progress output, and pipe through jq for readable output./api/v1/admin/...) without explicit user instruction — these can permanently alter or delete metric data./api/v1/metadata or /api/v1/labels to explore available metrics before querying.start/end) and step are reasonable — very wide windows with fine steps can produce extremely large responses.