Code Monkey home page Code Monkey logo

simple_status's Introduction

SimpleStatus

SimpleStatus provides a REST/HTTP API for obtaining certain system statistics from a node. SimpleStatus is written in the Go Programming Language.

[![Build Status][1]][2] [1]: https://travis-ci.org/cdarwin/simple_status.png [2]: https://travis-ci.org/cdarwin/simple_status

Endpoints

URI HTTP Verb Purpose
/system GET List all available resources
/system/host GET List node hostname
/system/disk GET List node disk usage
/system/load GET List node load averages
/system/ram GET List node RAM usage
/shell GET Execute arbitrary shell commands on the node

Authentication

SimpleStatus currently uses a very simple method for authenticating API requests. The daemon may be configured to require authentication at runtime using the -t switch. This token may be any arbitrary string at the time of this writing.

Example Query with Parameter:

GET https://nodename.com:8080/1/api/system?token=abc4c7c627376858

Requests

Requests to the API are simple HTTP requests against the API endpoints.

All request bodies should be in JSON, with Content-Type of application/json.

Base URL

A few parameters may be set at runtime which will affect the bare URL that you will use as the prefix for the desired endpoint.

  • -ssl: Enforce encryption of communication with the API
  • -p: Specify the port for communication with the API (defaults to 8080)

All endpoints should be prefixed with something similar to the following:

{scheme}://{nodename}:{port}/1/api

Responses

All responses are in JSON, with Content-Type of application/json. A response is structured as follows:

{ "resource_name": "resource value" }


System

Overview of all available resources

Endpoint

GET /system

Optional URI Parameters

  • disk: Specify a path or device for disk usage
    • If none is specified, "/" is assumed

Response

{
  "host": "mario",
  "disk": {
    "all": 117623562240,
    "used": 8339341312,
    "free": 109284220928
  },
  "cpuinfo": {
    "processors": 4,
    "siblings": 4,
    "cores": 2
  },
  "load": {
    "avg1": 0.26,
    "avg2": 0.23,
    "avg3": 0.23
  },
  "ram": {
    "free": 565848,
    "total": 7871876
  },
  "time": "2013 02/01 2323-54"
}

Host

System hostname

Endpoint

GET /system/host

Response

"nexus2"

Disk

Used, free, and total disk space available for a given device or path. If no disk parameter is provided, the endpoint assumes the / path.

Endpoint

GET /system/disk

Optional URI Parameters

  • disk: Specify a path or device for disk usage
    • If none is specified, "/" is assumed

Response

{
  "all": 35439468544,
  "used": 20696563712,
  "free": 14742904832
}

CpuInfo

From /etc/cpuinfo

Endpoint

GET /system/cpuinfo

Response:

{
  "processors": 4,
  "siblings": 4,
  "cores": 2
}

Load

Load averages for the node

Endpoint

GET /system/load

Response:

{
  "avg1": 0.40,
  "avg2": 0.40,
  "avg3": 0.37
}

RAM

RAM usage for the node

Endpoint

GET /system/ram

Response:

{
  "free": 20608,
  "total": 2060976
}

Shell

Execute arbitrary shell commands on the node. This endpoint is only accessible if a token was specified at runtime

Endpoint

GET /shell

URI Parameters

  • exec: Specify the command to be executed on the node
  • token: Mandatory authentication token

Response

"command response"

simple_status's People

Contributors

cdarwin avatar edsrzf avatar

Stargazers

Losang Jinpa, PhD, MCSE/MCT, Cloud Monk avatar Shammi Shailaj avatar Stephen Cornelius avatar Semen Belozorov avatar GAURAV avatar Amine avatar İnanç Gümüş avatar VirtualAdrian avatar Ryan avatar  avatar George Pantazis avatar  avatar Ufuk Uzun avatar Jason Wynn avatar Tolga Onbay avatar Oğuzhan Eren avatar Cengiz Han avatar Onuralp Taner avatar Tim avatar  avatar  avatar Robert avatar Ciaran Downey avatar Dmytro Chornyi avatar Vitalii Mikhnevych avatar Lubomir Anastasov avatar Dimitar9 avatar Vasiliy Bukharev avatar Iouri Goussev avatar xRay avatar  avatar Oleksii avatar Andrii Korzh avatar ᴀɴᴛᴏɴ ɴᴏᴠᴏᴊɪʟᴏᴠ avatar Gregory avatar Travis Reeder avatar  avatar Roman avatar Fredrik Steen avatar Taylor Weibley avatar

Watchers

Cengiz Han avatar xRay avatar Gregory avatar James Cloos avatar  avatar Oleksii avatar  avatar  avatar

simple_status's Issues

cpuinfo

Load average is more useful when we know how many cpus are available

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.