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 clear <configurationfile> remove property files from conf");
message.appendln(" statoolinfos crawl <configurationfile> crawl all file from conf and input"); 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 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(" statoolinfos uptime <configurationfile> update uptime journal");
message.appendln(); message.appendln();
message.appendln(" statoolinfos format <fileordirectory> format property files in tiny way"); message.appendln(" statoolinfos format <fileordirectory> format property files in tiny way");
@ -386,6 +386,25 @@ public final class StatoolInfosCLI
else if (isMatching(args, "probe", "\\s*.+\\.conf\\s*")) else if (isMatching(args, "probe", "\\s*.+\\.conf\\s*"))
{ {
File configurationFile = new File(StringUtils.trim(args[1])); File configurationFile = new File(StringUtils.trim(args[1]));
if (configurationFile.isDirectory())
{
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();
}
}
}
else
{
try try
{ {
StatoolInfos.probe(configurationFile); StatoolInfos.probe(configurationFile);
@ -396,6 +415,7 @@ public final class StatoolInfosCLI
exception.printStackTrace(); exception.printStackTrace();
} }
} }
}
else if (isMatching(args, "stat", "ip", "\\s*\\S+\\s*")) else if (isMatching(args, "stat", "ip", "\\s*\\S+\\s*"))
{ {
File source = new File(args[2]); File source = new File(args[2]);