blob: 46d9156a2ac2b6e33d9a6437eafc7a2545aa5825 [file] [log] [blame]
#include "systemd_service_parser.hpp"
#include <fstream>
#include <iostream>
ServiceMonitorData parseServiceFiles(const std::vector<std::string>& filePaths)
{
ServiceMonitorData systemdServiceMap;
for (const auto& jsonFile : filePaths)
{
if (gVerbose)
{
std::cout << "Parsing input service file " << jsonFile << std::endl;
}
std::ifstream fileStream(jsonFile);
auto j = json::parse(fileStream);
for (auto& service : j["services"].items())
{
if (gVerbose)
{
std::cout << "service: " << service.value() << std::endl;
}
systemdServiceMap.push_back(service.value());
}
}
return systemdServiceMap;
}