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/ipaddr b/tools/dreport.d/plugins.d/ipaddr
deleted file mode 100644
index 3f1159f..0000000
--- a/tools/dreport.d/plugins.d/ipaddr
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/bash
-#
-# config: 2 30
-# @brief: Collect ip addr information.
-#
-
-. $DREPORT_INCLUDE/functions
-
-desc="ip addr"
-file_name="ipaddr.log"
-command="ip addr"
-
-add_cmd_output "$command" "$file_name" "$desc"
diff --git a/tools/dreport.d/plugins.d/iplink b/tools/dreport.d/plugins.d/iplink
deleted file mode 100644
index 5cc075f..0000000
--- a/tools/dreport.d/plugins.d/iplink
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/bash
-#
-# config: 2 30
-# @brief: Collect ip link information.
-#
-
-. $DREPORT_INCLUDE/functions
-
-desc="ip link"
-file_name="iplink.log"
-command="ip link"
-
-add_cmd_output "$command" "$file_name" "$desc"
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