Skip to content

Commit cb7ba6b

Browse files
authored
feature: add net collector (alibaba#2265)
* feature: add net collector * fix net ut * fix net collector and add m label in system collector
1 parent 2e387bf commit cb7ba6b

15 files changed

Lines changed: 1353 additions & 14 deletions

core/host_monitor/Constants.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ std::filesystem::path PROCESS_DIR = "/proc";
2424
const std::filesystem::path PROCESS_STAT = "stat";
2525
const std::filesystem::path PROCESS_LOADAVG = "loadavg";
2626
const std::filesystem::path PROCESS_MEMINFO = "meminfo";
27+
const std::filesystem::path PROCESS_NET_SOCKSTAT = "net/sockstat";
28+
const std::filesystem::path PROCESS_NET_SOCKSTAT6 = "net/sockstat6";
29+
const std::filesystem::path PROCESS_NET_DEV = "net/dev";
30+
const std::filesystem::path PROCESS_NET_IF_INET6 = "net/if_inet6";
2731
const int64_t SYSTEM_HERTZ = sysconf(_SC_CLK_TCK);
2832

2933
} // namespace logtail

core/host_monitor/Constants.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ extern std::filesystem::path PROCESS_DIR;
2626
const extern std::filesystem::path PROCESS_STAT;
2727
const extern std::filesystem::path PROCESS_LOADAVG;
2828
const extern std::filesystem::path PROCESS_MEMINFO;
29+
30+
const extern std::filesystem::path PROCESS_NET_SOCKSTAT;
31+
const extern std::filesystem::path PROCESS_NET_SOCKSTAT6;
32+
const extern std::filesystem::path PROCESS_NET_DEV;
33+
const extern std::filesystem::path PROCESS_NET_IF_INET6;
2934
const extern int64_t SYSTEM_HERTZ;
3035

3136
#ifdef __ENTERPRISE__

core/host_monitor/HostMonitorInputRunner.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include "host_monitor/HostMonitorTimerEvent.h"
3838
#include "host_monitor/collector/CPUCollector.h"
3939
#include "host_monitor/collector/MemCollector.h"
40+
#include "host_monitor/collector/NetCollector.h"
4041
#include "host_monitor/collector/ProcessEntityCollector.h"
4142
#include "host_monitor/collector/SystemCollector.h"
4243
#include "logger/Logger.h"
@@ -58,6 +59,7 @@ HostMonitorInputRunner::HostMonitorInputRunner() {
5859
RegisterCollector<CPUCollector>();
5960
RegisterCollector<SystemCollector>();
6061
RegisterCollector<MemCollector>();
62+
RegisterCollector<NetCollector>();
6163

6264
size_t threadPoolSize = 1;
6365
// threadPoolSize should be greater than 0

0 commit comments

Comments
 (0)