Smallcase folders part 2

This commit is contained in:
2025-12-29 13:59:23 +00:00
parent 8bef59f793
commit 37fc8b0cf3
37 changed files with 127 additions and 116 deletions
+9 -8
View File
@@ -1,4 +1,4 @@
#include "Metrics/Collector.h"
#include "metrics/Collector.h"
#include <sstream>
#include <fstream>
@@ -11,7 +11,7 @@
namespace metrics
{
Collector::Collector(const std::vector<std::string> &disks) : disks(disks)
Collector::Collector(const std::vector<std::vector<std::string>> &disks) : disks(disks)
{
}
@@ -33,8 +33,8 @@ namespace metrics
prevCpu = curCpu;
host.memory = readMemory();
for (const std::string &disk : disks)
host.disks.push_back(readDisk(disk.c_str()));
for (const std::vector<std::string> &disk : disks)
host.disks.push_back(readDisk(disk));
readLoad(host.load1, host.load5, host.load15);
host.uptime = readUptime();
host.hostname = readHostname();
@@ -126,13 +126,13 @@ namespace metrics
return memory;
}
Disk Collector::readDisk(const char *path)
Disk Collector::readDisk(const std::vector<std::string> &disk)
{
struct statvfs vfs;
if (statvfs(path, &vfs) != 0)
if (statvfs(disk.at(1).c_str(), &vfs) != 0)
{
throw std::runtime_error(
std::string("statvfs failed for ") + path + ": " +
std::string("statvfs failed for ") + disk.at(1).c_str() + ": " +
std::strerror(errno));
}
@@ -141,7 +141,8 @@ namespace metrics
uint64_t used = total - free;
Disk d;
d.name = path;
d.name = disk.at(0);
d.path = disk.at(1);
d.total = total;
d.free = free;
d.used = used;