Skip to content
/ sys.json Public

Expose server performance stats as a JSON API. Mostly just a toy project at this point.

Notifications You must be signed in to change notification settings

EricR/sys.json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sys.json

Exposes server performance stats as an API.

It works, but it's a work in progress. Things are subject to change without notice, so please use caution if you decide to use this in production. Assume there are bugs.

Why?

There are plenty of other tools out there that can give you stats. There's SNMP, dozens of monitoring solutions and stat collection agents, and more. So why this?

Many of these solutions are complicated to setup and get data from. The goal of sys.json is to provide a simple API for querying a server about the stats you're interested in. No more, no less. What you do with that data is up to you.

Running It

go get
go build
./sysjson --listen 127.0.0.1:5374

Important: Note the bind to the loopback interface and not 0.0.0.0. This is not a service you'll want to expose to the Internet.

Example Requests

curl http://localhost:5374/
{
  "modules_available": {
    "conntrack": {
      "name": "conntrack",
      "description": "Provides stats on current network connections (requires conntrack-tools)"
    },
    "disk": {
      "name": "disk",
      "description": "Provides stats on each disk"
    },
    "host": {
      "name": "host",
      "description": "Provides basic host info"
    },
    "load": {
      "name": "load",
      "description": "Provides load averages"
    },
    "mem": {
      "name": "mem",
      "description": "Provides system-wide memory stats"
    },
    "net": {
      "name": "net",
      "description": "Provides stats on each network interface"
    },
    "process": {
      "name": "process",
      "description": "Provides a process tree"
    },
    "uptime": {
      "name": "uptime",
      "description": "Provides time since startup"
    }
  }
}
curl http://localhost:5374/?modules=disk,load
{
  "disk": {
    "vda": {
      "reads": {
        "completed": 21955,
        "sectors": 1258186,
        "merged": 11170,
        "total_ms": 8302
      },
      "writes": {
        "completed": 170359,
        "sectors": 8927472,
        "merged": 940398,
        "total_ms": 893929
      },
      "io": {
        "in_progress": 0,
        "total_ms": 0,
        "total_weighted": 97388
      }
    },
    "vda1": {
      "reads": {
        "completed": 21781,
        "sectors": 1256794,
        "merged": 11170,
        "total_ms": 8295
      },
      "writes": {
        "completed": 170359,
        "sectors": 8927472,
        "merged": 940398,
        "total_ms": 893929
      },
      "io": {
        "in_progress": 0,
        "total_ms": 0,
        "total_weighted": 97382
      }
    }
  },
  "load": {
    "15m": 0,
    "1m": 0,
    "5m": 0.02
  }
}

Todo

  • Write tests
  • Standardize and document API
  • More in-depth networking and disk stats
  • Plugin engine for reading, parsing, and presenting data

About

Expose server performance stats as a JSON API. Mostly just a toy project at this point.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages