Skip to content

Expose hardware info using JSON/REST, publish to Kafka and provide a system HTML Front-End.

License

Notifications You must be signed in to change notification settings

imc-trading/peekaboo

Repository files navigation

Expose hardware info using a REST API written in Go and a Front-End written in AngularJS.

FrontEnd

http://myserver.example.com:5050

BackEnd

Endpoints

/api/docker
/api/docker/containers
/api/docker/images
/api/network
/api/network/interfaces
/api/network/routes
/api/storage/disks
/api/storage/lvm/logvols
/api/storage/lvm/physvols
/api/storage/lvm/volgrps
/api/storage/mounts
/api/system
/api/system/cpu
/api/system/ipmi
/api/system/memory
/api/system/os
/api/system/pcicards
/api/system/rpms
/api/system/sysctls
/api/system/kernel/config
/api/system/kernel/modules

Methods

GET

curl -i -X GET http://<host>:<port>/api/system?envelope=true

PURGE

Purge cache i.e. next get request will refresh the cache.

curl -i -X PURGE http://<host>:<port>/api/system?envelope=true

Options

envelope

Include an envelope with error, cache and status information.

?envelope=true

Example:

{
  "cache": {
    "lastUpdated": "...",
    "timeoutSec": 0,
    "fromCache": false
  },
  "data": {
  },
  "error": [],
  "status": 200
}

refresh

Refresh cache.

?refresh=true

indent

Don't indent JSON.

?indent=false

Example:

curl http://myserver.example.com:5050/api/system

Usage

Peekaboo

Usage:
  peekaboo daemon [--debug] [--bind=<addr>] [--static=<dir>]
  peekaboo list
  peekaboo get <hardware-type>
  peekaboo -h | --help
  peekaboo --version

Commands:
  daemon               Start as a daemon serving HTTP requests.
  list                 List hardware names available.
  get                  Return information about hardware.

Arguments:
  hardware-type        Name of hardware to return information about.

Options:
  -h --help            Show this screen.
  --version            Show version.
  -d --debug           Debug.
  -b --bind=<addr>     Bind to address and port. [default: 0.0.0.0:5050]
  -s --static=<dir>    Directory for static content. [default: static]

Setup Go on Linux

sudo yum install -y golang
mkdir ~/go
export GOPATH=~/go
export PATH=$GOPATH/bin:$PATH
go get github.com/constabulary/gb/...

Build and run

gb build
sudo bin/peekaboo daemon -d

Build RPM

Fiest make sure you have Docker configured.

make rpm

Change configuration

systemctl stop peekaboo
vi /etc/sysconfig/peekaboo

Change port to 8080.

Example:

OPTIONS="--bind 0.0.0.0:8080"

Reload SystemD and then restart Peekaboo.

systemctl start peekaboo

Install using Brew on Mac OS X

brew tap mickep76/funk-gnarge
brew install peekaboo
ln -sfv /usr/local/opt/peekaboo/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.peekaboo.plist

Change configuration

launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.peekaboo.plist
vi ~/Library/LaunchAgents/homebrew.mxcl.peekaboo.plist

Change port to 8080.

Example:

...
    <string>--bind</string>
    <string>0.0.0.0:8080</string>
..

Restart Peekaboo.

launchctl load ~/Library/LaunchAgents/homebrew.mxcl.peekaboo.plist

About

Expose hardware info using JSON/REST, publish to Kafka and provide a system HTML Front-End.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •