Created
September 10, 2019 17:55
-
-
Save ripienaar/912b073487acc16ca75f2abaf50ef3a5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"fmt" | |
cc "github.com/ripienaar/rpcwrapperpoc/choriautil" | |
) | |
func main() { | |
c, err := cc.New() | |
if err != nil { | |
panic(err) | |
} | |
ctx, cancel := context.WithCancel(context.Background()) | |
defer cancel() | |
res, err := c.OptionFactFilter("country=mt").Info().Do(ctx) | |
if err != nil { | |
panic(err) | |
} | |
res.EachOutput(func(r *cc.InfoOutput) { | |
fmt.Printf("%s: %#v\n", r.ResultDetails().Sender(), r.ClientStats()) | |
}) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% choria req choria_util info -I `hostname` -j|jq '.replies|.[]|.data.client_stats' | |
{ | |
"in_msgs": 209, | |
"out_msgs": 238, | |
"in_bytes": 1010967, | |
"out_bytes": 263311, | |
"reconnects": 1 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% go run cmd/info/main.go <19:49:40 | |
dev1.devco.net: map[string]interface {}{"in_bytes":1.020613e+06, "in_msgs":211, "out_bytes":266941, "out_msgs":240, "reconnects":1} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment