Monitor your Tezos node.
To install the CLI, use the following go get
command or check the releases
page.
$> go get github.com/bobheadxi/tezos-watcher/cmd/tezos-watcher
Get the Tezos Alphanet up and running. Make sure to start up a node with the RPC endpoints exposed - for example:
$> ./alphanet.sh start --rpc-port 8732
Optionally grab some free Tezzies to start off.
You can now start watching your local node:
$> tezos-watcher watch-chain
The -h
flag offers documentation on the command line tool.
w, _ := watcher.New(watcher.ConnectOpts{
Host: "127.0.0.1", Port: "8732"})
quit := make(chan struct{})
defer close(quit)
statusCh, errCh := w.WatchBlock(watcher.BlockOptions{
Chain: "main",
Block: "head",
Rate: 1 * time.Second,
}, quit)
for {
select {
case err := <-errCh:
if err != nil {
return
}
case event := <-statusCh:
output, _ := json.Marshal(event)
println(string(output))
}
}
$> make # install dependencies, install tezos-watcher CLI
$> make node # start up Tezos sandbox node
$> make test # execute tests against sandbox node
This project was written as part of a pre-task for a job.