3 ##############################################################################
4 # Copyright (c) 2016 Huawei Technologies Co.,Ltd and others.
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Apache License, Version 2.0
8 # which accompanies this distribution, and is available at
9 # http://www.apache.org/licenses/LICENSE-2.0
10 ##############################################################################
12 # Measure network capacity and scale of a host
15 OUTPUT_FILE=/tmp/netperf-out.log
20 netstat -s > $OUTPUT_FILE
23 # write the result to stdout in json format
26 CONNECTIONS=$(awk '/active/{print $1}' $OUTPUT_FILE)
27 FRAMES=$(awk '/total\ packets\ received/{print $1}' $OUTPUT_FILE)
29 \"Number of connections\":\"$CONNECTIONS\", \
30 \"Number of frames received\": \"$FRAMES\" \