Search in sources :

Example 1 with RrdDefTemplate

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;
}
Also used : RrdDefTemplate(org.jrobin.core.RrdDefTemplate) RrdDef(org.jrobin.core.RrdDef) RrdDb(org.jrobin.core.RrdDb)

Example 2 with RrdDefTemplate

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;
}
Also used : RrdDefTemplate(org.jrobin.core.RrdDefTemplate) RrdDef(org.jrobin.core.RrdDef)

Aggregations

RrdDef (org.jrobin.core.RrdDef)2 RrdDefTemplate (org.jrobin.core.RrdDefTemplate)2 RrdDb (org.jrobin.core.RrdDb)1