use of org.jrobin.core.RrdDefTemplate in project jmxtrans by jmxtrans.
the class RRDWriter method createOrOpenDatabase.
/**
* If the database file doesn't exist, it'll get created, otherwise, it'll
* be returned in r/w mode.
*/
protected RrdDb createOrOpenDatabase() throws Exception {
RrdDb result;
if (!this.outputFile.exists()) {
FileUtils.forceMkdir(this.outputFile.getParentFile());
RrdDefTemplate t = new RrdDefTemplate(this.templateFile);
t.setVariable("database", this.outputFile.getCanonicalPath());
RrdDef def = t.getRrdDef();
result = new RrdDb(def);
} else {
result = new RrdDb(this.outputFile.getCanonicalPath());
}
return result;
}
use of org.jrobin.core.RrdDefTemplate in project jmxtrans by jmxtrans.
the class RRDToolWriter method getDatabaseTemplateSpec.
/**
* If the database file doesn't exist, it'll get created, otherwise, it'll
* be returned in r/w mode.
*/
protected RrdDef getDatabaseTemplateSpec() throws Exception {
RrdDefTemplate t = new RrdDefTemplate(templateFile);
t.setVariable("database", this.outputFile.getCanonicalPath());
RrdDef def = t.getRrdDef();
if (!this.outputFile.exists()) {
FileUtils.forceMkdir(this.outputFile.getParentFile());
rrdToolCreateDatabase(def);
}
return def;
}
Aggregations