No longer measure localhost in kernel-style measurements

This commit is contained in:
Thulinma 2017-01-15 16:22:02 +01:00
parent eed7be8421
commit e4110502ee

View file

@ -1258,14 +1258,15 @@ void Controller::handlePrometheus(HTTP::Parser & H, Socket::Connection & conn, i
netUsage.getline(line, 300); netUsage.getline(line, 300);
long long unsigned sent = 0; long long unsigned sent = 0;
long long unsigned recv = 0; long long unsigned recv = 0;
//std::cout << line; char iface[10];
if (sscanf(line, "%*s %llu %*u %*u %*u %*u %*u %*u %*u %llu", &recv, &sent) == 2){ if (sscanf(line, "%9s %llu %*u %*u %*u %*u %*u %*u %*u %llu", iface, &recv, &sent) == 3){
//std::cout << "Net: " << recv << ", " << sent << std::endl; if (iface[0] != 'l' || iface[1] != 'o'){
bw_down_total += recv; bw_down_total += recv;
bw_up_total += sent; bw_up_total += sent;
} }
} }
} }
}
long long shm_total = 0, shm_free = 0; long long shm_total = 0, shm_free = 0;
#if !defined(__CYGWIN__) && !defined(_WIN32) #if !defined(__CYGWIN__) && !defined(_WIN32)
{ {