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

Commit

Permalink
Merge pull request #295 from ontologyzsy/master
Browse files Browse the repository at this point in the history
adapt to multi-netcards
  • Loading branch information
imotai committed Jan 14, 2016
2 parents c29f386 + 37a19a6 commit c12f826
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Empty file modified build.sh
100644 → 100755
Empty file.
7 changes: 5 additions & 2 deletions src/agent/resource_collector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string> parts;
boost::split(parts, line, boost::is_any_of(" "), boost::token_compress_on);
if (boost::lexical_cast<int64_t>(parts[1]) == 0) {
continue;
}
std::vector<std::string> tokens;
boost::split(tokens, parts[0], boost::is_any_of(":"));
stat_->cur_stat_.net_in_bits = boost::lexical_cast<int64_t>(tokens[1]);
Expand Down

0 comments on commit c12f826

Please sign in to comment.