summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2024-04-09 16:56:26 +0200
committerGitHub <noreply@github.com>2024-04-09 16:56:26 +0200
commit28e8233baae54ce8a02b62361189ad26168c4b98 (patch)
treef0ff22cb7f912a7f1b4d2139f13d84917fb766ee /src
parent41abc307f4236bb68b1b6a2ba0f2a8eec6b3b314 (diff)
parent13ed4f9d489dd5b8ee80c5f2fdebf1b0565e9137 (diff)
downloadvyos-1x-28e8233baae54ce8a02b62361189ad26168c4b98.tar.gz
vyos-1x-28e8233baae54ce8a02b62361189ad26168c4b98.zip
Merge pull request #3280 from sever-sever/T5858
T5858: Fix op-mode format for show conntrack statistics
Diffstat (limited to 'src')
-rwxr-xr-xsrc/op_mode/conntrack.py23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/op_mode/conntrack.py b/src/op_mode/conntrack.py
index 5687b9b00..c379c3e60 100755
--- a/src/op_mode/conntrack.py
+++ b/src/op_mode/conntrack.py
@@ -62,7 +62,7 @@ def _get_raw_data(family):
def _get_raw_statistics():
entries = []
- data = cmd('sudo conntrack -S')
+ data = cmd('sudo conntrack --stats')
data = data.replace(' \t', '').split('\n')
for entry in data:
entries.append(entry.split())
@@ -70,8 +70,25 @@ def _get_raw_statistics():
def get_formatted_statistics(entries):
- headers = ["CPU", "Found", "Invalid", "Insert", "Insert fail", "Drop", "Early drop", "Errors", "Search restart"]
- output = tabulate(entries, headers, numalign="left")
+ headers = [
+ "CPU",
+ "Found",
+ "Invalid",
+ "Insert",
+ "Insert fail",
+ "Drop",
+ "Early drop",
+ "Errors",
+ "Search restart",
+ "",
+ "",
+ ]
+ # Process each entry to extract and format the values after '='
+ processed_entries = [
+ [value.split('=')[-1] for value in entry]
+ for entry in entries
+ ]
+ output = tabulate(processed_entries, headers, numalign="left")
return output