resourced-master

command module
v3.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2015 License: MIT Imports: 9 Imported by: 0

README

GoDoc license Imgur Album

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

NOTE: This documentation refers to master branch. For stable release, checkout the main website.

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. 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 developers/contributors

See INSTALL.md and BUILD.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. The JSON payload format is defined by type ResourcedPayload struct. See: /dal/host.go#L24

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-"

  • Regex match, case insensitive: name ~* "awesome-app-"

  • Regex match, case sensitive: name ~ "awesome-app-"

  • Regex match negation, case sensitive: name !~ "awesome-app-"

  • Regex match negation, case insensitive: name !~* "awesome-app-"

Query by tags

  • Exact match: tags.mysql = 5.6.24

  • Multiple exact match: tags.mysql = 5.6.24 and tags.redis = 3.0.1

Query by data

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

For 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 then query "Swap": "Used": data: /free.Swap.Used > 10000000

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Godeps
_workspace/src/code.google.com/p/snappy-go/snappy
Package snappy implements the snappy block-based compression format.
Package snappy implements the snappy block-based compression format.
_workspace/src/github.com/carbocation/interpose
Interpose is a minimalist Golang middleware that uses only `http.Handler` and `func(http.Handler)http.Handler`.
Interpose is a minimalist Golang middleware that uses only `http.Handler` and `func(http.Handler)http.Handler`.
_workspace/src/github.com/go-sql-driver/mysql
Go MySQL Driver - A MySQL-Driver for Go's database/sql package The driver should be used via the database/sql package: import "database/sql" import _ "github.com/go-sql-driver/mysql" db, err := sql.Open("mysql", "user:password@/dbname") See https://github.com/go-sql-driver/mysql#usage for details
Go MySQL Driver - A MySQL-Driver for Go's database/sql package The driver should be used via the database/sql package: import "database/sql" import _ "github.com/go-sql-driver/mysql" db, err := sql.Open("mysql", "user:password@/dbname") See https://github.com/go-sql-driver/mysql#usage for details
_workspace/src/github.com/gocql/gocql
Package gocql implements a fast and robust Cassandra driver for the Go programming language.
Package gocql implements a fast and robust Cassandra driver for the Go programming language.
_workspace/src/github.com/golang/groupcache/lru
Package lru implements an LRU cache.
Package lru implements an LRU cache.
_workspace/src/github.com/gorilla/context
Package context stores values shared during a request lifetime.
Package context stores values shared during a request lifetime.
_workspace/src/github.com/gorilla/mux
Package gorilla/mux implements a request router and dispatcher.
Package gorilla/mux implements a request router and dispatcher.
_workspace/src/github.com/gorilla/securecookie
Package gorilla/securecookie encodes and decodes authenticated and optionally encrypted cookie values.
Package gorilla/securecookie encodes and decodes authenticated and optionally encrypted cookie values.
_workspace/src/github.com/gorilla/sessions
Package gorilla/sessions provides cookie and filesystem sessions and infrastructure for custom session backends.
Package gorilla/sessions provides cookie and filesystem sessions and infrastructure for custom session backends.
_workspace/src/github.com/jmoiron/sqlx
Package sqlx provides general purpose extensions to database/sql.
Package sqlx provides general purpose extensions to database/sql.
_workspace/src/github.com/jmoiron/sqlx/reflectx
Package reflect implements extensions to the standard reflect lib suitable for implementing marshaling and unmarshaling packages.
Package reflect implements extensions to the standard reflect lib suitable for implementing marshaling and unmarshaling packages.
_workspace/src/github.com/lib/pq
Package pq is a pure Go Postgres driver for the database/sql package.
Package pq is a pure Go Postgres driver for the database/sql package.
_workspace/src/github.com/lib/pq/listen_example
Below you will find a self-contained Go program which uses the LISTEN / NOTIFY mechanism to avoid polling the database while waiting for more work to arrive.
Below you will find a self-contained Go program which uses the LISTEN / NOTIFY mechanism to avoid polling the database while waiting for more work to arrive.
_workspace/src/github.com/lib/pq/oid
Package oid contains OID constants as defined by the Postgres server.
Package oid contains OID constants as defined by the Postgres server.
_workspace/src/github.com/mattes/migrate/driver
Package driver holds the driver interface.
Package driver holds the driver interface.
_workspace/src/github.com/mattes/migrate/driver/bash
Package bash implements the Driver interface.
Package bash implements the Driver interface.
_workspace/src/github.com/mattes/migrate/driver/cassandra
Package cassandra implements the Driver interface.
Package cassandra implements the Driver interface.
_workspace/src/github.com/mattes/migrate/driver/mysql
Package mysql implements the Driver interface.
Package mysql implements the Driver interface.
_workspace/src/github.com/mattes/migrate/driver/postgres
Package postgres implements the Driver interface.
Package postgres implements the Driver interface.
_workspace/src/github.com/mattes/migrate/driver/sqlite3
Package sqlite3 implements the Driver interface.
Package sqlite3 implements the Driver interface.
_workspace/src/github.com/mattes/migrate/file
Package file contains functions for low-level migration files handling.
Package file contains functions for low-level migration files handling.
_workspace/src/github.com/mattes/migrate/migrate
Package migrate is imported by other Go code.
Package migrate is imported by other Go code.
_workspace/src/github.com/mattes/migrate/migrate/direction
Package direction just holds convenience constants for Up and Down migrations.
Package direction just holds convenience constants for Up and Down migrations.
_workspace/src/github.com/mattes/migrate/pipe
Package pipe has functions for pipe channel handling.
Package pipe has functions for pipe channel handling.
_workspace/src/github.com/mattn/go-sqlite3
Package sqlite3 provides interface to SQLite3 databases.
Package sqlite3 provides interface to SQLite3 databases.
_workspace/src/golang.org/x/crypto/bcrypt
Package bcrypt implements Provos and Mazières's bcrypt adaptive hashing algorithm.
Package bcrypt implements Provos and Mazières's bcrypt adaptive hashing algorithm.
_workspace/src/golang.org/x/crypto/blowfish
Package blowfish implements Bruce Schneier's Blowfish encryption algorithm.
Package blowfish implements Bruce Schneier's Blowfish encryption algorithm.
_workspace/src/golang.org/x/net/netutil
Package netutil provides network utility functions, complementing the more common ones in the net package.
Package netutil provides network utility functions, complementing the more common ones in the net package.
_workspace/src/speter.net/go/exp/math/dec/inf
Package inf (type inf.Dec) implements "infinite-precision" decimal arithmetic.
Package inf (type inf.Dec) implements "infinite-precision" decimal arithmetic.
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