blob: 3258b360bab850d7c3f628a59db066ea2afd2542 [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 (const auto& service : j["services"].items())
{
if (gVerbose)
{
std::cout << "service: " << service.value() << std::endl;
}
systemdServiceMap.push_back(service.value());
}
}
return systemdServiceMap;
}