resourced-master

command module
v2.0.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2015 License: MIT Imports: 16 Imported by: 0

README

GoDoc license Imgur Album

ResourceD Master receives server data from ResourceD agents and serves them as HTTP+JSON.

Signup

Access Tokens

Hosts

Installation for users

  1. Install PostgreSQL 9.4.x

  2. Install Go 1.4.x, git, setup $GOPATH, and PATH=$PATH:$GOPATH/bin

  3. Create PostgreSQL database.

    sudo su - postgres
    createuser -P -e resourced
    createdb --owner=resourced resourced-master
    
    # Make sure user, password, and pg_hba.conf are configured correctly.
    
  4. Create all the PostgreSQL tables.

  5. Download the tar.gz, unpack it, and run the binary using init/systemd/supervisord. You can follow the examples of init scripts here.

Installation for contributors

See CONTRIBUTORS.md

ENV variables as configuration

  • RESOURCED_MASTER_ADDR: HTTP server host:port. Default: ":55655"

  • RESOURCED_MASTER_CERT_FILE: Path to cert file. Default: ""

  • RESOURCED_MASTER_KEY_FILE: Path to key file. Default: ""

  • RESOURCED_MASTER_DSN PostgreSQL DSN. Default: "postgres://$PG_USER@$localhost:5432/resourced-master?sslmode=disable"

  • RESOURCED_MASTER_COOKIE_SECRET Cookie secret key. Default: "$SEE_THE_CODE"

RESTful Endpoints

Every HTTP request requires AccessToken passed as user. Example:

curl -u 0b79bab50daca910b000d4f1a2b675d604257e42: https://localhost:55655/api/hosts
  • GET /api/hosts Displays list of all hosts by access token.

  • POST /api/hosts Submit JSON data from 1 host.

Querying

You can query hosts data using SQL-like language. There are 3 fields to query from: name, tags, and data.

Currently, you can only use AND conjunctive operators.

Query by hostname

  • Exact match: name = "localhost"

  • Starts with match: name ~^ "awesome-app-"

Query by tags

  • Contains the following tags: tags = ["app", "django", "staging"]

Query by data

To craft data query, starts with ResourceD path and then use "." delimited separator as you get deeper into the JSON structure. Example:

Let's say your resourced agent shipped /free data:

{"/free": {"Swap": {"Free": 0, "Used": 0, "Total": 0}, "Memory": {"Free": 1346609152, "Used": 7243325440, "Total": 8589934592, "ActualFree": 3666075648, "ActualUsed": 4923858944}}}

You can query "Swap": "Used": data like this:

/free.Swap.Used > 10000000

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package libenv provides environment related library functions.
Package libenv provides environment related library functions.
Package libhttp provides http related library functions.
Package libhttp provides http related library functions.
Package libstring provides string related library functions.
Package libstring provides string related library functions.
Package middlewares provides common middleware handlers.
Package middlewares provides common middleware handlers.
Package querybuilder provides query building functionality.
Package querybuilder provides query building functionality.

Jump to

Keyboard shortcuts

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