Skip to content
This repository was archived by the owner on May 28, 2019. It is now read-only.

Commit c12f826

Browse files
committed
Merge pull request #295 from ontologyzsy/master
adapt to multi-netcards
2 parents c29f386 + 37a19a6 commit c12f826

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

build.sh

100644100755
File mode changed.

src/agent/resource_collector.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -574,11 +574,14 @@ bool GlobalResourceCollector::GetGlobalNetStat() {
574574
boost::split(lines, content, boost::is_any_of("\n"));
575575
for (size_t n = 0; n < lines.size(); n++) {
576576
std::string line = lines[n];
577-
if (line.find("eth0") != std::string::npos ||
578-
line.find("xgbe0") != std::string::npos) {
577+
if (line.find("eth") != std::string::npos ||
578+
line.find("xgbe") != std::string::npos) {
579579
boost::trim(line);
580580
std::vector<std::string> parts;
581581
boost::split(parts, line, boost::is_any_of(" "), boost::token_compress_on);
582+
if (boost::lexical_cast<int64_t>(parts[1]) == 0) {
583+
continue;
584+
}
582585
std::vector<std::string> tokens;
583586
boost::split(tokens, parts[0], boost::is_any_of(":"));
584587
stat_->cur_stat_.net_in_bits = boost::lexical_cast<int64_t>(tokens[1]);

0 commit comments

Comments
 (0)