use of org.opennms.features.jmxconfiggenerator.graphs.JmxConfigReader in project opennms by OpenNMS.
the class GraphCreateCommand method execute.
@Override
protected void execute() throws CmdRunException, CmdLineException {
if (printTemplate) {
LOG.info(getClass().getResourceAsStream("/graphTemplate.vm"));
return;
}
try {
JmxConfigReader jmxToSnmpGraphConfigGen = new JmxConfigReader(LOG);
Collection<Report> reports = jmxToSnmpGraphConfigGen.generateReportsByJmxDatacollectionConfig(inputFile);
GraphConfigGenerator graphConfigGenerator = new GraphConfigGenerator(LOG);
String snmpGraphConfig = graphConfigGenerator.generateSnmpGraph(reports, templateFile);
LOG.info(snmpGraphConfig);
ByteStreams.copy(new ByteArrayInputStream(snmpGraphConfig.getBytes()), new FileOutputStream(outFile));
} catch (IOException ioex) {
throw new CmdRunException(ioex);
}
}
use of org.opennms.features.jmxconfiggenerator.graphs.JmxConfigReader in project opennms by OpenNMS.
the class GenerateConfigsJob method execute.
@Override
public Void execute() throws JobManager.TaskRunException {
// create snmp-graph.properties
GraphConfigGenerator graphConfigGenerator = new GraphConfigGenerator(new Slf4jLogAdapter(GraphConfigGenerator.class));
Collection<Report> reports = new JmxConfigReader(new Slf4jLogAdapter(JmxConfigReader.class)).generateReportsByJmxDatacollectionConfig(model.getOutputConfig());
model.setSnmpGraphProperties(graphConfigGenerator.generateSnmpGraph(reports));
model.updateOutput();
return null;
}
Aggregations