Added directory as probe parameter.

This commit is contained in:
Christian P. MOMON 2021-12-09 11:53:17 +01:00
parent 22d3e79949
commit ab185d4923

View file

@ -109,7 +109,7 @@ public final class StatoolInfosCLI
message.appendln(" statoolinfos clear <configurationfile> remove property files from conf");
message.appendln(" statoolinfos crawl <configurationfile> crawl all file from conf and input");
message.appendln(" statoolinfos htmlize <configurationfile> generate web pages from conf");
message.appendln(" statoolinfos probe <configurationfile> generate metrics files from conf");
message.appendln(" statoolinfos probe [<directory>|<configurationfile>] generate metrics files from conf");
message.appendln(" statoolinfos uptime <configurationfile> update uptime journal");
message.appendln();
message.appendln(" statoolinfos format <fileordirectory> format property files in tiny way");
@ -386,14 +386,34 @@ public final class StatoolInfosCLI
else if (isMatching(args, "probe", "\\s*.+\\.conf\\s*"))
{
File configurationFile = new File(StringUtils.trim(args[1]));
try
if (configurationFile.isDirectory())
{
StatoolInfos.probe(configurationFile);
Files inputs = FilesUtils.searchEndingWith(configurationFile, ".conf");
for (File input : inputs)
{
try
{
StatoolInfos.probe(input);
}
catch (Exception exception)
{
logger.error("Error with [{}]: {}", input.getAbsoluteFile(), exception.getMessage());
exception.printStackTrace();
}
}
}
catch (Exception exception)
else
{
logger.error("Error with [{}]: {}", configurationFile.getAbsoluteFile(), exception.getMessage());
exception.printStackTrace();
try
{
StatoolInfos.probe(configurationFile);
}
catch (Exception exception)
{
logger.error("Error with [{}]: {}", configurationFile.getAbsoluteFile(), exception.getMessage());
exception.printStackTrace();
}
}
}
else if (isMatching(args, "stat", "ip", "\\s*\\S+\\s*"))