Skip to main content

Resources

Live system information of a node: resource metrics such as CPU, memory, storage and network interface usage, and the network flows crossing its interfaces. Use this service to monitor the health and traffic of any node.

Open metrics stream​

Stream the resource metrics of a node, such as CPU, memory, disk and network interface usage. A sample of the current metrics is sent when the stream opens. The stream stays open until the client closes it, and ends with an error if the node loses its connection.

GET/v1/streams/nodes/{node_id}/metrics

Server-sent events. A : ready comment is sent when the stream is ready, then each message is a data: line holding the response below. A failure after that is an error event.

Path parameters
  • node_idstring

    ID of the node to read metrics from.

Example
import { NanopingClient } from "@nanoping/api";

const client = new NanopingClient({ baseUrl: "http://127.0.0.1:10565" });

for await (const response of client.resources.openMetricsStream({
nodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f"
})) {
}
Response messages
  • timestamptimestamp

    When the sample was taken.

  • collectionsCollection[]

    The metrics, grouped into collections such as /system/memory and /system/disk.

Open flows stream​

Stream a snapshot of the network flows crossing the interfaces of a node, about once a second, starting right away. The node only captures packets while someone watches its flows, so the first samples may be empty or incomplete.

GET/v1/streams/nodes/{node_id}/flows

Server-sent events. A : ready comment is sent when the stream is ready, then each message is a data: line holding the response below. A failure after that is an error event.

Path parameters
  • node_idstring

    ID of the node to read flows from.

Example
import { NanopingClient } from "@nanoping/api";

const client = new NanopingClient({ baseUrl: "http://127.0.0.1:10565" });

for await (const response of client.resources.openFlowsStream({
nodeId: "3f2b1c9e-8d4a-4f6b-9c2e-1a7d5e8b0c4f"
})) {
}
Response messages
  • timestamptimestamp

    When the snapshot was taken.

  • flowsFlow[]

    Every flow the node currently tracks. Empty when none have been captured.