summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@oath.com>2018-03-13 17:20:52 +0100
committerGitHub <noreply@github.com>2018-03-13 17:20:52 +0100
commitde4cc8c0b294421f13a7be86463a1fa1cd439449 (patch)
tree544d3b08e7aad05aee76ce3f4cdbfc05d146621e
parent6efe23abadd6a6c2ed26ae30cee0c87e1c320b1c (diff)
parent37a4f6d3f7d39f6ecd5af3b7c8ac659e07612e95 (diff)
Merge pull request #5318 from vespa-engine/geirst/remove-unused-reporters-from-host-info
Remove unused reporters from host info (cpu, disk, memory, network).
-rw-r--r--storage/src/tests/common/hostreporter/CMakeLists.txt4
-rw-r--r--storage/src/tests/common/hostreporter/cpureportertest.cpp39
-rw-r--r--storage/src/tests/common/hostreporter/diskreportertest.cpp32
-rw-r--r--storage/src/tests/common/hostreporter/hostinfotest.cpp3
-rw-r--r--storage/src/tests/common/hostreporter/memreportertest.cpp43
-rw-r--r--storage/src/tests/common/hostreporter/networkreportertest.cpp39
-rw-r--r--storage/src/vespa/storage/common/hostreporter/CMakeLists.txt4
-rw-r--r--storage/src/vespa/storage/common/hostreporter/cpureporter.cpp144
-rw-r--r--storage/src/vespa/storage/common/hostreporter/cpureporter.h19
-rw-r--r--storage/src/vespa/storage/common/hostreporter/diskreporter.cpp67
-rw-r--r--storage/src/vespa/storage/common/hostreporter/diskreporter.h19
-rw-r--r--storage/src/vespa/storage/common/hostreporter/hostinfo.cpp7
-rw-r--r--storage/src/vespa/storage/common/hostreporter/hostinfo.h15
-rw-r--r--storage/src/vespa/storage/common/hostreporter/memreporter.cpp71
-rw-r--r--storage/src/vespa/storage/common/hostreporter/memreporter.h19
-rw-r--r--storage/src/vespa/storage/common/hostreporter/networkreporter.cpp48
-rw-r--r--storage/src/vespa/storage/common/hostreporter/networkreporter.h19
17 files changed, 6 insertions, 586 deletions
diff --git a/storage/src/tests/common/hostreporter/CMakeLists.txt b/storage/src/tests/common/hostreporter/CMakeLists.txt
index 11a4c0f3f0b..bfc49299186 100644
--- a/storage/src/tests/common/hostreporter/CMakeLists.txt
+++ b/storage/src/tests/common/hostreporter/CMakeLists.txt
@@ -1,11 +1,7 @@
# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
vespa_add_library(storage_testhostreporter TEST
SOURCES
- cpureportertest.cpp
- diskreportertest.cpp
hostinfotest.cpp
- memreportertest.cpp
- networkreportertest.cpp
util.cpp
versionreportertest.cpp
DEPENDS
diff --git a/storage/src/tests/common/hostreporter/cpureportertest.cpp b/storage/src/tests/common/hostreporter/cpureportertest.cpp
deleted file mode 100644
index 150362a91ba..00000000000
--- a/storage/src/tests/common/hostreporter/cpureportertest.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/log/log.h>
-#include <vespa/storage/common/hostreporter/cpureporter.h>
-#include <vespa/vdstestlib/cppunit/macros.h>
-#include <vespa/vespalib/data/slime/slime.h>
-#include <vespa/vespalib/util/jsonstream.h>
-#include "util.h"
-
-LOG_SETUP(".test.cpureporter");
-
-namespace storage {
-namespace {
-using Object = vespalib::JsonStream::Object;
-using End = vespalib::JsonStream::End;
-}
-
-struct CpuReporterTest : public CppUnit::TestFixture
-{
- void testCpuReporter();
-
- CPPUNIT_TEST_SUITE(CpuReporterTest);
- CPPUNIT_TEST(testCpuReporter);
- CPPUNIT_TEST_SUITE_END();
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(CpuReporterTest);
-
-void
-CpuReporterTest::testCpuReporter()
-{
- CpuReporter cpuReporter;
- vespalib::Slime slime;
- util::reporterToSlime(cpuReporter, slime);
- CPPUNIT_ASSERT(1.0 <= slime.get()["cpu"]["context switches"].asDouble());
- CPPUNIT_ASSERT(1.0 <= slime.get()["cpu"]["cputotal"]["user"].asDouble());
- CPPUNIT_ASSERT(1.0 <= slime.get()["cpu"]["cputotal"]["user"].asDouble());
- CPPUNIT_ASSERT(1.0 <= slime.get()["cpu"]["cputotal"]["user"].asDouble());
-}
-} // storage
diff --git a/storage/src/tests/common/hostreporter/diskreportertest.cpp b/storage/src/tests/common/hostreporter/diskreportertest.cpp
deleted file mode 100644
index 373e35caae4..00000000000
--- a/storage/src/tests/common/hostreporter/diskreportertest.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/log/log.h>
-#include <vespa/storage/common/hostreporter/diskreporter.h>
-#include <vespa/vdstestlib/cppunit/macros.h>
-#include <vespa/vespalib/data/slime/slime.h>
-#include <vespa/vespalib/util/jsonstream.h>
-#include "util.h"
-
-LOG_SETUP(".test.diskreporter");
-
-namespace storage {
-
-struct DiskReporterTest : public CppUnit::TestFixture
-{
- void testDiskReporter();
-
- CPPUNIT_TEST_SUITE(DiskReporterTest);
- CPPUNIT_TEST(testDiskReporter);
- CPPUNIT_TEST_SUITE_END();
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(DiskReporterTest);
-
-void
-DiskReporterTest::testDiskReporter()
-{
- DiskReporter diskReporter;
- vespalib::Slime slime;
- util::reporterToSlime(diskReporter, slime);
- CPPUNIT_ASSERT(0 < slime.get()["disk"].toString().size());
-}
-} // storage
diff --git a/storage/src/tests/common/hostreporter/hostinfotest.cpp b/storage/src/tests/common/hostreporter/hostinfotest.cpp
index 9869970c443..418884c2a38 100644
--- a/storage/src/tests/common/hostreporter/hostinfotest.cpp
+++ b/storage/src/tests/common/hostreporter/hostinfotest.cpp
@@ -51,8 +51,7 @@ HostInfoReporterTest::testHostInfoReporter()
vespalib::Slime slime;
JsonFormat::decode(Memory(jsonData), slime);
CPPUNIT_ASSERT(slime.get()["dummy"]["foo"].asString() == "bar");
- CPPUNIT_ASSERT(0 < slime.get()["network"]["lo"]["input"]["packets"].asLong());
- CPPUNIT_ASSERT(1.0 <= slime.get()["cpu"]["context switches"].asDouble());
+ CPPUNIT_ASSERT(!slime.get()["vtag"]["version"].asString().make_string().empty());
}
} // storage
diff --git a/storage/src/tests/common/hostreporter/memreportertest.cpp b/storage/src/tests/common/hostreporter/memreportertest.cpp
deleted file mode 100644
index 541ec52ed5a..00000000000
--- a/storage/src/tests/common/hostreporter/memreportertest.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/log/log.h>
-#include <vespa/storage/common/hostreporter/memreporter.h>
-#include <vespa/vdstestlib/cppunit/macros.h>
-#include <vespa/vespalib/data/slime/slime.h>
-#include <vespa/vespalib/util/jsonstream.h>
-#include "util.h"
-
-LOG_SETUP(".test.memreporter");
-
-namespace storage {
-namespace {
-using Object = vespalib::JsonStream::Object;
-using End = vespalib::JsonStream::End;
-}
-
-struct MemReporterTest : public CppUnit::TestFixture
-{
- void testMemReporter();
-
- CPPUNIT_TEST_SUITE(MemReporterTest);
- CPPUNIT_TEST(testMemReporter);
- CPPUNIT_TEST_SUITE_END();
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(MemReporterTest);
-
-void
-MemReporterTest::testMemReporter()
-{
- MemReporter memReporter;
- vespalib::Slime slime;
- util::reporterToSlime(memReporter, slime);
- CPPUNIT_ASSERT(0 < slime.get()["memory"]["total memory"].asLong());
- CPPUNIT_ASSERT(0 < slime.get()["memory"]["free memory"].asLong());
- CPPUNIT_ASSERT(0 < slime.get()["memory"]["disk cache"].asLong());
- CPPUNIT_ASSERT(0 < slime.get()["memory"]["active memory"].asLong());
- CPPUNIT_ASSERT(0 < slime.get()["memory"]["inactive memory"].asLong());
- CPPUNIT_ASSERT(0 <= slime.get()["memory"]["swap total"].asLong());
- CPPUNIT_ASSERT(0 <= slime.get()["memory"]["swap free"].asLong());
- CPPUNIT_ASSERT(0 < slime.get()["memory"]["dirty"].asLong());
-}
-} // storage
diff --git a/storage/src/tests/common/hostreporter/networkreportertest.cpp b/storage/src/tests/common/hostreporter/networkreportertest.cpp
deleted file mode 100644
index 192da3262ed..00000000000
--- a/storage/src/tests/common/hostreporter/networkreportertest.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/log/log.h>
-#include <vespa/storage/common/hostreporter/networkreporter.h>
-#include <vespa/vdstestlib/cppunit/macros.h>
-#include <vespa/vespalib/data/slime/slime.h>
-#include <vespa/vespalib/util/jsonstream.h>
-#include "util.h"
-
-LOG_SETUP(".test.networkreporter");
-
-namespace storage {
-namespace {
-using Object = vespalib::JsonStream::Object;
-using End = vespalib::JsonStream::End;
-}
-
-struct NetworkReporterTest : public CppUnit::TestFixture
-{
- void testNetworkReporter();
-
- CPPUNIT_TEST_SUITE(NetworkReporterTest);
- CPPUNIT_TEST(testNetworkReporter);
- CPPUNIT_TEST_SUITE_END();
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(NetworkReporterTest);
-
-void
-NetworkReporterTest::testNetworkReporter()
-{
- NetworkReporter networkReporter;
- vespalib::Slime slime;
- util::reporterToSlime(networkReporter, slime);
- CPPUNIT_ASSERT(0 < slime.get()["network"]["lo"]["input"]["bytes"].asLong());
- CPPUNIT_ASSERT(0 < slime.get()["network"]["lo"]["input"]["packets"].asLong());
- CPPUNIT_ASSERT(0 < slime.get()["network"]["lo"]["output"]["bytes"].asLong());
- CPPUNIT_ASSERT(0 < slime.get()["network"]["lo"]["output"]["packets"].asLong());
-}
-} // storage
diff --git a/storage/src/vespa/storage/common/hostreporter/CMakeLists.txt b/storage/src/vespa/storage/common/hostreporter/CMakeLists.txt
index 1cc10b47767..1a03165801d 100644
--- a/storage/src/vespa/storage/common/hostreporter/CMakeLists.txt
+++ b/storage/src/vespa/storage/common/hostreporter/CMakeLists.txt
@@ -1,12 +1,8 @@
# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
vespa_add_library(storage_hostreporter OBJECT
SOURCES
- cpureporter.cpp
- diskreporter.cpp
hostinfo.cpp
kernelmetrictool.cpp
- memreporter.cpp
- networkreporter.cpp
versionreporter.cpp
DEPENDS
AFTER
diff --git a/storage/src/vespa/storage/common/hostreporter/cpureporter.cpp b/storage/src/vespa/storage/common/hostreporter/cpureporter.cpp
deleted file mode 100644
index d176081572c..00000000000
--- a/storage/src/vespa/storage/common/hostreporter/cpureporter.cpp
+++ /dev/null
@@ -1,144 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include "cpureporter.h"
-#include "kernelmetrictool.h"
-#include <vespa/vespalib/io/fileutil.h>
-#include <vespa/vespalib/text/stringtokenizer.h>
-
-#include <vespa/log/bufferedlogger.h>
-LOG_SETUP(".cpureporter");
-
-namespace storage {
-namespace {
-
-using Object = vespalib::JsonStream::Object;
-using End = vespalib::JsonStream::End;
-using kernelmetrictool::readFile;
-using kernelmetrictool::getLine;
-using kernelmetrictool::getTokenCount;
-using kernelmetrictool::getToken;
-using kernelmetrictool::toLong;
-
-const int proprityLevels = 7;
-const vespalib::string priorityText[proprityLevels] =
- { "user", "nice", "system", "idle", "iowait", "ira", "softirq"};
-
-struct CpuInfo {
- int _cpuIndex;
- std::array<uint64_t, proprityLevels> _usage;
- CpuInfo(int index) : _cpuIndex(index) {}
-
- uint64_t getTotalUsage() const {
- uint64_t total = 0;
- for (uint32_t i=0; i<_usage.size(); ++i) total += _usage[i];
- return total;
- }
-};
-
-struct CpuReport {
- std::vector<CpuInfo> _cpuInfo;
- uint64_t _contextSwitches = 0;
- int64_t _swappedIn = 0;
- int64_t _swappedOut = 0;
- uint64_t _processesCreated = 0;
- uint64_t _processesBlocked = 0;
- uint64_t _processesRunning = 0;
-
- CpuInfo getTotalCpuInfo() const {
- CpuInfo total(0);
- for (uint32_t i=0; i < 7; ++i) total._usage[i] = 0;
- for (uint32_t i=0; i < _cpuInfo.size(); ++i) {
- for (uint32_t j=0; j < _cpuInfo[i]._usage.size(); ++j) {
- total._usage[j] += _cpuInfo[i]._usage[j];
- }
- }
- return total;
- }
-};
-
-long getValueWithLog(
- const vespalib::string &content,
- const vespalib::string &lineStart,
- int pos) {
- vespalib::string line = getLine(lineStart, content);
- if (!line.empty()) {
- return toLong(getToken(pos, line));
- } else {
- LOGBP(debug, "Line not found in /proc/stat : '%s'\nLine start: %s",
- content.c_str(), lineStart.c_str());
- }
- return 0;
-}
-
-void populateCpus(const vespalib::string &content, std::vector<CpuInfo> &cpuInfo) {
- for (uint32_t i=0; true; ++i) {
- vespalib::string line = getLine("cpu" + std::to_string(i), content);
- if (line.empty()) break;
- if (getTokenCount(line) < 8) {
- LOGBP(warning, "Unexpected line found in /proc/stat. Expected at "
- "least 8 tokens in cpu line: '%s'", line.c_str());
- continue;
- }
- CpuInfo info(i);
- for (uint32_t j=0; j<info._usage.size(); ++j) {
- info._usage[j] = toLong(getToken(j + 1, line));
- }
- cpuInfo.push_back(info);
- }
-}
-
-void populate(CpuReport& cpu) {
- /*
- * Parse /proc/stat. Expected format:
- * cpu 82190434 7180 85600255 12799031291 18183765 36669 458570
- * cpu0 10564061 448 10381577 1598933932 3065407 36668 206231
- * cpu1 10763472 763 10191606 1599538223 2655481 0 38988
- * cpu2 10206570 720 9845299 1600695947 2402795 0 37218
- * cpu3 10051762 966 9993106 1600750639 2354533 0 37565
- * cpu4 10176554 961 10818954 1600288785 1871033 0 32228
- * cpu5 10261736 845 11475459 1599497420 1917617 0 35456
- * cpu6 10244739 1050 11095848 1599960998 1851423 0 34488
- * cpu7 9921536 1422 11798403 1599365345 2065473 0 36392
- * intr 16439148517 3349609784 9 0 6 17 0 0 0 54121 0 0 0 3 0 0 0 204582604 0 0 0 0 0 85 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- * swap 49238 9161900
- * ctxt 17421122498
- * btime 1296732462
- * processes 83383001
- * procs_running 1
- * procs_blocked 0
- */
- vespalib::string content(readFile("/proc/stat"));
-
- populateCpus(content, cpu._cpuInfo);
- cpu._contextSwitches = getValueWithLog(content, "ctxt", 1);
- cpu._swappedIn = getValueWithLog(content, "swap", 1);
- cpu._swappedOut = getValueWithLog(content, "swap", 2);
- cpu._processesCreated = getValueWithLog(content, "processes", 1);
- cpu._processesRunning = getValueWithLog(content, "procs_running", 1);
- cpu._processesBlocked = getValueWithLog(content, "procs_blocked", 1);
-}
-}
-
-void CpuReporter::report(vespalib::JsonStream& jsonreport) {
- jsonreport << "cpu" << Object();
- CpuReport current;
- populate(current);
- CpuInfo currTotal = current.getTotalCpuInfo();
-
- jsonreport << "context switches" << current._contextSwitches;
- jsonreport << "pages swapped in"<< current._swappedIn;
- jsonreport << "pages swapped out" << current._swappedOut;
-
-
- for (uint32_t i=0; i<=current._cpuInfo.size(); ++i) {
- const CpuInfo& post(i == 0 ? currTotal : current._cpuInfo[i-1]);
- jsonreport << (i == 0 ? "cputotal" : "cpu" + std::to_string(post._cpuIndex))
- << Object();
- for (uint32_t j=0; j < proprityLevels; ++j) {
- double total = post.getTotalUsage();
- jsonreport << priorityText[j] << (total < 0.00001 ? 0 : total);
- }
- jsonreport << End();
- }
- jsonreport << End();
-}
-} /* namespace storage */
diff --git a/storage/src/vespa/storage/common/hostreporter/cpureporter.h b/storage/src/vespa/storage/common/hostreporter/cpureporter.h
deleted file mode 100644
index c4e66e536dd..00000000000
--- a/storage/src/vespa/storage/common/hostreporter/cpureporter.h
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#ifndef STORAGE_SRC_CPP_STORAGE_COMMON_HOSTINFO_CPUREPORTER_H_
-#define STORAGE_SRC_CPP_STORAGE_COMMON_HOSTINFO_CPUREPORTER_H_
-
-#include "hostreporter.h"
-
-namespace storage {
-
-class CpuReporter: public HostReporter {
-public:
- void report(vespalib::JsonStream& jsonreport) override;
-
- CpuReporter() {}
- ~CpuReporter() override {}
-};
-
-} /* namespace storage */
-
-#endif /* STORAGE_SRC_CPP_STORAGE_COMMON_HOSTINFO_CPUREPORTER_H_ */
diff --git a/storage/src/vespa/storage/common/hostreporter/diskreporter.cpp b/storage/src/vespa/storage/common/hostreporter/diskreporter.cpp
deleted file mode 100644
index 2d4ead9ca4b..00000000000
--- a/storage/src/vespa/storage/common/hostreporter/diskreporter.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#include "diskreporter.h"
-#include "kernelmetrictool.h"
-
-#include <vespa/vespalib/text/stringtokenizer.h>
-#include <vespa/vespalib/stllike/string.h>
-#include <iostream>
-
-namespace storage {
-namespace {
-using Object = vespalib::JsonStream::Object;
-using End = vespalib::JsonStream::End;
-using kernelmetrictool::readFile;
-using kernelmetrictool::getLine;
-using kernelmetrictool::getToken;
-using kernelmetrictool::toLong;
-using kernelmetrictool::stripWhitespace;
-}
-
-DiskReporter::DiskReporter() {}
-
-DiskReporter::~DiskReporter() {}
-
-void DiskReporter::report(vespalib::JsonStream& jsonreport) {
- vespalib::string content = readFile("/proc/diskstats");
- vespalib::StringTokenizer st(vespalib::StringTokenizer(content.c_str(), "\n", ""));
- jsonreport << "disk" << Object();
- for (uint32_t i=2; i<st.size(); ++i) {
- vespalib::string line(st[i]);
- /*
- * The /proc/diskstats file displays the I/O statistics
- * of block devices.
- * 0 - major number
- * 1 - minor mumber
- * 2 - device name
- * 3 - reads completed successfully
- * 4 - reads merged
- * 5 - sectors read
- * 6 - time spent reading (ms)
- * 7 - writes completed
- * 8 - writes merged
- * 9 - sectors written
- * 10 - time spent writing (ms)
- * 11 - I/Os currently in progress
- * 12 - time spent doing I/Os (ms)
- * 13 - weighted time spent doing I/Os (ms)
- */
- vespalib::string name = getToken(2, line);
- if (name.substr(0, 3) == "ram" || name.substr(0, 3) == "dm-"
- || name.substr(0, 4) == "loop") {
- continue;
- }
- jsonreport << name << Object();
- jsonreport << "reads merged" << toLong(getToken(4, line));
- jsonreport << "writes merged" << toLong(getToken(8, line));
- jsonreport << "reads" << toLong(getToken(3, line));
- jsonreport << "writes" << toLong(getToken(7, line));
- jsonreport << "in progress" << toLong(getToken(11, line));
- jsonreport << "sectors read" << toLong(getToken(5, line));
- jsonreport << "sectores written" << toLong(getToken(9, line));
- jsonreport << "time spent" << toLong(getToken(12, line));
- jsonreport << End();
- }
- jsonreport << End();
-}
-} /* namespace storage */
diff --git a/storage/src/vespa/storage/common/hostreporter/diskreporter.h b/storage/src/vespa/storage/common/hostreporter/diskreporter.h
deleted file mode 100644
index 3a44fb799fe..00000000000
--- a/storage/src/vespa/storage/common/hostreporter/diskreporter.h
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#ifndef STORAGE_SRC_CPP_STORAGE_COMMON_HOSTREPORTER_DISKREPORTER_H_
-#define STORAGE_SRC_CPP_STORAGE_COMMON_HOSTREPORTER_DISKREPORTER_H_
-
-#include "hostreporter.h"
-
-namespace storage {
-
-class DiskReporter: public HostReporter {
-public:
- DiskReporter();
- ~DiskReporter() override;
-
- void report(vespalib::JsonStream& jsonreport) override;
-};
-
-} /* namespace storage */
-
-#endif /* STORAGE_SRC_CPP_STORAGE_COMMON_HOSTREPORTER_DISKREPORTER_H_ */
diff --git a/storage/src/vespa/storage/common/hostreporter/hostinfo.cpp b/storage/src/vespa/storage/common/hostreporter/hostinfo.cpp
index f1178f2e706..566bd5b21f8 100644
--- a/storage/src/vespa/storage/common/hostreporter/hostinfo.cpp
+++ b/storage/src/vespa/storage/common/hostreporter/hostinfo.cpp
@@ -6,10 +6,6 @@
namespace storage {
HostInfo::HostInfo() {
- registerReporter(&cpuReporter);
- registerReporter(&diskReporter);
- registerReporter(&memReporter);
- registerReporter(&networkReporter);
registerReporter(&versionReporter);
}
@@ -25,4 +21,5 @@ void HostInfo::printReport(vespalib::JsonStream& report) {
void HostInfo::registerReporter(HostReporter *reporter) {
customReporters.push_back(reporter);
}
-} /* namespace storage */
+
+}
diff --git a/storage/src/vespa/storage/common/hostreporter/hostinfo.h b/storage/src/vespa/storage/common/hostreporter/hostinfo.h
index 6cac9e52f6a..61a220d55b0 100644
--- a/storage/src/vespa/storage/common/hostreporter/hostinfo.h
+++ b/storage/src/vespa/storage/common/hostreporter/hostinfo.h
@@ -1,13 +1,9 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#ifndef STORAGE_SRC_CPP_STORAGE_COMMON_HOSTREPORTER_HOSTINFO_H_
-#define STORAGE_SRC_CPP_STORAGE_COMMON_HOSTREPORTER_HOSTINFO_H_
+
+#pragma once
#include <vespa/vespalib/util/jsonstream.h>
-#include "cpureporter.h"
-#include "diskreporter.h"
-#include "memreporter.h"
-#include "networkreporter.h"
#include "versionreporter.h"
namespace storage {
@@ -27,13 +23,8 @@ public:
private:
std::vector<HostReporter*> customReporters;
- CpuReporter cpuReporter;
- DiskReporter diskReporter;
- MemReporter memReporter;
- NetworkReporter networkReporter;
VersionReporter versionReporter;
};
-} /* namespace storage */
+}
-#endif /* STORAGE_SRC_CPP_STORAGE_COMMON_HOSTREPORTER_HOSTINFO_H_ */
diff --git a/storage/src/vespa/storage/common/hostreporter/memreporter.cpp b/storage/src/vespa/storage/common/hostreporter/memreporter.cpp
deleted file mode 100644
index 861cb6c047a..00000000000
--- a/storage/src/vespa/storage/common/hostreporter/memreporter.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#include "memreporter.h"
-#include "kernelmetrictool.h"
-
-namespace storage {
-namespace {
-using Object = vespalib::JsonStream::Object;
-using End = vespalib::JsonStream::End;
-using kernelmetrictool::readFile;
-using kernelmetrictool::getLine;
-using kernelmetrictool::getToken;
-using kernelmetrictool::toLong;}
-
-MemReporter::MemReporter() {}
-MemReporter::~MemReporter() {}
-
-void MemReporter::report(vespalib::JsonStream& jsonreport) {
- /* Parse /proc/meminfo. Expected format
- * MemTotal: 36969940 kB
- * MemFree: 13856316 kB
- * Buffers: 612476 kB
- * Cached: 18603000 kB
- * SwapCached: 71064 kB
- * Active: 13504144 kB
- * Inactive: 7781768 kB
- * HighTotal: 0 kB
- * HighFree: 0 kB
- * LowTotal: 36969940 kB
- * LowFree: 13856316 kB
- * SwapTotal: 33554424 kB
- * SwapFree: 33465824 kB
- * Dirty: 1416 kB
- * Writeback: 0 kB
- * Mapped: 1225592 kB
- * Slab: 1669252 kB
- * CommitLimit: 52039392 kB
- * Committed_AS: 2337076 kB
- * PageTables: 12992 kB
- * VmallocTotal: 536870908 kB
- * VmallocUsed: 377960 kB
- * VmallocChunk: 536492708 kB
- */
- vespalib::string content = readFile("/proc/meminfo");
- // Usable RAM - Physical memory minus reserved bits and kernel code
- uint64_t memTotal = toLong(getToken(1, getLine("MemTotal:", content))) * 1024;
- // LowFree + HighFree
- uint64_t memFree = toLong(getToken(1, getLine("MemFree:", content))) * 1024;
- // Disk data cached in memory
- uint64_t cached = toLong(getToken(1, getLine("Cached:", content))) * 1024;
- // Memory used recently.
- uint64_t active = toLong(getToken(1, getLine("Active:", content))) * 1024;
- uint64_t inActive = toLong(getToken(1, getLine("Inactive:", content))) * 1024;
- uint64_t swapTotal = toLong(getToken(1, getLine("SwapTotal:", content))) * 1024;
- uint64_t swapFree = toLong(getToken(1, getLine("SwapFree:", content))) * 1024;
- // Bytes that may need to be written to disk soon. Swap or disk.
- uint64_t dirty = toLong(getToken(1, getLine("Dirty:", content))) * 1024;
-
- jsonreport << "memory" << Object()
- << "total memory" << memTotal
- << "free memory" << memFree
- << "disk cache" << cached
- << "active memory" << active
- << "inactive memory" << inActive
- << "swap total" << swapTotal
- << "swap free" << swapFree
- << "dirty" << dirty
- << End();
-}
-
-} /* namespace storage */
diff --git a/storage/src/vespa/storage/common/hostreporter/memreporter.h b/storage/src/vespa/storage/common/hostreporter/memreporter.h
deleted file mode 100644
index 66072fc5674..00000000000
--- a/storage/src/vespa/storage/common/hostreporter/memreporter.h
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#ifndef STORAGE_SRC_CPP_STORAGE_COMMON_HOSTREPORTER_MEMREPORTER_H_
-#define STORAGE_SRC_CPP_STORAGE_COMMON_HOSTREPORTER_MEMREPORTER_H_
-
-#include "hostreporter.h"
-
-namespace storage {
-
-class MemReporter: public HostReporter {
-public:
- MemReporter();
- ~MemReporter() override;
-
- void report(vespalib::JsonStream& jsonreport) override;
-};
-
-} /* namespace storage */
-
-#endif /* STORAGE_SRC_CPP_STORAGE_COMMON_HOSTREPORTER_MEMREPORTER_H_ */
diff --git a/storage/src/vespa/storage/common/hostreporter/networkreporter.cpp b/storage/src/vespa/storage/common/hostreporter/networkreporter.cpp
deleted file mode 100644
index 490d9941305..00000000000
--- a/storage/src/vespa/storage/common/hostreporter/networkreporter.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#include "networkreporter.h"
-#include "kernelmetrictool.h"
-#include <vespa/vespalib/text/stringtokenizer.h>
-
-namespace storage {
-namespace {
-using Object = vespalib::JsonStream::Object;
-using End = vespalib::JsonStream::End;
-using kernelmetrictool::readFile;
-using kernelmetrictool::getLine;
-using kernelmetrictool::getToken;
-using kernelmetrictool::toLong;
-using kernelmetrictool::stripWhitespace;
-}
-
-void NetworkReporter::report(vespalib::JsonStream& jsonreport) {
-
- vespalib::string content = readFile("/proc/net/dev");
- vespalib::StringTokenizer st(content.c_str(), "\n", "");
-
- jsonreport << "network" << Object();
-
- for (uint32_t i=2; i<st.size(); ++i) {
- vespalib::string line = st[i];
- vespalib::string::size_type pos = line.find(':');
- if (pos == vespalib::string::npos) {
- continue;
- }
- jsonreport << stripWhitespace(line.substr(0, pos)) << Object();
- vespalib::string data(line.substr(pos+1));
- jsonreport << "input" << Object();
- jsonreport << "bytes" << toLong(getToken(0, data));
- jsonreport << "packets" << toLong(getToken(1, data));
- jsonreport << "errors" << toLong(getToken(2, data));
- jsonreport << "drops" << toLong(getToken(3, data));
- jsonreport << End() << "output" << Object();
- jsonreport << "bytes" << toLong(getToken(8, data));
- jsonreport << "packets" << toLong(getToken(9, data));
- jsonreport << "errors" << toLong(getToken(10, data));
- jsonreport << "drops" << toLong(getToken(11, data));
- jsonreport << End();
- jsonreport << End();
- }
- jsonreport << End();
-}
-} /* namespace storage */
diff --git a/storage/src/vespa/storage/common/hostreporter/networkreporter.h b/storage/src/vespa/storage/common/hostreporter/networkreporter.h
deleted file mode 100644
index 17ecdb4517b..00000000000
--- a/storage/src/vespa/storage/common/hostreporter/networkreporter.h
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#ifndef STORAGE_SRC_CPP_STORAGE_COMMON_HOSTREPORTER_NETWORKREPORTER_H_
-#define STORAGE_SRC_CPP_STORAGE_COMMON_HOSTREPORTER_NETWORKREPORTER_H_
-
-#include "hostreporter.h"
-
-namespace storage {
-
-class NetworkReporter: public HostReporter {
-public:
- NetworkReporter() {};
- ~NetworkReporter() override {};
-
- void report(vespalib::JsonStream& jsonreport) override;
-};
-
-} /* namespace storage */
-
-#endif /* STORAGE_SRC_CPP_STORAGE_COMMON_HOSTREPORTER_NETWORKREPORTER_H_ */