diff --git a/system/system_monitor/CMakeLists.txt b/system/system_monitor/CMakeLists.txt
index 97eddcb590a5f..391c82a09c960 100644
--- a/system/system_monitor/CMakeLists.txt
+++ b/system/system_monitor/CMakeLists.txt
@@ -118,7 +118,8 @@ ament_auto_add_executable(hdd_reader
)
ament_auto_add_executable(traffic_reader
- reader/traffic_reader/traffic_reader.cpp
+ reader/traffic_reader/traffic_reader_main.cpp
+ reader/traffic_reader/traffic_reader_service.cpp
)
find_library(NL3 nl-3 REQUIRED)
diff --git a/system/system_monitor/README.md b/system/system_monitor/README.md
index 87107d3937a82..6203ad45d4b3a 100644
--- a/system/system_monitor/README.md
+++ b/system/system_monitor/README.md
@@ -73,7 +73,8 @@ Every topic is published in 1 minute interval.
| | HDD WriteIOPS | ✓ | ✓ | ✓ | |
| | HDD Connection | ✓ | ✓ | ✓ | |
| Memory Monitor | Memory Usage | ✓ | ✓ | ✓ | |
-| Net Monitor | Network Usage | ✓ | ✓ | ✓ | |
+| Net Monitor | Network Connection | ✓ | ✓ | ✓ | |
+| | Network Usage | ✓ | ✓ | ✓ | Notification of usage only, normally error not generated. |
| | Network CRC Error | ✓ | ✓ | ✓ | Warning occurs when the number of CRC errors in the period reaches the threshold value. The number of CRC errors that occur is the same as the value that can be confirmed with the ip command. |
| | IP Packet Reassembles Failed | ✓ | ✓ | ✓ | |
| NTP Monitor | NTP Offset | ✓ | ✓ | ✓ | |
diff --git a/system/system_monitor/config/net_monitor.param.yaml b/system/system_monitor/config/net_monitor.param.yaml
index cb7e1b48380a3..f2c68adda2efe 100644
--- a/system/system_monitor/config/net_monitor.param.yaml
+++ b/system/system_monitor/config/net_monitor.param.yaml
@@ -1,7 +1,6 @@
/**:
ros__parameters:
devices: ["*"]
- traffic_reader_port: 7636
monitor_program: "greengrass"
crc_error_check_duration: 1
crc_error_count_threshold: 1
diff --git a/system/system_monitor/docs/ros_parameters.md b/system/system_monitor/docs/ros_parameters.md
index bba2c3fb40408..1d081d513c85c 100644
--- a/system/system_monitor/docs/ros_parameters.md
+++ b/system/system_monitor/docs/ros_parameters.md
@@ -61,14 +61,14 @@ mem_monitor:
net_monitor:
-| Name | Type | Unit | Default | Notes |
-| :-------------------------------- | :----------: | :-----: | :-----: | :--------------------------------------------------------------------------------------------------------------------------------------------------- |
-| devices | list[string] | n/a | none | The name of network interface to monitor. (e.g. eth0, \* for all network interfaces) |
-| usage_warn | float | %(1e-2) | 0.95 | Generates warning when network usage reaches a specified value or higher. |
-| crc_error_check_duration | int | sec | 1 | CRC error check duration. |
-| crc_error_count_threshold | int | n/a | 1 | Generates warning when count of CRC errors during CRC error check duration reaches a specified value or higher. |
-| reassembles_failed_check_duration | int | sec | 1 | IP packet reassembles failed check duration. |
-| reassembles_failed_check_count | int | n/a | 1 | Generates warning when count of IP packet reassembles failed during IP packet reassembles failed check duration reaches a specified value or higher. |
+| Name | Type | Unit | Default | Notes |
+| :-------------------------------- | :----------: | :--: | :--------: | :--------------------------------------------------------------------------------------------------------------------------------------------------- |
+| devices | list[string] | n/a | none | The name of network interface to monitor. (e.g. eth0, \* for all network interfaces) |
+| monitor_program | string | n/a | greengrass | program name to be monitored by nethogs name. |
+| crc_error_check_duration | int | sec | 1 | CRC error check duration. |
+| crc_error_count_threshold | int | n/a | 1 | Generates warning when count of CRC errors during CRC error check duration reaches a specified value or higher. |
+| reassembles_failed_check_duration | int | sec | 1 | IP packet reassembles failed check duration. |
+| reassembles_failed_check_count | int | n/a | 1 | Generates warning when count of IP packet reassembles failed during IP packet reassembles failed check duration reaches a specified value or higher. |
## NTP Monitor
diff --git a/system/system_monitor/docs/topics_net_monitor.md b/system/system_monitor/docs/topics_net_monitor.md
index d223b359cdb08..edb067c0a5be7 100644
--- a/system/system_monitor/docs/topics_net_monitor.md
+++ b/system/system_monitor/docs/topics_net_monitor.md
@@ -1,5 +1,23 @@
# ROS topics: Net Monitor
+## Network Connection
+
+/diagnostics/net_monitor: Network Connection
+
+[summary]
+
+| level | message |
+| ----- | -------------- |
+| OK | OK |
+| WARN | no such device |
+
+[values]
+
+| key | value (example) |
+| --------------------- | ------------------- |
+| Network [0-9]: status | OK / no such device |
+| HDD [0-9]: name | wlp82s0 |
+
## Network Usage
/diagnostics/net_monitor: Network Usage
@@ -38,31 +56,19 @@
| ----- | ------- |
| OK | OK |
-[values] program
+[values when specified program is detected]
| key | value (example) |
| -------------------------------- | ------------------------------------------- |
-| nethogs [0-9]: PROGRAM | /lambda/greengrassSystemComponents/1384/999 |
-| nethogs [0-9]: SENT (KB/Sec) | 1.13574 |
-| nethogs [0-9]: RECEIVED (KB/Sec) | 0.261914 |
-
-[values] all
-
-| key | value (example) |
-| --------------------- | -------------------------------------------------------------- |
-| nethogs: all (KB/Sec) | python3.7/1520/999 0.274414 0.354883 |
-| | /lambda/greengrassSystemComponents/1299/999 0.487305 0.0966797 |
-| | sshd: muser@pts/5/15917/1002 0.396094 0.0585938 |
-| | /usr/bin/python3.7/2371/999 0 0 |
-| | /greengrass/ggc/packages/1.10.0/bin/daemon/906/0 0 0 |
-| | python3.7/4362/999 0 0 |
-| | unknown TCP/0/0 0 0 |
+| nethogs [0-9]: program | /lambda/greengrassSystemComponents/1384/999 |
+| nethogs [0-9]: sent (KB/Sec) | 1.13574 |
+| nethogs [0-9]: received (KB/Sec) | 0.261914 |
-[values] error
+[values when error is occurring]
-| key | value (example) |
-| ----- | ----------------------------------------------------- |
-| error | [nethogs -t] execve failed: No such file or directory |
+| key | value (example) |
+| ----- | ---------------------------------------- |
+| error | execve failed: No such file or directory |
## Network CRC Error
@@ -70,9 +76,10 @@
[summary]
-| level | message |
-| ----- | ------- |
-| OK | OK |
+| level | message |
+| ----- | --------- |
+| OK | OK |
+| WARN | CRC error |
[values]
diff --git a/system/system_monitor/include/system_monitor/net_monitor/net_monitor.hpp b/system/system_monitor/include/system_monitor/net_monitor/net_monitor.hpp
index 3ddb078fa00e1..ded9c398c6cd1 100644
--- a/system/system_monitor/include/system_monitor/net_monitor/net_monitor.hpp
+++ b/system/system_monitor/include/system_monitor/net_monitor/net_monitor.hpp
@@ -21,207 +21,290 @@
#define SYSTEM_MONITOR__NET_MONITOR__NET_MONITOR_HPP_
#include "system_monitor/net_monitor/nl80211.hpp"
+#include "traffic_reader/traffic_reader_common.hpp"
#include
+#include
+
#include
#include
#include