diff --git a/build.sh b/build.sh old mode 100644 new mode 100755 diff --git a/src/agent/resource_collector.cc b/src/agent/resource_collector.cc index 4b06ed7d..86b23c85 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]);