From 378112e4ccc9c744d88c961c6b8efd90036200f6 Mon Sep 17 00:00:00 2001 From: ontologyzsy <69257877@qq.com> Date: Fri, 8 Jan 2016 19:53:11 +0800 Subject: [PATCH 1/2] adapt to multi-netcards --- src/agent/resource_collector.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/agent/resource_collector.cc b/src/agent/resource_collector.cc index 20b3916d..5a0d21bc 100755 --- a/src/agent/resource_collector.cc +++ b/src/agent/resource_collector.cc @@ -574,11 +574,14 @@ bool GlobalResourceCollector::GetGlobalNetStat() { boost::split(lines, content, boost::is_any_of("\n")); for (size_t n = 0; n < lines.size(); n++) { std::string line = lines[n]; - if (line.find("eth0") != std::string::npos || - line.find("xgbe0") != std::string::npos) { + if (line.find("eth") != std::string::npos || + line.find("xgbe") != std::string::npos) { boost::trim(line); std::vector parts; boost::split(parts, line, boost::is_any_of(" "), boost::token_compress_on); + if (boost::lexical_cast(parts[1]) == 0) { + continue; + } std::vector tokens; boost::split(tokens, parts[0], boost::is_any_of(":")); stat_->cur_stat_.net_in_bits = boost::lexical_cast(tokens[1]); From c9e0fd53b89fa70f60c6637f0d0fa3ee8995f8a2 Mon Sep 17 00:00:00 2001 From: ontologyzsy <69257877@qq.com> Date: Thu, 14 Jan 2016 10:51:57 +0800 Subject: [PATCH 2/2] merge build --- build.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 build.sh diff --git a/build.sh b/build.sh old mode 100644 new mode 100755