From bde85d422c7949ec32fb067e9c36320ccc47fb9e Mon Sep 17 00:00:00 2001 From: Ondrej Fabry Date: Fri, 19 Jul 2019 05:42:41 +0200 Subject: Print info for users to stderr when socket files are missing Change-Id: Ibdbfcb78b05cf80945a93ed424a7a2a03b6ea06d Signed-off-by: Ondrej Fabry --- examples/stats-api/README.md | 2 +- examples/stats-api/stats_api.go | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'examples') diff --git a/examples/stats-api/README.md b/examples/stats-api/README.md index 5511bf4..f3d33b1 100644 --- a/examples/stats-api/README.md +++ b/examples/stats-api/README.md @@ -6,7 +6,7 @@ This example demonstrates how to retrieve statistics from VPP using [the new Sta The following requirements are required to run this example: -- install **VPP 18.10+** (VPP 19.04+ for goclient) +- install VPP **18.10+** (VPP 19.04+ for statsclient) - enable stats in VPP To enable stats add following section to you VPP config: diff --git a/examples/stats-api/stats_api.go b/examples/stats-api/stats_api.go index a42e3d2..175bb27 100644 --- a/examples/stats-api/stats_api.go +++ b/examples/stats-api/stats_api.go @@ -35,10 +35,9 @@ import ( // ------------------------------------------------------------------ var ( - statsSocket = flag.String("socket", adapter.DefaultStatsSocket, "Path to VPP stats socket") + statsSocket = flag.String("socket", statsclient.DefaultSocketName, "Path to VPP stats socket") dumpAll = flag.Bool("all", false, "Dump all stats including ones with zero values") - - goclient = flag.Bool("goclient", false, "Use pure Go client for stats API") + oldclient = flag.Bool("oldclient", false, "Use old client for stats API (vppapiclient)") ) func init() { @@ -66,10 +65,10 @@ func main() { } var client adapter.StatsAPI - if *goclient { - client = statsclient.NewStatsClient(*statsSocket) - } else { + if *oldclient { client = vppapiclient.NewStatClient(*statsSocket) + } else { + client = statsclient.NewStatsClient(*statsSocket) } fmt.Printf("Connecting to stats socket: %s\n", *statsSocket) @@ -138,6 +137,7 @@ func main() { case "dump": dumpStats(client, patterns, skipZeros) + default: listStats(client, patterns) } -- cgit 1.2.3-korg