dreport: move ipaddr plugin commands into network plugin
Combining all network related commands into network plugin.
Removing iplink plugin and command as it is capturing duplicate
data.
Tested:
root@rain104bmc:/tmp/test/obmcdump_00000000_1649837600# cat network.log
[ip addr]
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
.....
[netstat]
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
.....
Signed-off-by: Marri Devender Rao <devenrao@in.ibm.com>
Change-Id: Ie95865ca729e06fafdf8a6cbc9a9c294c9e4fa34
diff --git a/tools/dreport.d/plugins.d/network b/tools/dreport.d/plugins.d/network
index 3e315cf..661cba5 100644
--- a/tools/dreport.d/plugins.d/network
+++ b/tools/dreport.d/plugins.d/network
@@ -4,12 +4,17 @@
# @brief: Collect network information
#
-. $DREPORT_INCLUDE/functions
+# shellcheck disable=SC1091
+. "$DREPORT_INCLUDE"/functions
file_name="network.log"
+#ip addr
+add_cmd_output "echo $'[ip addr]'" "$file_name" "ip addr"
+add_cmd_output "ip addr" "$file_name" "ip addr"
+
#netstat
-add_cmd_output "echo $'[netstat]'" "$file_name" "netstat"
+add_cmd_output "echo $'\n[netstat]'" "$file_name" "netstat"
add_cmd_output "netstat -nr" "$file_name" "netstat"
#eth0
@@ -37,13 +42,13 @@
#active tcp connections
activetcp="/proc/net/tcp"
if [ -f $activetcp ]; then
- add_cmd_output "echo $'\n[activetcp]'" "$file_name" "activetcp"
- add_cmd_output "cat $activetcp" "$file_name" "activetcp"
+ add_cmd_output "echo $'\n[activetcp]'" "$file_name" "active tcp"
+ add_cmd_output "cat $activetcp" "$file_name" "active tcp"
fi
#Load average
-loadavg="cat /proc/loadavg"
-if [ -f $activetcp ]; then
- add_cmd_output "echo $'\n[Load average]'" "$file_name" "loadaverage"
- add_cmd_output "cat $loadavg" "$file_name" "loadaverage"
+loadavg="/proc/loadavg"
+if [ -f $loadavg ]; then
+ add_cmd_output "echo $'\n[Load average]'" "$file_name" "load average"
+ add_cmd_output "cat $loadavg" "$file_name" "load average"
fi