summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorOndrej Fabry <ofabry@cisco.com>2019-07-19 05:42:41 +0200
committerOndrej Fabry <ofabry@cisco.com>2019-07-19 05:42:41 +0200
commitbde85d422c7949ec32fb067e9c36320ccc47fb9e (patch)
tree10203b958ed04f12da7556356b5dcf3f70571bc7 /examples
parent4dca07c803308611275f78b490ac0352c1052fe2 (diff)
Print info for users to stderr when socket files are missing
Change-Id: Ibdbfcb78b05cf80945a93ed424a7a2a03b6ea06d Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/stats-api/README.md2
-rw-r--r--examples/stats-api/stats_api.go12
2 files changed, 7 insertions, 7 deletions
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)
}