Skip to content

feat: add signoz_list_hosts tool for infrastructure monitoring#67

Open
artgas1 wants to merge 1 commit into
SigNoz:mainfrom
artgas1:feat/infrastructure-monitoring-hosts
Open

feat: add signoz_list_hosts tool for infrastructure monitoring#67
artgas1 wants to merge 1 commit into
SigNoz:mainfrom
artgas1:feat/infrastructure-monitoring-hosts

Conversation

@artgas1

@artgas1 artgas1 commented Mar 12, 2026

Copy link
Copy Markdown

Summary

Adds a new signoz_list_hosts tool that exposes SigNoz's Infrastructure Monitoring hosts data via MCP. This enables AI assistants to check server health, CPU/memory usage, and load averages directly.

New Tool

signoz_list_hosts — List infrastructure hosts with resource utilization metrics.

Parameters

Parameter Type Default Description
timeRange string 1h Time range (e.g., '30m', '1h', '6h', '24h')
orderBy string cpu Sort column: cpu, memory, wait, load15
order string desc Sort direction: asc, desc
limit string 100 Max hosts to return
offset string 0 Pagination offset

Example Response

{
  "hosts": [
    {
      "hostName": "production-vps",
      "active": true,
      "os": "linux",
      "cpu": 0.33,
      "memory": 0.36,
      "wait": 0.004,
      "load15": 2.05
    }
  ],
  "total": 5,
  "sentAnyHostMetricsData": true
}

Implementation

  • Client: ListHosts()POST /api/v1/hosts/list
  • Types: HostListRequest, HostListResponse, HostRecord in new pkg/types/infra.go
  • Handler: Parses time range, sorting, pagination; simplifies response by extracting OS from metadata
  • Server: Registered via RegisterInfraHandlers()

Use Case

This was motivated by a real incident where a VPS became overloaded but we couldn't query host metrics through MCP. The existing signoz_execute_builder_query requires complex query construction for host metrics, while this tool provides a simple, purpose-built interface.

Adds a new tool to list infrastructure hosts with CPU, memory, I/O wait,
and load metrics. Uses the /api/v1/hosts/list endpoint which powers
SigNoz's Infrastructure Monitoring > Hosts page.

Returns simplified host data: hostName, active status, OS, CPU usage,
memory usage, I/O wait, and load average (15m). Supports time range,
sorting by any metric column, and pagination.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant