Xpersona
P

Promql Cli

CLAWHUB · Unverified

CLI for querying Prometheus and PromQL-compatible engines (Thanos, Cortex, VictoriaMetrics, Grafana Mimir, Grafana Tempo...) — instant queries, range queries... Skill: Promql Cli Owner: samber Summary: CLI for querying Prometheus and PromQL-compatible engines (Thanos, Cortex, VictoriaMetrics, Grafana Mimir, Grafana Tempo...) — instant queries, range queries... Tags: latest:1.1.3 Version history: v1.1.3 | 2026-05-21T05:45:50.531Z | auto - Added extensive reference documentation covering installation, usage, graphing, debugging, and PromQL syntax. - Updated metadata: bumped ve

62
Rank
84
Safety
1.0k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 1K downloads reported by the source. Last updated 10/11/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s173arkhs3131fq5jf769qq75583hdgt:promql-cli
  1. Setup complexity is LOW. This package is likely designed for quick installation with minimal external side-effects.
  2. Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-samber-promql-cli/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

108,620 characters of source documentation, loaded on request.

Extracted files

5 files captured from the source.

SKILL.md

---
name: promql-cli
description: CLI for querying Prometheus and PromQL-compatible engines (Thanos, Cortex, VictoriaMetrics, Grafana Mimir, Grafana Tempo...) — instant queries, range queries, metric discovery (metrics/labels/meta subcommands), output formats (table/csv/json/graph). Apply when executing PromQL queries, troubleshooting performance issues on a software having observability, investigating latency/error rates/saturation, or analyzing time series data.
license: MIT
compatibility: Requires promql-cli and jq
user-invocable: true
metadata:
  author: samber
  version: "1.1.3"
  openclaw:
    emoji: "📊"
    homepage: https://github.com/samber/cc-skills
    install:
      - kind: go
        package: github.com/nalbury/promql-cli
        bins: [promql]
      - kind: brew
        formula: jq
        bins: [jq]
    requires:
      bins:
        - promql
        - jq
    skill-library-version: "0.3.0"
allowed-tools: Read Edit Write Glob Grep Agent Bash(promql:*) mcp__context7__resolve-library-id mcp__context7__query-docs AskUserQuestion
---

# promql-cli — Prometheus Query CLI Skill

`promql-cli` (github.com/nalbury/promql-cli) is a Go CLI for querying, analyzing, and visualizing Prometheus metrics, plus PromQL fundamentals.

## Reference Files

Read the relevant reference file(s) before executing tasks:

| File | When to read |
| --- | --- |
| `references/installation.md` | User needs to install promql-cli or set up configuration (hosts, auth, token, password, multi-host) |
| `references/usage.md` | User wants to discover metrics/exporters/labels, run queries, or choose output formats |
| `references/graphing.md` | User wants to visualize Prometheus data as an ASCII chart in the terminal |
| `references/debugging.md` | User is investigating a performance issue, latency, errors, or saturation |
| `references/promql-reference.md` | User needs help writing PromQL, understanding metric types, functions, or aggregations |

For most tasks, read `references/usage.md`. For PromQL help, read `references/promql-reference.md`. When debugging, read both `references/debugging.md` and `references/promql-reference.md`.

## Setup Check

Before running any query, verify that a host is configured:

```bash
promql 'up'   # succeeds if host is reachable; fails with connection error if not configured
# or
promql --host xxx 'up'
```

Recognize these errors as a configuration/auth problem and refer to `references/installation.md`:

| Error | Cause |
| --- | --- |
| `dial tcp ... connection refused` | No host running at the configured address |
| `dial tcp ... no such host` | Hostname not resolved — wrong host in config |
| `error querying prometheus: ...401...` | Bearer token missing or invalid |
| `error querying prometheus: ...403...` | Token valid but insufficient permissions |
| `please specify an authentication type` | Auth flags partially set — use config file instead |

If any of these appear, **do not create config files on behalf of the user** — config fil

_meta.json

{
  "ownerId": "kn72rhnkwjfeex9wr1n7y24qa983cjn3",
  "slug": "promql-cli",
  "version": "1.1.3",
  "publishedAt": 1779342350531
}

references/debugging.md

# promql-cli — Debugging Methodology

## Core Rule: Isolate Before Aggregating

The most common debugging mistake is starting with aggregated metrics. Aggregation masks individual bad actors — a single overloaded pod looks fine when its metrics are averaged with 9 healthy ones. Always start by narrowing to a single instance, then broaden once you understand what's happening.

## USE Method (Utilization, Saturation, Errors)

For infrastructure components (CPU, memory, disk, network):

```bash
# Utilization — how busy is the resource?
promql 'avg by(instance)(rate(node_cpu_seconds_total{mode!="idle"}[5m]))' --start 1h --output graph

# Saturation — is the resource overloaded? (queue depth, wait time)
promql 'node_load1 / on(instance) count by(instance)(node_cpu_seconds_total{mode="idle"})' --start 1h

# Errors — are requests failing?
promql 'rate(node_disk_io_time_seconds_total[5m])' --start 1h --output graph
```

## RED Method (Rate, Errors, Duration)

For services and HTTP endpoints:

```bash
# Rate — requests per second
promql 'sum by(job)(rate(http_requests_total[5m]))' --start 1h --output graph

# Errors — error ratio
promql 'sum by(job)(rate(http_requests_total{status=~"5.."}[5m])) / sum by(job)(rate(http_requests_total[5m]))' --start 1h

# Duration — latency (requires histogram metric)
promql 'histogram_quantile(0.99, sum by(le, job)(rate(http_request_duration_seconds_bucket[5m])))' --start 1h --output graph
```

## Step-by-Step: Investigating a Latency Spike

**1. Identify the time window**

```bash
promql 'histogram_quantile(0.99, sum by(le)(rate(http_request_duration_seconds_bucket[5m])))' --start 6h --output graph
```

**2. Isolate by instance — don't aggregate yet**

```bash
# Remove the sum(), keep instance labels
promql 'histogram_quantile(0.99, rate(http_request_duration_seconds_bucket{job="api"}[5m]))' --start 2h --output graph
```

**3. Check resource pressure on the worst instance**

```bash
promql 'rate(node_cpu_seconds_total{mode!="idle", instance="bad-host:9100"}[5m])' --start 2h --output graph
promql 'node_memory_MemAvailable_bytes{instance="bad-host:9100"}' --start 2h --output graph
```

**4. Correlate with upstream dependencies**

```bash
promql 'rate(db_query_duration_seconds_sum{instance="bad-host:5432"}[5m]) / rate(db_query_duration_seconds_count{instance="bad-host:5432"}[5m])' --start 2h --output graph
```

## Step-by-Step: Investigating an Error Rate Spike

**1. Get the overall error rate**

```bash
promql 'sum(rate(http_requests_total{status=~"5.."}[5m])) / sum(rate(http_requests_total[5m]))' --start 3h --output graph
```

**2. Break down by endpoint**

```bash
promql 'sum by(handler)(rate(http_requests_total{status=~"5.."}[5m]))' --start 1h --output csv | sort -t, -k2 -rn | head -10
```

**3. Check for upstream failures (dependency error rates)**

```bash
promql 'rate(grpc_client_handled_total{grpc_code!="OK"}[5m])' --start 1h --output graph
```

## Diagnose: Useful Checks

**Diagnose:** 1- `promql 'up' --output table

references/graphing.md

# promql-cli — ASCII Graphs

Use `--output graph` for an in-terminal ASCII sparkline of range queries. No external dependencies required.

```bash
promql 'rate(http_requests_total[5m])' --start 1h --output graph
promql 'node_memory_MemAvailable_bytes' --start 6h --step 5m --output graph
```

PromQL aggregations return multiple series — each becomes a separate line in the chart:

```bash
# One line per job
promql 'sum by(job)(rate(http_requests_total[5m]))' --start 1h --output graph

# One line per instance
promql 'rate(http_requests_total{job="api"}[5m])' --start 1h --output graph
```

Save to file by redirecting stdout:

```bash
promql 'node_load1' --start 6h --output graph > load_trend.txt
```

`--output graph` is the default for range queries (when `--start` is set) — omitting `--output` has the same effect.

references/installation.md

# promql-cli — Installation

Latest release: **v0.3.0** — macOS and Linux only (no official Windows binary). Please check the [releases](https://github.com/nalbury/promql-cli/releases) to find the latest version.

## macOS

### Pre-built binary (recommended)

```bash
# Intel (x86_64)
curl -L https://github.com/nalbury/promql-cli/releases/download/v0.3.0/promql-v0.3.0-darwin-amd64.tar.gz | tar xz
sudo mv promql /usr/local/bin/

# Apple Silicon (M1/M2/M3/M4/M+)
curl -L https://github.com/nalbury/promql-cli/releases/download/v0.3.0/promql-v0.3.0-darwin-arm64.tar.gz | tar xz
sudo mv promql /usr/local/bin/
```

### Build from source (requires Go 1.13+)

```bash
git clone https://github.com/nalbury/promql-cli.git
cd promql-cli
OS=darwin ARCH=amd64 INSTALL_PATH=/usr/local/bin make install   # Intel
OS=darwin ARCH=arm64 INSTALL_PATH=/usr/local/bin make install   # Apple Silicon
```

### go install

```bash
go install github.com/nalbury/promql-cli@latest
# Binary lands in $(go env GOPATH)/bin — ensure that's on your PATH
```

## Linux

### Pre-built binary (recommended)

```bash
# x86_64 (amd64)
curl -L https://github.com/nalbury/promql-cli/releases/download/v0.3.0/promql-v0.3.0-linux-amd64.tar.gz | tar xz
sudo mv promql /usr/local/bin/

# ARM64 (Raspberry Pi 4+, AWS Graviton, etc.)
curl -L https://github.com/nalbury/promql-cli/releases/download/v0.3.0/promql-v0.3.0-linux-arm64.tar.gz | tar xz
sudo mv promql /usr/local/bin/
```

### Build from source (requires Go 1.13+)

```bash
git clone https://github.com/nalbury/promql-cli.git
cd promql-cli
OS=linux ARCH=amd64 INSTALL_PATH=/usr/local/bin make install    # x86_64
OS=linux ARCH=arm64 INSTALL_PATH=/usr/local/bin make install    # ARM64
```

### go install

```bash
go install github.com/nalbury/promql-cli@latest
```

## Windows

No official Windows binary is provided. Options:

**WSL2 (recommended):** Install the Linux binary inside your WSL2 environment — full feature support.

**Build from source:**

```powershell
git clone https://github.com/nalbury/promql-cli.git
cd promql-cli
$env:GOOS="windows"; $env:GOARCH="amd64"; go build -o promql.exe ./
# Move promql.exe to a directory on your PATH
```

## Verify Installation

Test against your local Prometheus instance (default: [http://localhost:9090](http://localhost:9090)):

```bash
promql --version
promql 'up' --host http://localhost:9090
promql metrics --host http://localhost:9090 | head -20
```

## Configuration

By default promql-cli connects to `http://localhost:9090`. Override with `--host` or a config file:

```yaml
# ~/.promql-cli.yaml
host: http://prometheus.acme.org:9090
timeout: 30s
```

```bash
chmod 600 ~/.promql-cli.yaml   # file may contain tokens — restrict access
```

## Multi-Host Setup

Use separate config files per environment, switch with `--config`:

```yaml
# ~/.promql-cli-prod.yaml
host: https://prometheus-prod.acme.org:9090

# ~/.promql-cli-staging.yaml
host: https://prometheus-staging.acme.org:9090
```

```bash
promql --config ~/.pr

Sponsored

Ads related to Promql Cli and adjacent AI workflows.