stat-server

command module
v0.0.0-...-58d5f92 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 3, 2022 License: MIT Imports: 9 Imported by: 0

README

stat-server

Precisely track most recent resource usage information on remote host and serve the result via very simple API.

For now it only supports avg CPU usage, however extending it should be trivial. PRs are welcome.

  1. Run it on a target server:
# Poll CPU with frequency of 100ms, limit history to 60s
$ ./stat-server -f 100 -l 60
  1. Request the data.
$ # Get all datapoints from last 300 ms.
$ curl "http://localhost:2137?ms=300" | jq
[
  {
    "ts": 1654259802170371800,
    "value": 6.17283950654989
  },
  {
    "ts": 1654259802270917600,
    "value": 3.846153846010336
  },
  {
    "ts": 1654259802371504000,
    "value": 3.750000000363798
  }
]

ts is a time elapsed since the Unix epoch in nanoseconds value is % cpu consumption

I wrote this because I needed a way to ask a remote server about it's precise CPU consumption in last 500ms.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL